-
Notifications
You must be signed in to change notification settings - Fork 9
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
Implement interactive selector of trace headers specs #12
base: main
Are you sure you want to change the base?
Conversation
self.file_n_traces = self.loader.n_traces | ||
self.n_traces = min(n_traces, self.file_n_traces) | ||
|
||
self.dtype_str_to_np = { |
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.
Why not a class attribute?
Anchor for resolving the package name. Used only for relative imports. | ||
attribute : str, optional | ||
Name of attribute to get from loaded module. | ||
help : str, optional |
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.
Add a use-case as an example
|
||
WIDGET_HEIGHT = "30px" | ||
BUTTON_WIDTH = "35px" | ||
title_layout = widgets.Layout(height=WIDGET_HEIGHT, width="auto", flex="1 1 auto") |
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.
What do you think about put all layout kwargs to some default config to have an ability to change them?
TEXT_HEADER_LINE_LENGTH = 80 | ||
text_header_list = [] | ||
for text_header in self.loader.text: | ||
text_header = text_header.decode(errors="replace") |
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.
Do we really can use system encoding?
This PR adds a number of utils to perform interactive selection and validation of trace header specs:
TraceHeaderSpecSelector
- a base class that defines a widget which allows specifying custom start bytes, dtypes and endiannesses of trace headers and displays loaded values for a subset of traces. It also prints textual headers of the file since they usually contain information about headers' locations.select_pre_stack_header_specs
andselect_post_stack_header_specs
- thin wrappers aroundTraceHeaderSpecSelector
with predefined sets of headers to validate for pre-stack and post-stack SEG-Y files respectively.The resulting header specs can be accessed via
headers
attribute of the returned object:Other changes:
extras_require
block insetup.py
with optional interactive dependenciesDelayedImport
frombatchflow
next to as well copy-pastedForPoolExecutor
😢TraceHeaderSpec.is_standard
check