コード例 #1
0
def run_single_file_for_multi_process(params):

    file_path, file_ind, total_file_num, t0 = params

    print('{:6.1f} min; {} / {}; {}: regenerating strf ...'.format(
        (time.time() - t0) / 60., file_ind + 1, total_file_num, file_path))

    nwb_f = nt.RecordedFile(file_path)
    lsn_name = '001_LocallySparseNoiseRetinotopicMapping'
    if dt.get_strf_grp_key(nwb_f.file_pointer) is None:
        if lsn_name in nwb_f.file_pointer['analysis/photodiode_onsets']:
            nwb_f.get_spatial_temporal_receptive_field_retinotopic_mapping(
                stim_name=lsn_name, time_window=strf_t_win, verbose=False)

    dgc_name = '003_DriftingGratingCircleRetinotopicMapping'
    if dt.get_dgcrm_grp_key(nwb_f.file_pointer) is None:
        if dgc_name in nwb_f.file_pointer['analysis/photodiode_onsets']:
            nwb_f.get_drifting_grating_response_table_retinotopic_mapping(
                stim_name=dgc_name, time_window=dgc_t_win)

    dgc_name = '001_DriftingGratingCircleRetinotopicMapping'
    if dt.get_dgcrm_grp_key(nwb_f.file_pointer) is None:
        if dgc_name in nwb_f.file_pointer['analysis/photodiode_onsets']:
            nwb_f.get_drifting_grating_response_table_retinotopic_mapping(
                stim_name=dgc_name, time_window=dgc_t_win)

    nwb_f.close()
import os
import retinotopic_mapping.DisplayLogAnalysis as dla
import corticalmapping.NwbTools as nt

curr_folder = os.path.dirname(os.path.realpath(__file__))
os.chdir(curr_folder)

nwb_fn = [f for f in os.listdir(curr_folder) if f[-4:] == '.nwb'][0]
nwb_f = nt.RecordedFile(nwb_fn)

stim_pkl_fn = [f for f in os.listdir(curr_folder) if f[-4:] == '.pkl'][0]
stim_log = dla.DisplayLogAnalyzer(stim_pkl_fn)

nwb_f.add_visual_display_log_retinotopic_mapping(stim_log=stim_log)
nwb_f.close()
コード例 #3
0
curr_folder = os.path.dirname(os.path.realpath(__file__))
os.chdir(curr_folder)

notebook_path = os.path.join(curr_folder, 'notebook.txt')
with open(notebook_path, 'r') as ff:
    notes = ff.read()

general = nt.DEFAULT_GENERAL
general['experimenter'] = experimenter
general['subject']['subject_id'] = mouse_id
general['subject']['genotype'] = genotype
general['subject']['sex'] = sex
general['subject']['age'] = age
general['optophysiology'].update({'imaging_plane_1': {}})
general['optophysiology']['imaging_plane_1'].update({'indicator': indicator})
general['optophysiology']['imaging_plane_1'].update({'imaging_rate': imaging_rate})
general['optophysiology']['imaging_plane_1'].update({'imaging_depth': imaging_depth})
general['optophysiology']['imaging_plane_1'].update({'location': imaging_location})
general['optophysiology']['imaging_plane_1'].update({'device': imaging_device})
general['optophysiology']['imaging_plane_1'].update({'excitation_lambda': imaging_excitation_lambda})
general['notes'] = notes

file_name = date_recorded + '_M' + mouse_id + '_' + sess_num + '.nwb'

rf = nt.RecordedFile(os.path.join(curr_folder, file_name), identifier=file_name[:-4], description='')
rf.add_general(general=general)
rf.close()