Auerbach-Lab/Behavior-autoanalysis

New training plan causes issue in Check_Delay

Opened this issue · 0 comments

Issue

New training plan files produce "wrong delay window" warnings when they are not wrong.

Details

Delay under the new training plan violates the previous assumptions that were built into the naming scheme. Previously, we initially trained extended time before tone then added catch. However, some rats developed a habit of pulling their noses early or repeatedly during the wait period as they did not receive any feedback against this other than trials taking slightly longer. The new training plan introduces catch trials and then focuses on extending the wait time before the tone.

Check_Delay functioned under the previously true assumption that all non-standard delay windows had no catches, and so no check on delay was done for those files. This assumption is no longer true and it would be better to have checks that the delay matches the assignment.

The natural place to get the expected delay would be from the Assigned Filename. However, in the current system, this is a separate function not accessible during Build_Filename. I have added a hacky work-around (only to Training - Tone though Training - BBN will eventually also be effected) in the form of a hard-coded check to rat_archive for the assignment. However, this fails when loading back data or deleted entries as these assignments aren't coming from rat_archive.

assigned_file = filter(rat_archive, Rat_ID == run_properties$rat_ID)$Assigned_Filename

Replication

Delete Purple4 entry on 3/7/24 from run archive.
Ensure that the current assignment in rat_archive is blank for Purple4.
Then use admin tools/import_deleted_entries.R to reload. You will get warning for delay window.

Possible Solutions

  1. Fold Check_Assigned_Filename into Build_Filename so that its accessible.
  2. Load the assigned file (i.e. extract it from Check_Assigned_Filename) before either Build_Filename or Check_Assigned_Filename
  3. New system may obsolete this issue