コード例 #1
0
ファイル: test_file.py プロジェクト: vrhaynes/pynwb
 def test_get_neurodata_type(self):
     ts1 = TimeSeries('test_ts1', [0, 1, 2, 3, 4, 5], 'grams', timestamps=[0.0, 0.1, 0.2, 0.3, 0.4, 0.5])
     ts2 = TimeSeries('test_ts2', [0, 1, 2, 3, 4, 5], 'grams', timestamps=[0.0, 0.1, 0.2, 0.3, 0.4, 0.5])
     self.nwbfile.add_acquisition(ts1)
     self.nwbfile.add_acquisition(ts2)
     p1 = ts1.get_ancestor(neurodata_type='NWBFile')
     self.assertIs(p1, self.nwbfile)
     p2 = ts2.get_ancestor(neurodata_type='NWBFile')
     self.assertIs(p2, self.nwbfile)
コード例 #2
0
def align_by_trials(
    timeseries: TimeSeries,
    start_label="start_time",
    before=0.0,
    after=1.0,
):
    """
    Args:
        timeseries: TimeSeries
        start_label: str
            default: 'start_time'
        before: float
            time after start_label in secs (positive goes back in time)
        after: float
            time after stop_label in secs (positive goes forward in time)
    Returns:
        np.array(shape=(n_trials, n_time, ...))
    """
    trials = timeseries.get_ancestor("NWBFile").trials
    return align_by_time_intervals(timeseries, trials, start_label, before,
                                   after)