AllenInstitute / MIES

Multichannel Igor Electrophysiology Suite
https://alleninstitute.github.io/MIES/user.html
Other
21 stars 6 forks source link

Recreate user epochs for PSQ_Chirp #2083

Closed MichaelHuth closed 2 months ago

t-b commented 2 months ago

@MichaelHuth Can you check with the data we have on the FTP in folder issue-881 that the chirp epochs are recreated correctly?

MichaelHuth commented 2 months ago

There seems to be no data file with a stimset where PSQ_Chirp as used.

t-b commented 2 months ago

How have you looked? I found some in C57BL6J-628261.02.01.02.nwb.

grafik

MichaelHuth commented 2 months ago

I patched in a fallback for old data and reordered some LNB dependencies. Though, I can not test it for correctness ad the old data has no USER epochs to compare and used an old version of the analysisfunction code. With this the epoch recreation creates more epochs as there were originally present. This raises the issue that the old file has regular epochs, such that by default no epoch recreation kicks in. However, if I enforce epoch recreation manually, I get more epochs out that originally saved.

t-b commented 2 months ago

Though, I can not test it for correctness ad the old data has no USER epochs to compare and used an old version of the analysisfunction code.

I think you need to visually check that the reconstructed user epochs are correct.

This raises the issue that the old file has regular epochs, such that by default no epoch recreation kicks in. However, if I enforce epoch recreation manually, I get more epochs out that originally saved.

This should not be an issue as we want to regenerated all epochs including user epochs.

t-b commented 2 months ago

Review:

a501aa2d3 (EP: Make EP_AddUserEpoch device independent, 2024-04-11)

Jeep.

8ec12641d (Tests: Move helper function for epoch recreation testing to UTF_HelperFunctions, 2024-04-11)

Good.

7769990cb (Ana: refactor - move parts of Chirp user epoch creation to own device independent functions, 2024-04-11)

bdcb65074 (Ana: Rename totalOnsetDelay in PSQ_CR_AddSpikeEvaluationEpoch to totalOnsetDelayMS, 2024-04-11)

Nice.

e5b3b19e6 (EP: Add EpochRecreation support for User epochs from PSQ_Chirp, 2024-04-11)

added epoch recreation test to PS_CR2, PS_CR12 and PS_CR13

in the commit message does not reflect the code anymore.

EP_AddRecreatedUserEpochs_PSQ_Chirp:

CommonAnalysisFunctionChecks:

adcbf417e (EP: Add recreation support for PSQ_Chirp baseline epochs, 2024-04-17)

3288f5dd0 (Tests: Add test for checking user epochs in historic data, 2024-04-20)

+        if(strsearch(shortName, EPOCH_SHORTNAME_USER_PREFIX, 0) != 0)
+            continue
+        endif

from the naming epochChannelRecUser only holds user epochs. Maybe this should be an assert?

General comment: If you have test code which does

Function MyTEstFunction()

for(...)

  ...
  CHECK_XXX()
endfor

End

you always need an assertion before the loop that the number of loop iterations is larger than zero. Otherwise you have passing test without checking anything.

cf63db435 (Tests: Split generators in HistoricDataTests for PXP and NWB files, 2024-04-22)

Looks good!

MichaelHuth commented 2 months ago

There should be always a "Generic Function" entry available

There is not always a "Generic Function" entry available, e.g. see the early MIES experiments from historic data.

MichaelHuth commented 2 months ago

I'd also appreciate if we could move away from the loop handling here and use FindIndizes and friends

I rewrote that part, though I think its more complex and less efficient now.

t-b commented 2 months ago

Review:

I've created https://github.com/AllenInstitute/MIES/issues/2095 for the obvious FindIndizes enhancement and https://github.com/AllenInstitute/MIES/issues/2096 for DeleteWavePoint.

Rest looks good.

Edit: I think PSQ_BASELINE_CHUNK_SHORT_NAME_RE_MATCHER should then also contain the user prefix. WE can't change that anyway.

MichaelHuth commented 2 months ago

Ok I removed the generic assembly of the regex in favor of including it directly in the strings.