Exemplo n.º 1
0
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
Exemplo n.º 2
0
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')
Exemplo n.º 3
0
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)
Exemplo n.º 4
0
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)
Exemplo n.º 5
0
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)
Exemplo n.º 6
0
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)
Exemplo n.º 7
0
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)
Exemplo n.º 8
0
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)
Exemplo n.º 9
0
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)
Exemplo n.º 10
0
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)
Exemplo n.º 11
0
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)
Exemplo n.º 12
0
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)
Exemplo n.º 13
0
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)
Exemplo n.º 14
0
def test_get_cell_roi_table(ophys_experiment_id):
    ophys_lims_api = OphysLimsApi(ophys_experiment_id)
    assert len(ophys_lims_api.get_cell_specimen_table()) == 128
Exemplo n.º 15
0
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()
Exemplo n.º 16
0
    ophys_lims_api = OphysLimsApi(ophys_experiment_id)
    _ = ophys_lims_api.get_ophys_cell_segmentation_run_id()


@pytest.mark.requires_bamboo
@pytest.mark.parametrize('ophys_experiment_id', [
    pytest.param(511458874),
])
def test_get_cell_roi_table(ophys_experiment_id):
    ophys_lims_api = OphysLimsApi(ophys_experiment_id)
    assert len(ophys_lims_api.get_cell_specimen_table()) == 128


@pytest.mark.requires_bamboo
@pytest.mark.parametrize('ophys_lims_api, compare_val', [
    pytest.param(OphysLimsApi(511458874), 0.785203),
    pytest.param(OphysLimsApi(0), None)
])
def test_get_surface_2p_pixel_size_um(ophys_lims_api, compare_val):

    if compare_val is None:
        expected_fail = False
        try:
            ophys_lims_api.get_surface_2p_pixel_size_um()
        except OneResultExpectedError:
            expected_fail = True
        assert expected_fail is True
    else:
        assert ophys_lims_api.get_surface_2p_pixel_size_um() == compare_val