LKINSEY / MetaDataGUI

Fast, easy UI that allows user to transfer raw experimental data and associated metadata to AIND cloud services after experiment is run
0 stars 0 forks source link

Error creating session.json when behavior videos were not recorded #1

Closed LKINSEY closed 1 month ago

LKINSEY commented 1 month ago

issue in prepareSessionJSON when no videos are recorded:

for i,j in zip(behavior_data['reward_L'],behavior_data['scanimage_file_names']):   print(i, j)

   [4.2178] n    [4.5397] o    [8.5257]
   [4.2094] m    [4.0163] o    [4.4891] v    [7.0645] i    [6.0741] e    [5.7221]
   [6.1709] f    [] i    [] l    [9.6621] e    [5.879] s    [9.2404]
   [] f    [] o    [] u    [] n    [] d

LKINSEY commented 1 month ago

current workaround:

Im going to make a gate that says if no movie files are around, then assume all trials are good trials

if len(behavior_data['scanimage_file_names'])==20:#if == 'no movie files found'    goodtrials = np.full((1,len(behavior_data['reward_L'])), True)    hittrials = np.where((behavior_data['reward_L'])>0, True, False) else:    for r,sfn in zip(behavior_data['reward_L'],behavior_data['scanimage_file_names']):      if type(sfn) == str:          goodtrials.append(False)      else:          goodtrials.append(True)      if len(r)==0:          hittrials.append(False)      else:          hittrials.append(True)

I dont know if this is a safe assumption to make for further data processing pipeline, but it resolves the issue temporarily at least

rozmar commented 1 month ago

pls use code block with: ```

So it will be easier to read your code here

I think we are talking about 2 separate things. There are behavior videos, and 2p videos. The scanimage_file_names are the 2p videos, if there are no 2p videos, there are not trials, nothing should be analyzed.

But it seems like here there are rewards, so there has to be 2p videos, otherwise BCI doesn't work. I am a bit confused. There is nothing in this code about behavior videos.

Can you point me to the line in the code? Also, which session is this?

LKINSEY commented 1 month ago
Sure thing, will use ``` moving forward.

274-286 of the main_utility.py script

this is the prepareSessionJSON function. Actually I took a look and realized I needed to update what path I was giving this function since I updated the organization of raw data into a pophys folder

rozmar commented 1 month ago

So is this resolved? if so, pls remove this part: https://github.com/LKINSEY/MetaDataGUI/blob/90d0b9a6b348d0c39e8ea1f553fa5aa093d2a875/main_utility.py#L274

LKINSEY commented 1 month ago

fixed:


rawDataPath = f'Y:/{WRname}/{dateFileFormat}/pophys'
...
...
extract_behavior(WRname, rawDataPath, behavior_folder_staging)