コード例 #1
0
def test_brain_observatory_static_gratings_notebook(boc):
    data_set = boc.get_ophys_experiment_data(510938357)
    sg = StaticGratings(data_set)

    peak_head = sg.peak.head()
    assert peak_head['cell_specimen_id'][0] == 517399188
    assert np.isclose(peak_head['reliability_sg'][0], -0.010099250163301616)
コード例 #2
0
ファイル: session_analysis.py プロジェクト: yllyx/AllenSDK
    def session_b(self, plot_flag=False, save_flag=True):
        ns = NaturalScenes(self.nwb)
        sg = StaticGratings(self.nwb)
        nm1 = NaturalMovie(self.nwb, 'natural_movie_one', speed_tuning=True)
        SessionAnalysis._log.info("Session B analyzed")
        peak = multi_dataframe_merge(
            [nm1.peak_run, sg.peak, ns.peak, nm1.peak])
        self.append_metadata(peak)

        self.append_metrics_static_grating(self.metrics_b, sg)
        self.append_metrics_natural_scene(self.metrics_b, ns)
        self.verify_roi_lists_equal(sg.roi_id, ns.roi_id)
        self.metrics_b["roi_id"] = sg.roi_id

        if save_flag:
            self.save_session_b(sg, nm1, ns, peak)

        if plot_flag:
            cp._plot_3sb(sg, nm1, ns, self.save_dir)
            cp.plot_ns_traces(ns, self.save_dir)
            cp.plot_sg_traces(sg, self.save_dir)
コード例 #3
0
def test_harness(dataset, trigger):
    sg = StaticGratings(dataset)

    assert sg._stim_table is StimulusAnalysis._PRELOAD
    assert sg._sweeplength is StimulusAnalysis._PRELOAD
    assert sg._interlength is StimulusAnalysis._PRELOAD
    assert sg._extralength is StimulusAnalysis._PRELOAD
    assert sg._orivals is StimulusAnalysis._PRELOAD
    assert sg._sfvals is StimulusAnalysis._PRELOAD
    assert sg._phasevals is StimulusAnalysis._PRELOAD
    assert sg._number_ori is StimulusAnalysis._PRELOAD
    assert sg._number_sf is StimulusAnalysis._PRELOAD
    assert sg._number_phase is StimulusAnalysis._PRELOAD
    assert sg._sweep_response is StimulusAnalysis._PRELOAD
    assert sg._mean_sweep_response is StimulusAnalysis._PRELOAD
    assert sg._pval is StimulusAnalysis._PRELOAD
    assert sg._response is StimulusAnalysis._PRELOAD
    assert sg._peak is StimulusAnalysis._PRELOAD

    if trigger == 1:
        print(sg._stim_table)
        print(sg.sweep_response)
        print(sg.response)
        print(sg.peak)
    elif trigger == 2:
        print(sg.sweeplength)
        print(sg.mean_sweep_response)
        print(sg.response)
        print(sg.peak)
    elif trigger == 3:
        print(sg.interlength)
        print(sg.sweep_response)
        print(sg.response)
        print(sg.peak)
    elif trigger == 4:
        print(sg.extralength)
        print(sg.mean_sweep_response)
        print(sg.response)
        print(sg.peak)
    elif trigger == 5:
        print(sg.orivals)
        print(sg.sweep_response)
        print(sg.response)
        print(sg.peak)
    elif trigger == 6:
        print(sg.sfvals)
        print(sg.sweep_response)
        print(sg.response)
        print(sg.peak)
    elif trigger == 7:
        print(sg.phasevals)
        print(sg.mean_sweep_response)
        print(sg.response)
        print(sg.peak)
    elif trigger == 8:
        print(sg.number_ori)
        print(sg.mean_sweep_response)
        print(sg.response)
        print(sg.peak)
    elif trigger == 9:
        print(sg.number_sf)
        print(sg.sweep_response)
        print(sg.response)
        print(sg.peak)
    elif trigger == 10:
        print(sg.number_phase)
        print(sg.sweep_response)
        print(sg.response)
        print(sg.peak)

    assert sg._stim_table is not StimulusAnalysis._PRELOAD
    assert sg._sweeplength is not StimulusAnalysis._PRELOAD
    assert sg._interlength is not StimulusAnalysis._PRELOAD
    assert sg._extralength is not StimulusAnalysis._PRELOAD
    assert sg._orivals is not StimulusAnalysis._PRELOAD
    assert sg._sfvals is not StimulusAnalysis._PRELOAD
    assert sg._phasevals is not StimulusAnalysis._PRELOAD
    assert sg._number_ori is not StimulusAnalysis._PRELOAD
    assert sg._number_sf is not StimulusAnalysis._PRELOAD
    assert sg._number_phase is not StimulusAnalysis._PRELOAD
    assert sg._sweep_response is not StimulusAnalysis._PRELOAD
    assert sg._mean_sweep_response is not StimulusAnalysis._PRELOAD
    assert sg._pval is not StimulusAnalysis._PRELOAD
    assert sg._response is not StimulusAnalysis._PRELOAD
    assert sg._peak is not StimulusAnalysis._PRELOAD

    # check super properties
    dataset.get_corrected_fluorescence_traces.assert_called_once_with()
    assert sg._timestamps != StaticGratings._PRELOAD
    assert sg._celltraces != StaticGratings._PRELOAD
    assert sg._numbercells != StaticGratings._PRELOAD

    assert not dataset.get_roi_ids.called
    assert sg._roi_id is StaticGratings._PRELOAD

    assert dataset.get_cell_specimen_ids.called
    assert sg._cell_id is StaticGratings._PRELOAD

    assert not dataset.get_dff_traces.called
    assert sg._dfftraces is StaticGratings._PRELOAD

    assert sg._dxcm is StaticGratings._PRELOAD
    assert sg._dxtime is StaticGratings._PRELOAD