Skip to content
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

Merged
merged 24 commits into from
Mar 26, 2024
Merged

SEG-Y creation functionality #52

merged 24 commits into from
Mar 26, 2024

Conversation

tasansal
Copy link
Contributor

No description provided.

Altay Sansal added 4 commits March 22, 2024 20:08
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.
@tasansal tasansal added the enhancement New feature or request label Mar 23, 2024
@tasansal tasansal self-assigned this Mar 23, 2024
Copy link

codecov bot commented Mar 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.31%. Comparing base (8b44ed6) to head (4e0efab).

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.
📢 Have feedback on the report? Share it here.

Altay Sansal added 10 commits March 25, 2024 22:22
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.
@tasansal tasansal requested a review from ta-hill March 26, 2024 04:13
@tasansal
Copy link
Contributor Author

@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!

Altay Sansal added 2 commits March 25, 2024 23:29
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.
Copy link
Contributor

@ta-hill ta-hill left a 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.

Altay Sansal added 7 commits March 26, 2024 11:00
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.
@tasansal tasansal merged commit 35f2de1 into main Mar 26, 2024
32 checks passed
@tasansal tasansal deleted the segy-write branch March 26, 2024 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants