def test_trial_response_window_bounds_reward(ophys_experiment_id):

    api = BehaviorOphysLimsApi(ophys_experiment_id)
    session = BehaviorOphysSession(api)
    response_window = session.task_parameters['response_window_sec']
    for _, row in session.trials.iterrows():

        lick_times = [(t - row.change_time) for t in row.lick_times]
        if not np.isnan(row.reward_time):

            # monitor delay is incorporated into the trials table change time
            # TODO: where is this set in the session object?
            camstim_change_time = row.change_time - 0.0351  

            reward_time = (row.reward_time - camstim_change_time)
            assert response_window[0] < reward_time + 1/60
            assert reward_time < response_window[1] + 1/60
            if len(session.licks) > 0:
                assert lick_times[0] < reward_time
Exemplo n.º 2
0
 def from_lims(cls, ophys_experiment_id: int) -> "BehaviorOphysSession":
     return cls(api=BehaviorOphysLimsApi(ophys_experiment_id))
def test_get_nwb_filepath(ophys_experiment_id):

    api = BehaviorOphysLimsApi(ophys_experiment_id)
    assert api.get_nwb_filepath(
    ) == '/allen/programs/braintv/production/visualbehavior/prod0/specimen_823826986/ophys_session_859701393/ophys_experiment_860030092/behavior_ophys_session_860030092.nwb'
Exemplo n.º 4
0
    if verbose:
        print('last flash ended at {}'.format(last_flash_end))
        print('another flash should have started by {}'.format(
            next_flash_would_have_started))
        print('last trial ended at {}'.format(last_trial_end))

    if not last_flash_start <= last_trial_end <= next_flash_would_have_started:
        raise ValidationError(
            'The last trial does not end between the start of the last flash and the expected start time of the next flash'
        )


if __name__ == "__main__":

    api = BehaviorOphysLimsApi()
    ophys_experiment_id_list = [
        775614751, 778644591, 787461073, 782675436, 783928214, 783927872,
        787501821, 787498309, 788490510, 788488596, 788489531, 789359614,
        790149413, 790709081, 791119849, 791453282, 791980891, 792813858,
        792812544, 792816531, 792815735, 794381992, 794378505, 795076128,
        795073741, 795952471, 795952488, 795953296, 795948257, 796106850,
        796106321, 796108483, 796105823, 796308505, 797255551, 795075034,
        798403387, 798404219, 799366517, 799368904, 799368262, 803736273,
        805100431, 805784331, 805784313, 806456687, 806455766, 806989729,
        807753318, 807752719, 807753334, 807753920, 796105304, 784482326,
        779335436, 782675457, 791974731, 791979236, 800034837, 802649986,
        806990245, 808621958, 808619526, 808619543, 808621034, 808621015
    ]

    for ophys_experiment_id in ophys_experiment_id_list:
Exemplo n.º 5
0
 def setup_class(cls):
     cls.bd = BehaviorDataLimsApi(976012750)
     cls.od = BehaviorOphysLimsApi(976255949)
Exemplo n.º 6
0
 def from_lims(cls, ophys_experiment_id):
     return cls(api=BehaviorOphysLimsApi(ophys_experiment_id))
Exemplo n.º 7
0
def test_process_ophys_plane_timestamps(timestamps, plane_group, group_count,
                                        expected):
    actual = BehaviorOphysLimsApi._process_ophys_plane_timestamps(
        timestamps, plane_group, group_count)
    np.testing.assert_array_equal(expected, actual)