-
Notifications
You must be signed in to change notification settings - Fork 9
Insert recreated epoch info on massexport #2385
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
base: main
Are you sure you want to change the base?
Conversation
466c735
to
0730cc5
Compare
@t-b This PR now always recreates the epochs, whereas the issue states epochs should only be recreated if we do not have any epoch data. However, we recently changed the epoch (re)creation to be sample exact. With the upper approach we would get a mix of old non-sample exact epochs and "new" sample exact recreated epochs possibly on exported older files. If that mixing is ok, I add the check to only recreate if there is no epoch info already. |
I think we want to regenerate if the epoch info is not-present or out-of-date (SWEEP_EPOCH_VERSION). |
Not a review just some drive-by-comments:
|
ea500ef
to
e848afb
Compare
e848afb
to
aec4e43
Compare
I've reapplied the ipt formatting and linting changes. But don't know howto fix the merge conflict. |
@t-b Look slike the double key check for LBN entry adds actually found a case. Probable fallout: The copying in ED_createWaveNotes runs the indexing upwards, such that the last value written to the LBN is read from source index 38. Thus, there should be no side effects. |
aec4e43
to
52abcfc
Compare
Does that also resolve the #881? Review: 59c47e7 (DAP: Change comment getter for user comment to retrieve string directly from control, 2025-04-02) Jeep. 5c982a3 (LBN: Do labnotebook upgrade on most common MIES entry points, 2025-04-02)
970d2ab (bugfix: Handle missing result waves gracefully in Logbookviewer, 2025-04-02)
6e1855b (ED: Factor out LNB row initialization to ED_InitNewRow, 2025-04-02) Looks good. 4f01504 (ED: Remove unused variable in ED_FindIndizesAndRedimension, 2025-04-03) Nice find. Hopefully a future IPT version can help us here as well. 6801110 (ED: Add check against duplicated keys in ED_CheckValuesAndKeys, 2025-04-03) I'm trying to come up with a faster way, but fail to see one.
The reason I think the one column check is relevant is that all analysis function LBN values are added via dace787 (Bugfix: SweepSettings Key wave had duplicate key "Sampling Interval Multiplier", 2025-04-07) Nice. d5e9e9d (CA: Refactor cache key generation for LB row and index cahce to own functions, 2025-04-04)
Otherwise nice refactoring. 403130a (AFH: Add function to get headstage from channelType/channelNumber, 2025-04-02)
d67d5b0 (ED: Add feature to ED_AddEntriesToLabnotebook for value insertion, 2025-04-02)
3e42a4f (NWB: Insert recreated epoch data into LNB on NWB_ExportAllData, 2025-04-02)
cb88330 (Tests: Always attempt to recreate Epochs in TestExportingDataToNWB, 2025-04-03)
52abcfc (LBN: Fix typos in description of labnotebook entries, 2025-04-04) Nice! |
@MichaelHuth Did you see my review in #2385 (comment)? |
I dropped in favor of a LBN based utility function based on the approach used in DataConfigurationRecreation. |
I noticed that, but I did not evaluate this as bug. The only thing that the call to ED_FindIndizesAndRedimension does when called is to increase the row size of the wave by 1, but not the NOTE_INDEX. (The possible column increase is as regular). The NOTE_INDEX is updated by the caller in any case. I think ED_FindIndizesAndRedimension should be split in two parts, one that increases the COLS and another that increases the ROWS. For the insertion I only need the COLS increase as I use another function to add a row. I am open to move the NOTE_INDEX adjustment before the row value update. |
|
dc23435
to
b9db13e
Compare
f782384
to
4716f22
Compare
fba217f
to
a76e718
Compare
a76e718
to
9b7f93e
Compare
Fixed conflicts. |
6dab79c
to
cb84055
Compare
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.
Pull Request Overview
This PR implements functionality to insert recreated epoch information during mass export of NWB data. The primary purpose is to ensure epoch information is available in exported NWB files even when the original data lacks complete epoch information.
Key changes:
- Added a new
recreateEpochs
parameter toNWB_ExportAllData()
function - Enhanced the labnotebook system to support post-processing entries with dedicated "PostProcessed" tracking
- Implemented epoch recreation logic that inserts missing epoch information into the labnotebook before export
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 8 comments.
Show a summary per file
File | Description |
---|---|
UTF_DataGenerators.ipf | Added test data generators for post-processing functionality |
UTF_AttemptNWB2ExportOnOldData.ipf | Updated test to enable epoch recreation during export |
UTF_Labnotebook.ipf | Added comprehensive tests for post-processing entry insertion |
labnotebook_textual_description.itx | Added "PostProcessed" entry description and fixed spelling errors |
labnotebook_numerical_description.itx | Added "PostProcessed" entry description and fixed spelling errors |
MIES_WaveDataFolderGetters.ipf | Made upgrade function public and refactored cache key generation |
MIES_NeuroDataWithoutBorders.ipf | Added epoch recreation logic to export workflow |
MIES_MiesUtilities_Logbook.ipf | Added epoch recreation and cache invalidation functions |
MIES_LogbookViewer.ipf | Added null check for robustness |
MIES_ExperimentDocumentation.ipf | Enhanced labnotebook entry system to support post-processing |
MIES_Epochs.ipf | Made epoch recreation function public |
MIES_DataBrowser.ipf | Simplified labnotebook upgrade call |
MIES_DAEphys.ipf | Simplified labnotebook upgrade and fixed function call |
MIES_Constants.ipf | Added constant for post-processing entry key |
MIES_Cache.ipf | Added cache key generator functions |
MIES_AnalysisFunctionHelpers.ipf | Added helper function for channel-to-headstage mapping |
cb84055
to
1bd4e08
Compare
Recovered from borked-up conflict resolution. |
…s-recreated-epoch-prep Prep for export recreated epoch info in #2385
5ab768b
to
361bdb2
Compare
When loading experiments, possibly old experiments the data structures might be present in an old version. These need to be upgraded before used by the current code. The points where the LBN wave is upgraded are: - opening the Data Browser - Locking a device in the DAEphys panel - NWB Export At these locations the LBN upgrade for values and keys waves were added through the common function UpgradeLabNotebook.
The LBN Upgrade location was moved in the DB code from DB_UpdateSweepPlot to the device locking in DB_LockToDevice. This reduces overhead because the upgrade is not attempted on each plot update.
ED_AddEntriesToLabnotebook and further down functions were extended to add the feature that a given value is inserted into the LNB at the end of the sweepNumber/entrySourceType block. This row is also marked as postprocessed data. The row and index cache is invalidated when a row was inserted. Added tests for insertion in numerical and textual LNB. Raise LABNOTEBOOK_VERSION to 82
- Added capability SupportsEntrySourceType - Added function to determine that support - Added function to get a LBN capability This should improve performance because capabilities stay constant through the lifetime of the LBN. Raise LBN version to 83 Raise Results wave version to 4 The information about the EntrySourceType support is required for LBN row insertion. The insertion is done for a specific EntrySourceType at the end of the block defined by sweepNumber/EntrySourceType in the LBN. However, old LBNs do not feature the EntrySourceType column. In the LBN wave upgrade process this column is created but keeps the initialization values of NaN for UNKNOWN_MODE. Now if a row is inserted, we have to insert it with the same sweepNumber/EntrySourceType combination as the block for which FindRange determined the start/end row index. FindRange has a fallback for the old LBN properties. If we would blindly write the given EntrySourceType (which is typically not UNKNOWN_MODE) on insertion in such an old LBN, effectively a different sweepNumber/EntrySourceType combination is created that is then an own block. This new block makes the fallback of FindRange fail to determine the "old" LBN entries boundaries, making them non-retrievable. As the determination of EntrySourceType support is expensive and a static property of the LBN, it can be done in the LBN upgrade process and saved in the wavenote (of the LBN key wave).
- Epochs for DA channels get recreated. - Epoch recreation is an optional argument for NWB_ExportAllData and is by default off. - The location where the LNB is written to the NWB file through NWB_WriteLabnotebooksAndComments was moved to a spot after the LNB was adapted. Added tests for postProcessed epoch addition for vintage files.
…port TTL epochs are now also inserted into the LBN.
361bdb2
to
00b5d10
Compare
close #2076
close #881
Close #2009