Auerbach-Lab/Behavior-autoanalysis

BBN/Tone with multiple durations - desired data not displayed

Closed this issue · 9 comments

Issue:
100 ms files now that we are increasing duration following hearing loss are not showing up because everything is limited to min_duration.

Attempts to change to min_duration to today's min cause breaking on rats in training.

Sorry for the bad/unclear bug report.

Issues

Supervisor summarise only lists lines/days with the minimum duration ever seen for files with the same task and detail.

This means that ⚠️the current day's run is being omitted from the summary⚠️ in addition to lacking other desired lines/dates in the table.

Expected Behavior

  • The current day's actual run is always included in the in the displayed/included runs in the supervisor table for a rat.
  • In the case that today's run is a single duration file, only files that include today's duration are displayed.
  • In the case that today's run is a multiple duration file, treat it as if it only contained the single, minimum duration that appears in the file.

In this case, that means that for BBN & tone, the duration will (right now) be mostly filled with pre-HL results of the same duration, rather than the current table of only minimum-duration runs.

Expected cause

Expected cause of the behavior (i.e. watch out for introducing issues when patching): On 'BBN Mixed' files that have a variable window of 50-300ms within a block, we only currently display the smallest window. In an effort to get correct behavior for BBN Mixed files, we incorrectly filter many other types to only min_duration as well.

Background

Post hearing loss, we start at 50ms and increase up to 100 then 300ms durations for testing temporal integration. This means that if we increase the time window, those files are filtered out of being included in the trials included in the supervisor summary.

Steps to reproduce

run_archive.zip
Using admin tools > supervisor-summarize-custom.R select the Blue rats to summarize set filter(str_detect(Rat_name, "Blue"))
Once the xlsx file builds and opens, the most recent run data included will be on 20230807 with a file name of BBN_20-80dB_50ms_4s. No data for 20230808 or 20230809 will be shown both of which are in the run_archive with file names of BBN_20-80dB_100ms_4s (task = Training, detail = Alone).
You can verify these runs are in the database:
run_archive %>% filter(rat_name %in% c("Blue1")) %>% unnest_wider(assignment) %>% unnest_wider(stats) %>% mutate(hit_percent = hit_percent * 100, FA_percent = FA_percent * 100) %>% select(date, rat_name, weight, trial_count, hit_percent, FA_percent, file_name, experiment, phase, task, detail) %>% arrange(desc(date))

tofof commented

Zip inadequate for reproduction; no blue rats appear at all while running supervisor summarize, and only 12 rats are listed overall. I assume this is either a rat_archive issue or an issue with missing the needed entries in the correct experiment's Rdata archive.

rat_archive.zip
Will also be necessary to reproduce. This should be sufficient with the validation commented out (line 1043)

tofof commented

Expected cause of the behavior (i.e. watch out for introducing issues when patching): On 'mixed' files that have a variable window of 50-300ms within a block, we only want to display the smallest window.

  • By 'mixed' you mean BBN/Tones with detail Mixed, right?
  • Do you have an example of such a run (rat & date) to verify I don't break this behavior?

I'll prune run_archive of runs coming after that file (for that rat) so that it's the 'today' run as far as sup-sum is concerned.

For single window files (i.e. only one duration for all stimuli across all blocks) we want to limit the summary table (r) to files matching the current duration.
Ideally the table, in the case of BBN or tone files, would be restricted to only files with the same time window.

  • What precisely do you mean by time window? That's not a term that appears anywhere that I know of. Only one number is ever in the Dur (ms) column by the point that the entries to include are being pruned.
    • Define 'single window file' in terms of something I can actually filter from run_archive, if possible
    • Define 'same time window' similarly.

By 'mixed' you mean BBN/Tones with detail Mixed, right?

Yes, I meant BBN files which have the detail Mixed. Note that tone mixed is different as that is multiple frequencies not durations. They should have names like "BBN_20-80dB_50-300ms_8s" where the 50-300ms encodes that there are multiple stimuli durations. They will be analysis_type "BBN Mixed Duration". The files have a block size of 30 instead of 10.

Do you have an example of such a run (rat & date) to verify I don't break this behavior?

For examples in run_archive see Green11 on:

  • Mixed Duration 12/10/2022 run_archive %>% filter(rat_name %in% c("Green11") & date == 20221210)
  • Single Duration 12/16/2022 run_archive %>% filter(rat_name %in% c("Green11") & date == 20221216)

What precisely do you mean by time window? That's not a term that appears anywhere that I know of. Only one number is ever in the Dur (ms) column by the point that the entries to include are being pruned.

By time window I was referring to duration. I believe duration in the sup-sum is derived from the summary column of the run_archive. In run_archive, the summary column contains a tibble with the duration column (run_archive %>% filter(rat_name %in% c("Green11") & date == 20221216) %>% .$summary %>% .[[1]] %>% .$duration), which can have a single value (300) in the case of Single Duration files (see Green 11, 12/16/2022) or for Mixed Duration files, such as Green11 on 12/10/2022, it has 3 values (50, 100, 300).

Currently Reaction Time (Rxn) is stored by Duration (Dur (ms)), Frequency (Freq (kHz)) and intensity (Inten (dB)). In this case, the Frequency is the same for all the trials so irrelevant. You will need to select the duration in multiple locations due to separate code blocks for selecting reaction time at different intensities. However, in all these code blocks, we are filtering for duration.

Location in of desired rxn number in run_archive is within the stats tibble in the reaction tibble.
run_archive %>% filter(rat_name %in% c("Green11") & date == 20221210) %>% unnest_wider(stats) %>% .$reaction

tofof commented

Is BBN-TH-Mixed a valid combination? There is no way for me to deduce this from the experiment csv.

If so, it's more complicated - altering line 576 means you no longer have the 'use the minimum' behaivor for those files.

tofof commented

Closed by bb191af