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

Non-standard headers loading #6

Merged
merged 29 commits into from
Feb 20, 2024
Merged

Non-standard headers loading #6

merged 29 commits into from
Feb 20, 2024

Conversation

AlexeyKozhevin
Copy link
Member

@AlexeyKozhevin AlexeyKozhevin commented Jan 25, 2024

  • Now load_headers loads non-standard header by its start byte position and dtype.
  • dtype can be float (e.g. '>f4')
  • Add TraceHeaderSpec class

Example:

file.load_headers(['INLINE_3D', ('CROSSLINE_3D', 17), {'name': 'another_strange_header', 'start_byte': 69, 'dtype': '>f4'}])

segfast/memmap_loader.py Outdated Show resolved Hide resolved
segfast/utils.py Outdated Show resolved Hide resolved
segfast/utils.py Outdated Show resolved Hide resolved
segfast/utils.py Outdated Show resolved Hide resolved
segfast/utils.py Outdated Show resolved Hide resolved
segfast/utils.py Outdated Show resolved Hide resolved
segfast/utils.py Outdated Show resolved Hide resolved
segfast/utils.py Outdated Show resolved Hide resolved
segfast/utils.py Outdated Show resolved Hide resolved
segfast/utils.py Outdated Show resolved Hide resolved
segfast/segyio_loader.py Outdated Show resolved Hide resolved
segfast/segyio_loader.py Outdated Show resolved Hide resolved
segfast/segyio_loader.py Outdated Show resolved Hide resolved
segfast/memmap_loader.py Outdated Show resolved Hide resolved
segfast/memmap_loader.py Show resolved Hide resolved
segfast/utils.py Outdated Show resolved Hide resolved
segfast/utils.py Outdated Show resolved Hide resolved
segfast/utils.py Outdated Show resolved Hide resolved
segfast/utils.py Outdated Show resolved Hide resolved
segfast/utils.py Outdated Show resolved Hide resolved
segfast/memmap_loader.py Outdated Show resolved Hide resolved
segfast/memmap_loader.py Outdated Show resolved Hide resolved
segfast/memmap_loader.py Outdated Show resolved Hide resolved
segfast/segyio_loader.py Outdated Show resolved Hide resolved
segfast/segyio_loader.py Outdated Show resolved Hide resolved
AlexeyKozhevin and others added 7 commits February 9, 2024 16:07
Co-authored-by: Alexander Kuvaev <[email protected]>
Co-authored-by: Alexander Kuvaev <[email protected]>
Co-authored-by: Alexander Kuvaev <[email protected]>
Co-authored-by: Alexander Kuvaev <[email protected]>
Co-authored-by: Alexander Kuvaev <[email protected]>
Co-authored-by: Alexander Kuvaev <[email protected]>
@AlexeyKozhevin AlexeyKozhevin changed the title Add TraceHeader Non-standard headers loading Feb 9, 2024
segfast/utils.py Outdated Show resolved Hide resolved
segfast/utils.py Outdated Show resolved Hide resolved
AlexeyKozhevin and others added 2 commits February 10, 2024 20:14
Co-authored-by: Alexander Kuvaev <[email protected]>
Co-authored-by: Alexander Kuvaev <[email protected]>
segfast/utils.py Outdated Show resolved Hide resolved
segfast/utils.py Outdated Show resolved Hide resolved
segfast/utils.py Outdated Show resolved Hide resolved
segfast/utils.py Outdated Show resolved Hide resolved
segfast/utils.py Outdated Show resolved Hide resolved
@@ -5,7 +5,7 @@


def Loader(path, engine='memmap', endian='big', strict=False, ignore_geometry=True):
""" !!. """
""" SEG-Y loader. """

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Selector class for loading SEG-Y with either segyio-based loader or memmap-based one.
Make class references links, so they would be cool (and useful) in the doc

Copy link
Member Author

@AlexeyKozhevin AlexeyKozhevin Feb 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be the next PR (see docs branch here https://github.com/AlexeyKozhevin/segfast/tree/docs)

segfast/memmap_loader.py Outdated Show resolved Hide resolved
segfast/memmap_loader.py Outdated Show resolved Hide resolved
segfast/memmap_loader.py Outdated Show resolved Hide resolved
Comment on lines +230 to +231
elif unused_len < 0:
raise ValueError(f'{header.name} header overlap')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, does not violates anything (the loading of overlapping headers should still work just fine), but we probably don't want to even give the option

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to make overlaped headers, we will have to rewrite all the part with 'unused_*' in dtype. I don't see any reasons to do it.

segfast/segyio_loader.py Outdated Show resolved Hide resolved
segfast/utils.py Outdated Show resolved Hide resolved
segfast/utils.py Outdated
@@ -35,6 +37,112 @@ def update(self, n=1):
notifier = Notifier


class TraceHeaderSpec:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, add to_tuple / to_dict method: motivation is to keep track of actually used headers in, for example, Geometry class of seismiqb.

In the same vain, I would think about returning list of TraceHeaderSpec instances out of Loader.load_headers methods, so that you have a detailed info on what was actually loaded.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a make_headers_specs method

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The returned specs may differ from those returned by make_headers_specs, I'll add such an option in my PR later today

@AlexeyKozhevin AlexeyKozhevin merged commit 74220ee into main Feb 20, 2024
13 checks passed
@AlexeyKozhevin AlexeyKozhevin deleted the headers branch February 20, 2024 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants