def main(): """ Usage: > python generate_qc_input.py --specimen_id SPECIMEN_ID --cell_dir CELL_DIR > python generate_qc_input.py --input_nwb_file input_nwb_file --cell_dir CELL_DIR """ args = parse_args() se_input = generate_se_input(**args) cell_dir = args['cell_dir'] if not os.path.exists(cell_dir): os.makedirs(cell_dir) lu.configure_logger(cell_dir) ju.write(os.path.join(cell_dir,'se_input.json'), se_input) se_output = run_sweep_extraction(se_input["input_nwb_file"], se_input.get("input_h5_file",None), se_input.get("stimulus_ontology_file", None)) ju.write(os.path.join(cell_dir,'se_output.json'),se_output) sp.drop_tagged_sweeps(se_output["sweep_features"]) qc_input = generate_qc_input(se_input, se_output) ju.write(os.path.join(cell_dir,'qc_input.json'), qc_input)
def generate_pipeline_input(cell_dir=None, specimen_id=None, input_nwb_file=None, plot_figures=False, qc_fig_dirname="qc_figs", qc_criteria_file=None, stimulus_ontology_file=None): se_input = generate_se_input(cell_dir, specimen_id=specimen_id, input_nwb_file=input_nwb_file) pipe_input = dict(se_input) if specimen_id: pipe_input['manual_sweep_states'] = lq.get_sweep_states(specimen_id) elif input_nwb_file: pipe_input['manual_sweep_states'] = [] if plot_figures: pipe_input['qc_fig_dir'] = os.path.join(cell_dir, qc_fig_dirname) pipe_input['output_nwb_file'] = os.path.join(cell_dir, "output.nwb") pipe_input['stimulus_ontology_file'] = stimulus_ontology_file if qc_criteria_file is not None: pipe_input['qc_criteria'] = ju.read(qc_criteria_file) else: pipe_input['qc_criteria'] = ju.read(qcp.DEFAULT_QC_CRITERIA_FILE) return pipe_input
def main(): """ Usage: > python generate_fx_input.py --specimen_id SPECIMEN_ID --cell_dir CELL_DIR > python generate_fx_input.py --input_nwb_file INPUT_NWB_FILE --cell_dir CELL_DIR """ kwargs = parse_args() se_input = generate_se_input(**kwargs) cell_dir = kwargs["cell_dir"] lu.configure_logger(cell_dir) if not os.path.exists(cell_dir): os.makedirs(cell_dir) ju.write(os.path.join(cell_dir, 'se_input.json'), se_input) se_output = run_sweep_extraction( se_input["input_nwb_file"], se_input.get("input_h5_file", None), se_input.get("stimulus_ontology_file", None)) ju.write(os.path.join(cell_dir, 'se_output.json'), se_output) sp.drop_tagged_sweeps(se_output["sweep_features"]) qc_input = generate_qc_input(se_input, se_output) ju.write(os.path.join(cell_dir, 'qc_input.json'), qc_input) qc_output = run_qc(qc_input.get("stimulus_ontology_file", None), qc_input["cell_features"], qc_input["sweep_features"], qc_input["qc_criteria"]) ju.write(os.path.join(cell_dir, 'qc_output.json'), qc_output) if kwargs["specimen_id"]: manual_sweep_states = lq.get_sweep_states(kwargs["specimen_id"]) elif kwargs["input_nwb_file"]: manual_sweep_states = [] sp.override_auto_sweep_states(manual_sweep_states, qc_output["sweep_states"]) sp.assign_sweep_states(qc_output["sweep_states"], se_output["sweep_features"]) fx_input = generate_fx_input(se_input, se_output, cell_dir, plot_figures=True) ju.write(os.path.join(cell_dir, 'fx_input.json'), fx_input)