From e8333274e5513ca314bc5ea692885ac54a6c26a3 Mon Sep 17 00:00:00 2001 From: Altay Sansal Date: Thu, 12 Sep 2024 17:16:46 -0500 Subject: [PATCH 01/13] Add SEG-Y revision interpretation transform Introduced a new `SegyRevisionTransform` class to interpret the SEG-Y revision field in the binary header. This transform has been added to the `transform_map` and applied in the SEG-Y file processing pipeline. The code raises a `NotImplementedError` for SEG-Y revisions 2 and above. --- src/segy/file.py | 3 +++ src/segy/transforms.py | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/segy/file.py b/src/segy/file.py index 61aea81..37c81cf 100644 --- a/src/segy/file.py +++ b/src/segy/file.py @@ -239,6 +239,9 @@ def binary_header(self) -> HeaderArray: little_endian = TransformFactory.create("byte_swap", Endianness.LITTLE) transforms.add_transform(little_endian) + interpret_revision = TransformFactory.create("segy_revision") + transforms.add_transform(interpret_revision) + return HeaderArray(transforms.apply(bin_hdr)) def _update_spec(self) -> None: diff --git a/src/segy/transforms.py b/src/segy/transforms.py index 6c3412d..8480662 100644 --- a/src/segy/transforms.py +++ b/src/segy/transforms.py @@ -8,6 +8,7 @@ import numpy as np +from segy.schema import SegyStandard from segy.schema.base import Endianness if TYPE_CHECKING: @@ -197,6 +198,23 @@ def transform(self, data: NDArray[Any]) -> NDArray[Any]: return func(data.astype(cast_dtype)) # type: ignore +class SegyRevisionTransform(Transform): + """Interpret the SEG-Y revision field in binary header.""" + + def __init__(self) -> None: + super().__init__() + + def transform(self, data: NDArray[Any]) -> NDArray[Any]: + """Assume Rev1 parsed major and update minor if major is 2.""" + major = SegyStandard(data["segy_revision"] // 256) + data["segy_revision"] = major + if major >= SegyStandard.REV2: + msg = "Revision interpretation for Rev2+ is not implemented." + raise NotImplementedError(msg) + + return data + + class TraceTransform(Transform): """Composite transform to apply header and data pipeline to trace. @@ -235,6 +253,7 @@ class TransformFactory: transform_map: dict[str, type[Transform]] = { "byte_swap": ByteSwapTransform, "ibm_float": IbmFloatTransform, + "segy_revision": SegyRevisionTransform, "trace": TraceTransform, } From b3d6d392cca33904f04a9bda44878f8101d5d617 Mon Sep 17 00:00:00 2001 From: Altay Sansal Date: Thu, 12 Sep 2024 17:20:26 -0500 Subject: [PATCH 02/13] Prevent transformation for SEGY revision zero Add a check to exit the transform method early if the SEGY revision is zero. This avoids unnecessary processing and potential errors when the revision is not set or is invalid. --- src/segy/transforms.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/segy/transforms.py b/src/segy/transforms.py index 8480662..35f17a9 100644 --- a/src/segy/transforms.py +++ b/src/segy/transforms.py @@ -206,6 +206,9 @@ def __init__(self) -> None: def transform(self, data: NDArray[Any]) -> NDArray[Any]: """Assume Rev1 parsed major and update minor if major is 2.""" + if data["segy_revision"] == 0: + return data + major = SegyStandard(data["segy_revision"] // 256) data["segy_revision"] = major if major >= SegyStandard.REV2: From b53579bf5e4b8bfad31af113834d7ab747b4ec84 Mon Sep 17 00:00:00 2001 From: Altay Sansal Date: Thu, 12 Sep 2024 17:22:38 -0500 Subject: [PATCH 03/13] Fix segy_revision dtype check in transform method Updated the transform method to check for the presence of the 'segy_revision' field in the data's dtype. This ensures compatibility with data structures that may not contain the 'segy_revision' key. --- src/segy/transforms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/segy/transforms.py b/src/segy/transforms.py index 35f17a9..504e638 100644 --- a/src/segy/transforms.py +++ b/src/segy/transforms.py @@ -206,7 +206,7 @@ def __init__(self) -> None: def transform(self, data: NDArray[Any]) -> NDArray[Any]: """Assume Rev1 parsed major and update minor if major is 2.""" - if data["segy_revision"] == 0: + if "segy_revision" not in data.dtype.names: return data major = SegyStandard(data["segy_revision"] // 256) From 0f06d2101f30f57a828678103f8b716cffeefb27 Mon Sep 17 00:00:00 2001 From: Altay Sansal Date: Thu, 12 Sep 2024 17:25:32 -0500 Subject: [PATCH 04/13] Remove NotImplementedError for SegyStandard Rev2+ This change eliminates the exception raised for SEGY revision 2 or higher, allowing the code to continue without interruption. The revision interpretation for Rev2+ will need to be handled appropriately in the future. --- src/segy/transforms.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/segy/transforms.py b/src/segy/transforms.py index 504e638..da1250b 100644 --- a/src/segy/transforms.py +++ b/src/segy/transforms.py @@ -211,9 +211,6 @@ def transform(self, data: NDArray[Any]) -> NDArray[Any]: major = SegyStandard(data["segy_revision"] // 256) data["segy_revision"] = major - if major >= SegyStandard.REV2: - msg = "Revision interpretation for Rev2+ is not implemented." - raise NotImplementedError(msg) return data From 1c1dc1f78dc7cc4eb3d655862d985e8465071291 Mon Sep 17 00:00:00 2001 From: Altay Sansal Date: Thu, 12 Sep 2024 17:46:07 -0500 Subject: [PATCH 05/13] Refactor SEG-Y revision parsing for clarity and correctness Revised the `transform` method to enhance parsing of SEG-Y revisions from the binary header. Added detailed handling for SEG-Y Rev1 and simplified processing for Rev2 to ensure accurate interpretation based on the binary format. --- src/segy/transforms.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/segy/transforms.py b/src/segy/transforms.py index da1250b..c5206c3 100644 --- a/src/segy/transforms.py +++ b/src/segy/transforms.py @@ -18,6 +18,8 @@ from numpy.typing import DTypeLike from numpy.typing import NDArray +REV1_INT16 = 256 + def get_endianness(data: NDArray[Any]) -> Endianness: """Map the numpy byte order character to Endianness.""" @@ -205,12 +207,20 @@ def __init__(self) -> None: super().__init__() def transform(self, data: NDArray[Any]) -> NDArray[Any]: - """Assume Rev1 parsed major and update minor if major is 2.""" - if "segy_revision" not in data.dtype.names: + """Parse SEG-Y standard from binary header.""" + if "segy_revision" not in data.dtype.names: # Rev0 return data - major = SegyStandard(data["segy_revision"] // 256) - data["segy_revision"] = major + # Rev1 needs special treatment. + # Rev1 is 16-bit with Q-point between the bytes. That means + # SEG-Y 1.0 is written as 00000001 00000000 in binary, 256 in base-2. + if data["segy_revision"] == REV1_INT16: # noqa: PLR2004 + data["segy_revision"] = SegyStandard.REV1 + + # Rev2 doesn't need special treatment because it splits into + # two 8-bit integers for major and minor versions. + # SEG-Y Rev2.0 is 00000010 00000000 in binary, (2, 0) in base-2 + # SEG-Y Rev2.1 is 00000010 00000001 in binary, (2, 1) in base-2 return data From 3135b04933923305dc03092af9464781192e487e Mon Sep 17 00:00:00 2001 From: Altay Sansal Date: Thu, 12 Sep 2024 17:47:30 -0500 Subject: [PATCH 06/13] Clarify division base in SEGY revision calculation Updated the calculation of the SEGY revision to specify that the division by 256.0 is based on hexadecimal representation. This enhances code readability and helps avoid potential confusion for future maintainers. --- src/segy/file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/segy/file.py b/src/segy/file.py index 37c81cf..19b5b19 100644 --- a/src/segy/file.py +++ b/src/segy/file.py @@ -76,7 +76,7 @@ def infer_endianness( bin_spec.endianness = endianness bin_hdr = np.frombuffer(buffer, dtype=bin_spec.dtype) - revision = bin_hdr["segy_revision"].item() / 256.0 + revision = bin_hdr["segy_revision"].item() / 256.0 # base-16 sample_increment = bin_hdr["sample_interval"].item() sample_format_int = bin_hdr["data_sample_format"].item() From 5a15ecf964a5f057f36494c59e331b60160f0afb Mon Sep 17 00:00:00 2001 From: Altay Sansal Date: Thu, 12 Sep 2024 17:48:05 -0500 Subject: [PATCH 07/13] Refactor SEGY revision handling in binary header Standardize the logic for setting SEGY revisions and include minor version information for revisions above REV1. This ensures proper version encoding and enhances compatibility with higher SEGY standards. --- src/segy/factory.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/segy/factory.py b/src/segy/factory.py index ab9bf1a..418fad5 100644 --- a/src/segy/factory.py +++ b/src/segy/factory.py @@ -147,9 +147,12 @@ def create_binary_header(self, update: dict[str, Any] | None = None) -> bytes: binary_spec = self.spec.binary_header bin_header = HeaderArray(np.zeros(shape=1, dtype=binary_spec.dtype)) - rev0 = self.segy_revision == SegyStandard.REV0 - if self.segy_revision is not None and not rev0: - bin_header["segy_revision"] = self.segy_revision.value * 256 + if self.segy_revision == SegyStandard.REV1: + bin_header["segy_revision"] = 256 # base-16 + elif self.segy_revision >= SegyStandard.REV2: + minor, major = np.modf(self.segy_revision.value) + bin_header["segy_revision"] = major + bin_header["segy_revision_minor"] = minor bin_header["sample_interval"] = self.sample_interval bin_header["orig_sample_interval"] = self.sample_interval From b2c776c7265902281b8a8aea6ca10bcca8b1d189 Mon Sep 17 00:00:00 2001 From: Altay Sansal Date: Thu, 12 Sep 2024 17:58:01 -0500 Subject: [PATCH 08/13] static typing fixess --- src/segy/factory.py | 6 ++++-- src/segy/transforms.py | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/segy/factory.py b/src/segy/factory.py index 418fad5..2912f4a 100644 --- a/src/segy/factory.py +++ b/src/segy/factory.py @@ -147,10 +147,12 @@ def create_binary_header(self, update: dict[str, Any] | None = None) -> bytes: binary_spec = self.spec.binary_header bin_header = HeaderArray(np.zeros(shape=1, dtype=binary_spec.dtype)) - if self.segy_revision == SegyStandard.REV1: + if self.segy_revision is None: + pass + elif self.segy_revision == SegyStandard.REV1: bin_header["segy_revision"] = 256 # base-16 elif self.segy_revision >= SegyStandard.REV2: - minor, major = np.modf(self.segy_revision.value) + minor, major = np.modf(self.segy_revision) bin_header["segy_revision"] = major bin_header["segy_revision_minor"] = minor diff --git a/src/segy/transforms.py b/src/segy/transforms.py index c5206c3..2f9dfbb 100644 --- a/src/segy/transforms.py +++ b/src/segy/transforms.py @@ -208,7 +208,8 @@ def __init__(self) -> None: def transform(self, data: NDArray[Any]) -> NDArray[Any]: """Parse SEG-Y standard from binary header.""" - if "segy_revision" not in data.dtype.names: # Rev0 + if data.dtype.names is not None and "segy_revision" not in data.dtype.names: + # Rev0 return data # Rev1 needs special treatment. From d2f6254bdfc3a838347ea69ad2f2d94ab7da1ecb Mon Sep 17 00:00:00 2001 From: Altay Sansal Date: Wed, 18 Sep 2024 13:30:14 -0500 Subject: [PATCH 09/13] Refactor revision transform handling Refactored how SEG-Y revisions are parsed and applied within the transform pipelines. Introduced better handling for integer-based Rev1 and separated handling for major and minor revisions in Rev2. Added comprehensive tests for different endianness and revision versions to ensure reliability. --- src/segy/constants.py | 3 +++ src/segy/factory.py | 5 +++-- src/segy/file.py | 3 ++- src/segy/transforms.py | 8 +++----- tests/test_transforms.py | 42 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 src/segy/constants.py diff --git a/src/segy/constants.py b/src/segy/constants.py new file mode 100644 index 0000000..6a7dfbf --- /dev/null +++ b/src/segy/constants.py @@ -0,0 +1,3 @@ +"""Constant values used in SEG_Y.""" + +REV1_BASE16 = 0x01_00 # hex -> int = 256 diff --git a/src/segy/factory.py b/src/segy/factory.py index 2912f4a..132f4ec 100644 --- a/src/segy/factory.py +++ b/src/segy/factory.py @@ -11,6 +11,7 @@ from segy.arrays import HeaderArray from segy.arrays import TraceArray +from segy.constants import REV1_BASE16 from segy.schema.base import Endianness from segy.schema.format import ScalarType from segy.schema.segy import SegyStandard @@ -150,10 +151,10 @@ def create_binary_header(self, update: dict[str, Any] | None = None) -> bytes: if self.segy_revision is None: pass elif self.segy_revision == SegyStandard.REV1: - bin_header["segy_revision"] = 256 # base-16 + bin_header["segy_revision"] = REV1_BASE16 # base-16 elif self.segy_revision >= SegyStandard.REV2: minor, major = np.modf(self.segy_revision) - bin_header["segy_revision"] = major + bin_header["segy_revision_major"] = major bin_header["segy_revision_minor"] = minor bin_header["sample_interval"] = self.sample_interval diff --git a/src/segy/file.py b/src/segy/file.py index 19b5b19..433dad2 100644 --- a/src/segy/file.py +++ b/src/segy/file.py @@ -13,6 +13,7 @@ from segy.accessors import TraceAccessor from segy.arrays import HeaderArray from segy.config import SegySettings +from segy.constants import REV1_BASE16 from segy.exceptions import EndiannessInferenceError from segy.indexing import DataIndexer from segy.indexing import HeaderIndexer @@ -76,7 +77,7 @@ def infer_endianness( bin_spec.endianness = endianness bin_hdr = np.frombuffer(buffer, dtype=bin_spec.dtype) - revision = bin_hdr["segy_revision"].item() / 256.0 # base-16 + revision = bin_hdr["segy_revision"].item() / REV1_BASE16 sample_increment = bin_hdr["sample_interval"].item() sample_format_int = bin_hdr["data_sample_format"].item() diff --git a/src/segy/transforms.py b/src/segy/transforms.py index 2f9dfbb..9b0af8c 100644 --- a/src/segy/transforms.py +++ b/src/segy/transforms.py @@ -8,6 +8,7 @@ import numpy as np +from segy.constants import REV1_BASE16 from segy.schema import SegyStandard from segy.schema.base import Endianness @@ -18,8 +19,6 @@ from numpy.typing import DTypeLike from numpy.typing import NDArray -REV1_INT16 = 256 - def get_endianness(data: NDArray[Any]) -> Endianness: """Map the numpy byte order character to Endianness.""" @@ -209,13 +208,12 @@ def __init__(self) -> None: def transform(self, data: NDArray[Any]) -> NDArray[Any]: """Parse SEG-Y standard from binary header.""" if data.dtype.names is not None and "segy_revision" not in data.dtype.names: - # Rev0 - return data + return data # rev0, no-op # Rev1 needs special treatment. # Rev1 is 16-bit with Q-point between the bytes. That means # SEG-Y 1.0 is written as 00000001 00000000 in binary, 256 in base-2. - if data["segy_revision"] == REV1_INT16: # noqa: PLR2004 + if data["segy_revision"] == REV1_BASE16: data["segy_revision"] = SegyStandard.REV1 # Rev2 doesn't need special treatment because it splits into diff --git a/tests/test_transforms.py b/tests/test_transforms.py index 0522346..e73961b 100644 --- a/tests/test_transforms.py +++ b/tests/test_transforms.py @@ -8,7 +8,10 @@ import numpy as np import pytest +from segy import SegyFactory +from segy.schema import SegyStandard from segy.schema.base import Endianness +from segy.standards import get_segy_standard from segy.transforms import TransformFactory from segy.transforms import TransformPipeline @@ -128,6 +131,45 @@ def test_ibm_float_field(self, mock_header_ibm: NDArray[Any]) -> None: assert transformed_header[0].item() == expected.item() +class TestRevisionTransform: + """Test SEG-Y revision transforms. This tests both transform and factory.""" + + @pytest.mark.parametrize("endian", ["little", "big"]) + @pytest.mark.parametrize(("major", "minor"), [(0, 0), (1, 0), (2, 0)]) + def test_rev_parse(self, endian: str, major: int, minor: int) -> None: + """Test array scaling.""" + # Set parameters + rev_float = float(f"{major}.{minor}") + revision = SegyStandard(rev_float) + endianness = Endianness(endian) + + # Create binary header with factory + spec = get_segy_standard(revision) + spec.endianness = endianness + segy_factory = SegyFactory(spec) + bin_header_bytes = bytearray(segy_factory.create_binary_header()) + bin_header = np.frombuffer(bin_header_bytes, dtype=spec.binary_header) + + # Set up and apply transform + transform = TransformFactory.create("segy_revision") + transformed_bin_header = transform.apply(bin_header) + + if revision == SegyStandard.REV0: + assert "segy_revision" not in transformed_bin_header.dtype.names + assert "segy_revision_major" not in transformed_bin_header.dtype.names + assert "segy_revision_minor" not in transformed_bin_header.dtype.names + + elif revision == SegyStandard.REV1: + assert transformed_bin_header["segy_revision"].squeeze() == major + assert "segy_revision_major" not in transformed_bin_header.dtype.names + assert "segy_revision_minor" not in transformed_bin_header.dtype.names + + elif revision == SegyStandard.REV2: + assert transformed_bin_header["segy_revision_major"].squeeze() == major + assert transformed_bin_header["segy_revision_minor"].squeeze() == minor + assert "segy_revision" not in transformed_bin_header.dtype.names + + class TestTransformPipeline: """Tests for transform pipeline and transform integration.""" From 591d0d5d498cf6df8c7c21ca81b86e355178a97a Mon Sep 17 00:00:00 2001 From: Altay Sansal Date: Wed, 18 Sep 2024 13:45:40 -0500 Subject: [PATCH 10/13] static typing for mypy --- tests/test_transforms.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/test_transforms.py b/tests/test_transforms.py index e73961b..ab518f3 100644 --- a/tests/test_transforms.py +++ b/tests/test_transforms.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import TYPE_CHECKING -from typing import Any +from typing import cast import numpy as np import pytest @@ -16,6 +16,8 @@ from segy.transforms import TransformPipeline if TYPE_CHECKING: + from typing import Any + from numpy.typing import NDArray @@ -154,20 +156,22 @@ def test_rev_parse(self, endian: str, major: int, minor: int) -> None: transform = TransformFactory.create("segy_revision") transformed_bin_header = transform.apply(bin_header) + header_fields = cast(tuple[str], transformed_bin_header.dtype.names) + if revision == SegyStandard.REV0: - assert "segy_revision" not in transformed_bin_header.dtype.names - assert "segy_revision_major" not in transformed_bin_header.dtype.names - assert "segy_revision_minor" not in transformed_bin_header.dtype.names + assert "segy_revision" not in header_fields + assert "segy_revision_major" not in header_fields + assert "segy_revision_minor" not in header_fields elif revision == SegyStandard.REV1: assert transformed_bin_header["segy_revision"].squeeze() == major - assert "segy_revision_major" not in transformed_bin_header.dtype.names - assert "segy_revision_minor" not in transformed_bin_header.dtype.names + assert "segy_revision_major" not in header_fields + assert "segy_revision_minor" not in header_fields elif revision == SegyStandard.REV2: assert transformed_bin_header["segy_revision_major"].squeeze() == major assert transformed_bin_header["segy_revision_minor"].squeeze() == minor - assert "segy_revision" not in transformed_bin_header.dtype.names + assert "segy_revision" not in header_fields class TestTransformPipeline: From 4d4d5e818305e1db3056856011fecc568f46685d Mon Sep 17 00:00:00 2001 From: Altay Sansal Date: Wed, 18 Sep 2024 15:02:36 -0500 Subject: [PATCH 11/13] Refactor segy_revision property and clean up tests Refactored the segy_revision property to ensure a default value of SegyStandard.REV0 when the segy_standard is None. Removed redundant checks in the create_textual_header method and cleaned up type-ignore comments in the test cases. This improves readability and robustness of the SEG-Y factory code. --- src/segy/factory.py | 11 ++++++----- tests/test_segy_factory.py | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/segy/factory.py b/src/segy/factory.py index 132f4ec..7fcbc35 100644 --- a/src/segy/factory.py +++ b/src/segy/factory.py @@ -104,8 +104,11 @@ def samples_per_trace(self) -> int: return cast(int, self.spec.trace.data.samples) @property - def segy_revision(self) -> SegyStandard | None: + def segy_revision(self) -> SegyStandard: """Revision of the SEG-Y file.""" + if self.spec.segy_standard is None: + return SegyStandard.REV0 + return self.spec.segy_standard def create_textual_header(self, text: str | None = None) -> bytes: @@ -148,10 +151,8 @@ def create_binary_header(self, update: dict[str, Any] | None = None) -> bytes: binary_spec = self.spec.binary_header bin_header = HeaderArray(np.zeros(shape=1, dtype=binary_spec.dtype)) - if self.segy_revision is None: - pass - elif self.segy_revision == SegyStandard.REV1: - bin_header["segy_revision"] = REV1_BASE16 # base-16 + if self.segy_revision == SegyStandard.REV1: + bin_header["segy_revision"] = REV1_BASE16 elif self.segy_revision >= SegyStandard.REV2: minor, major = np.modf(self.segy_revision) bin_header["segy_revision_major"] = major diff --git a/tests/test_segy_factory.py b/tests/test_segy_factory.py index 37a652a..a0a8b1f 100644 --- a/tests/test_segy_factory.py +++ b/tests/test_segy_factory.py @@ -128,7 +128,7 @@ def test_binary_header_default( mock_segy_factory.samples_per_trace, mock_segy_factory.samples_per_trace, SEGY_FORMAT_MAP[mock_segy_factory.sample_format], - mock_segy_factory.segy_revision.value * 256, # type: ignore[union-attr] + mock_segy_factory.segy_revision.value * 256, 0, # fixed length trace flag 0, # extended text headers ) @@ -152,7 +152,7 @@ def test_binary_header_custom(self, mock_segy_factory: SegyFactory) -> None: mock_segy_factory.samples_per_trace, mock_segy_factory.samples_per_trace, SEGY_FORMAT_MAP[mock_segy_factory.sample_format], - mock_segy_factory.segy_revision.value * 256, # type: ignore[union-attr] + mock_segy_factory.segy_revision.value * 256, 1, # fixed length trace flag 2, # extended text headers ) From aeaf553ee87661505eaf09832ff3694f6c75b11e Mon Sep 17 00:00:00 2001 From: Altay Sansal Date: Wed, 18 Sep 2024 15:25:56 -0500 Subject: [PATCH 12/13] ensure we use the float value of standard --- src/segy/factory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/segy/factory.py b/src/segy/factory.py index 7fcbc35..ce2d4b3 100644 --- a/src/segy/factory.py +++ b/src/segy/factory.py @@ -154,7 +154,7 @@ def create_binary_header(self, update: dict[str, Any] | None = None) -> bytes: if self.segy_revision == SegyStandard.REV1: bin_header["segy_revision"] = REV1_BASE16 elif self.segy_revision >= SegyStandard.REV2: - minor, major = np.modf(self.segy_revision) + minor, major = np.modf(self.segy_revision.value) bin_header["segy_revision_major"] = major bin_header["segy_revision_minor"] = minor From 40fcc65b25f1e6c0794d821462eff2fb47c02d51 Mon Sep 17 00:00:00 2001 From: Altay Sansal Date: Wed, 18 Sep 2024 15:36:03 -0500 Subject: [PATCH 13/13] Add None option to segy_standard in factory test configs Updated the SegyFactoryTestConfig class to allow segy_standard to be None. This change expands the test configurations to include cases where segy_standard is not specified. --- tests/test_segy_factory.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_segy_factory.py b/tests/test_segy_factory.py index a0a8b1f..07d63a4 100644 --- a/tests/test_segy_factory.py +++ b/tests/test_segy_factory.py @@ -25,13 +25,14 @@ class SegyFactoryTestConfig: """Dataclass to configure common test patterns.""" - segy_standard: SegyStandard + segy_standard: SegyStandard | None endianness: Endianness sample_interval: int samples_per_trace: int SEGY_FACTORY_TEST_CONFIGS = [ + SegyFactoryTestConfig(None, Endianness.BIG, 2000, 51), SegyFactoryTestConfig(SegyStandard.REV0, Endianness.BIG, 2000, 51), SegyFactoryTestConfig(SegyStandard.REV1, Endianness.LITTLE, 3000, 1), SegyFactoryTestConfig(SegyStandard.REV0, Endianness.BIG, 5000, 10),