def test_get_age(ophys_lims_experiment_id, compare_val): ophys_lims_api = OphysLimsApi(ophys_lims_experiment_id) if compare_val is None: expected_fail = False try: ophys_lims_api.get_age() except OneResultExpectedError: expected_fail = True assert expected_fail is True else: assert ophys_lims_api.get_age() == compare_val
def validate_ophys_dff_length(ophys_experiment_id, api=None): api = OphysLimsApi() if api is None else api ophys_experiment_dir = api.get_ophys_experiment_dir(ophys_experiment_id) raw_filepath = os.path.join(ophys_experiment_dir, str(ophys_experiment_id)+'.h5') raw_data_shape = get_raw_ophys_file_shape(raw_filepath) dff_filepath = api.get_dff_file(ophys_experiment_id=ophys_experiment_id) dff_shape = get_raw_ophys_file_shape(dff_filepath) if raw_data_shape[0] != dff_shape[1]: raise ValidationError('dff length does not match raw data length')
def test_get_rigid_motion_transform_file(ophys_experiment_id, api_data): ophys_lims_api = OphysLimsApi(ophys_experiment_id) f = ophys_lims_api.get_rigid_motion_transform_file key = 'rigid_motion_transform_file' if ophys_experiment_id in api_data: assert f() == api_data[ophys_experiment_id][key] else: expected_fail(f)
def test_average_intensity_projection_image(ophys_experiment_id, api_data): ophys_lims_api = OphysLimsApi(ophys_experiment_id) f = ophys_lims_api.get_average_intensity_projection_image_file key = 'avgint_a1X_file' if ophys_experiment_id in api_data: assert f() == api_data[ophys_experiment_id][key] else: expected_fail(f)
def test_get_maxint_file(ophys_experiment_id, api_data): ophys_lims_api = OphysLimsApi(ophys_experiment_id) f = ophys_lims_api.get_max_projection_file key = 'maxint_file' if ophys_experiment_id in api_data: assert f() == api_data[ophys_experiment_id][key] else: expected_fail(f)
def test_get_ophys_experiment_dir(ophys_experiment_id, api_data): ophys_lims_api = OphysLimsApi(ophys_experiment_id) f = ophys_lims_api.get_ophys_experiment_dir key = 'ophys_dir' if ophys_experiment_id in api_data: assert f() == os.path.normpath(api_data[ophys_experiment_id][key]) else: expected_fail(f)
def test_get_full_genotype(ophys_experiment_id, api_data): ophys_lims_api = OphysLimsApi(ophys_experiment_id) f = ophys_lims_api.get_full_genotype key = 'full_genotype' if ophys_experiment_id in api_data: assert f() == api_data[ophys_experiment_id][key] else: expected_fail(f)
def test_get_workflow_state(ophys_experiment_id, api_data): ophys_lims_api = OphysLimsApi(ophys_experiment_id) f = ophys_lims_api.get_workflow_state key = 'workflow_state' if ophys_experiment_id in api_data: assert f() == api_data[ophys_experiment_id][key] else: expected_fail(f)
def test_get_LabTracks_ID(ophys_experiment_id, api_data): ophys_lims_api = OphysLimsApi(ophys_experiment_id) f = ophys_lims_api.get_external_specimen_name key = 'LabTracks_ID' if ophys_experiment_id in api_data: assert f() == api_data[ophys_experiment_id][key] else: expected_fail(f)
def test_get_driver_line(ophys_experiment_id, api_data): ophys_lims_api = OphysLimsApi(ophys_experiment_id) f = ophys_lims_api.get_driver_line key = 'driver_line' if ophys_experiment_id in api_data: assert f() == api_data[ophys_experiment_id][key] else: expected_fail(f)
def test_get_stimulus_name(ophys_experiment_id, api_data): ophys_lims_api = OphysLimsApi(ophys_experiment_id) f = ophys_lims_api.get_stimulus_name key = 'stimulus_name' if ophys_experiment_id in api_data: assert f() == api_data[ophys_experiment_id][key] else: expected_fail(f)
def test_get_imaging_depth(ophys_experiment_id, api_data): ophys_lims_api = OphysLimsApi(ophys_experiment_id) f = ophys_lims_api.get_imaging_depth key = 'imaging_depth' if ophys_experiment_id in api_data: assert f() == api_data[ophys_experiment_id][key] else: expected_fail(f)
def test_get_targeted_structure(ophys_experiment_id, api_data): ophys_lims_api = OphysLimsApi(ophys_experiment_id) f = ophys_lims_api.get_targeted_structure key = 'targeted_structure' if ophys_experiment_id in api_data: assert f() == api_data[ophys_experiment_id][key] else: expected_fail(f)
def test_get_ophys_segmentation_run_id(ophys_experiment_id): ophys_lims_api = OphysLimsApi(ophys_experiment_id) _ = ophys_lims_api.get_ophys_cell_segmentation_run_id()