def from_path(session_path, force=False, save=True): """ Extract a session from full ALF path (ex: '/scratch/witten/ibl_witten_01/2018-12-18/001') :param force: (False) overwrite existing files :param save: (True) boolean or list of ALF file names to extract :return: None """ logger_.info('Extracting ' + str(session_path)) extractor_type = extractors_exist(session_path) if is_extracted(session_path) and not force: logger_.info(f"Session {session_path} already extracted.") return if extractor_type == 'training': settings, data = raw.load_bpod(session_path) logger_.info('training session on ' + settings['PYBPOD_BOARD']) training_trials.extract_all(session_path, data=data, save=save) training_wheel.extract_all(session_path, bp_data=data, save=save) logger_.info('session extracted \n') # timing info in log if extractor_type == 'biased': settings, data = raw.load_bpod(session_path) logger_.info('biased session on ' + settings['PYBPOD_BOARD']) biased_trials.extract_all(session_path, data=data, save=save) biased_wheel.extract_all(session_path, bp_data=data, save=save) logger_.info('session extracted \n') # timing info in log if extractor_type == 'ephys': data = raw.load_data(session_path) ephys_trials.extract_all(session_path, data=data, save=save) ephys_fpga.extract_all(session_path, save=save)
def from_path(session_path, force=False, save=True): """ Extract a session from full ALF path (ex: '/scratch/witten/ibl_witten_01/2018-12-18/001') :param force: (False) overwrite existing files :param save: (True) boolean or list of ALF file names to extract :return: None """ extractor_type = get_session_extractor_type(session_path) logger_.info(f"Extracting {session_path} as {extractor_type}") if is_extracted(session_path) and not force: logger_.info(f"Session {session_path} already extracted.") return if extractor_type == 'training': settings, data = rawio.load_bpod(session_path) logger_.info('training session on ' + settings['PYBPOD_BOARD']) training_trials.extract_all(session_path, data=data, save=save) training_wheel.extract_all(session_path, bp_data=data, save=save) logger_.info('session extracted \n') # timing info in log if extractor_type == 'biased': settings, data = rawio.load_bpod(session_path) logger_.info('biased session on ' + settings['PYBPOD_BOARD']) biased_trials.extract_all(session_path, data=data, save=save) biased_wheel.extract_all(session_path, bp_data=data, save=save) logger_.info('session extracted \n') # timing info in log if extractor_type == 'ephys': data = rawio.load_data(session_path) logger_.info('extract BPOD for ephys session') ephys_trials.extract_all(session_path, data=data, save=save) logger_.info('extract FPGA information for ephys session') tmax = data[-1]['behavior_data']['States timestamps']['exit_state'][0][-1] + 60 ephys_fpga.extract_all(session_path, save=save, tmax=tmax) if extractor_type == 'sync_ephys': ephys_fpga.extract_sync(session_path, save=save)