# if the directory animal name_date does not yet exist, create it catGT_dest = os.path.join(catGT_dest_parent, session_id) if not os.path.exists(catGT_dest): os.mkdir(catGT_dest) # probe list == probe label list for 3A prb_list = spec[4] # inputs for tPrime fromStream_list = list() # build path to the first probe folder; look into that folder # to determine the range of trials if the user specified t limits as # start and end runFolder = os.path.join(npx_directory, prb_list[0], spec[0], spec[1]) first_trig, last_trig = SpikeGLX_utils.ParseTrigStr( spec[3], '', spec[2], runFolder) trigger_str = repr(first_trig) + ',' + repr(last_trig) # loop over all probes in hte run to build json files of input parameters # initalize lists for input and output json files catGT_input_json = [] catGT_output_json = [] module_input_json = [] module_output_json = [] session_id = [] data_directory = [] # first loop over probes creates json files containing parameters for # both preprocessing (CatGt) and sorting + postprocessing for i, prb in enumerate(prb_list):
for spec in run_specs: session_id = spec[0] # Run CatGT input_json = os.path.join(json_directory, session_id + '-input.json') output_json = os.path.join(json_directory, session_id + '-output.json') # Make list of probes from the probe string prb_list = SpikeGLX_utils.ParseProbeStr(spec[3]) # build path to the first probe folder run_folder_name = spec[0] + '_g' + spec[1] prb0_fld_name = run_folder_name + '_imec' + prb_list[0] prb0_fld = os.path.join(npx_directory, run_folder_name, prb0_fld_name) first_trig, last_trig = SpikeGLX_utils.ParseTrigStr(spec[2], prb0_fld) trigger_str = repr(first_trig) + ',' + repr(last_trig) print('Creating json file for preprocessing') info = createInputJson(input_json, npx_directory=npx_directory, continuous_file=None, spikeGLX_data='True', kilosort_output_directory=catGT_dest, catGT_run_name=session_id, gate_string=spec[1], trigger_string=trigger_str, probe_string=spec[3], catGT_stream_string=catGT_stream_string, catGT_cmd_string=catGT_cmd_string, extracted_data_directory=catGT_dest)