-
Notifications
You must be signed in to change notification settings - Fork 14
RecordingExtractors #171
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
Merged
Merged
RecordingExtractors #171
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: Copilot <[email protected]>
…nstead of properties.
…nstead of properties.
…s into the base_recording_extractor and removed all duplicates.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Recording Extractors Architecture
Fixes #170
Overview
This refactor replaces monolithic format detection and reading logic with a modular extractor architecture. Each data format (TDT, Doric, CSV, NPM) now has its own dedicated class implementing a common interface.
Benefits: Modularity, extensibility for new formats, consistent API, and isolated testability.
Architecture
classDiagram class BaseRecordingExtractor { <> +discover_events_and_flags()* tuple~list, list~ +read(events, outputPath)* list~dict~ +save(output_dicts, outputPath)* None #_write_hdf5(data, storename, output_path, key) None } class TdtRecordingExtractor class DoricRecordingExtractor class CsvRecordingExtractor class NpmRecordingExtractor BaseRecordingExtractor <|-- TdtRecordingExtractor BaseRecordingExtractor <|-- DoricRecordingExtractor BaseRecordingExtractor <|-- CsvRecordingExtractor CsvRecordingExtractor <|-- NpmRecordingExtractorAPI Contract
All extractors implement three methods:
discover_events_and_flags()read(*, events, outputPath)save(*, output_dicts, outputPath)Note:
discover_events_and_flags()has a flexible signature—NPM requires additionalnum_chandinputParametersarguments for channel configuration.NPM Configuration Pattern: Tkinter GUI code has been moved out of the extractor and into
saveStoresList.py. The extractor provides helper methods (has_multiple_event_ttls(),needs_ts_unit()) to determine what configuration is needed, while the GUI layer collects user input and passes it todiscover_events_and_flags()viainputParameters. This keeps the extractor free of GUI dependencies.Pipeline Integration
Step 2 (saveStoresList.py): Calls
discover_events_and_flags()to find events, presents GUI for user to create friendly name mappings → outputsstoresList.csvStep 3 (readTevTsq.py): Creates appropriate extractor, reads
storesList.csvfor event list, processes all events in parallel viaread_and_save_all_events()→ outputs HDF5 filesDoric note: Uses
storesList.csvto build the requiredevent_name_to_event_typemapping.Data Flow
flowchart TB A[Raw Data Files] --> B[Step 2: saveStoresList.py] B --> C[discover_events_and_flags] C --> D[GUI: User Maps Events] D --> E[storesList.csv] E --> F[Step 3: readTevTsq.py] A --> F F --> G[Create Extractor] G --> H[read_and_save_all_events] H --> I[HDF5 Files]