-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SEG-Y creation functionality #52
Conversation
The src/segy/typing.py file was deleted and consequently, the ibm.py file has been refactored. Now, the typing imports and alias definitions initially in the typing.py file have been moved directly into ibm.py.
A new transformation strategy, IbmFloatStrategy, is introduced in the transforms module. This strategy includes conversions between IBM and IEEE formats. It allows to transform an array of data to and from these formats, enhancing the flexibility of the transformation pipeline.
The name of the field "nsamples" in the file "src/segy/standards/rev0.py" has been changed to "samples_per_trace" to provide more clarity and improve understanding of the code.
A new factory class, `SegyFactory`, has been introduced for constructing SEG-Y files from their components. This class provides methods for creating a textual header, binary header, and trace headers/templates as per the SEG-Y specifications. Additionally, it includes functionality for transforming data types and conforming to endianness requirements.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #52 +/- ##
==========================================
+ Coverage 92.29% 94.31% +2.02%
==========================================
Files 35 36 +1
Lines 1323 1584 +261
Branches 161 189 +28
==========================================
+ Hits 1221 1494 +273
+ Misses 73 66 -7
+ Partials 29 24 -5 ☔ View full report in Codecov by Sentry. |
…t conversions, and scaling.
Simplified the way transformations are added to a pipeline in indexing.py. Instead of using the TransformStrategyFactory, we now use the simpler TransformFactory. Also altered pipeline calls from 'transform' to 'apply'.
The code for setting up transformation pipeline in src/segy/file.py has been refactored for better efficiency and readability. The binary_endian is directly replaced with a byte_swap using the TransformFactory.create, thereby simplifying the pipeline addition process. This change effectively reduces the complexity and improves maintainability of the code.
The versions of four dependencies in pyproject.toml have been updated. Specifically, typer's version has been updated from 0.9.0 to 0.10.0. Additionally, ruff, pre-commit, and typeguard versions have been bumped to 0.3.4, 3.7.0, and 4.2.1, respectively.
The TransformStrategyFactory related code has been simplified by using a new TransformFactory class. This refactoring effort includes streamlining the creation of "byte_swap" and "ibm_float" transforms and adjusting their application in the header and data pipelines. The revised code has a cleaner, more direct structure, contributing to better maintainability and readability.
A new line has been added to the factory inferring the SEG-Y revision from the specification and setting it in the binary header. This ensures that the binary header accurately reflects the SEG-Y standard being used.
A tutorial document 'creation.ipynb' and its index entry have been newly added. This tutorial contains detailed instructions on how to create new SEG-Y files from spec specifications, import necessary modules, populate trace values, create the binary SEG-Y file, and open it with the SegyFile function.
@ta-hill can you please start review? I would like to merge this as the initial implementation. It also comes with all the new transforms. Missing tests on seg-y creation factory, hence coverage complaining, I will add tomorrow! |
The method test_cast_dtype_field_little was renamed to test_cast_dtype_field. This change was made to simplify the method name and make it easier to understand its function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks perfect to me on first read.
This commit introduces thorough testing for the SegyFactory class which is used for creating SEG-Y files. It ensures that files created by the factory have correct values, and it properly handles improper inputs, raising expected exceptions.
The commit introduces SegyFactory to the SEG-Y implementation. It modifies __init__.py to import and include SegyFactory in the module. The documentation in api_reference.md is also updated to describe the new class.
The comments and function annotations in src/segy/factory.py have been enhanced to provide more details for better understanding of the class and its methods. This includes information such as function argument definitions, return values, as well as more descriptive explanations of each function's purpose and behavior.
This commit modifies the handling of the text header in the factory module. Previously, an argument 'text' was required to create a text header. With this change, if 'text' is left blank, a default textual header will be created.
The docstrings for two methods within the `factory.py` file were updated to more accurately reflect their return types. Previously, they noted a return type of `header_template`, which was changed to `ndarray`. This change provides much clearer and precise information about what is being returned by these methods.
A revision was made to correct the descriptions of the return types in the docstrings of various methods in the src/segy/factory.py file. The 'Returns' section of the docstrings for the encode_text_header, create_binary_header, create
The minimum code coverage requirement has been raised from 80% to 90% in pyproject.toml. This stringent requirement will ensure a higher level of code coverage, promoting the development of reliable and maintainable software.
No description provided.