Beispiel #1
0
def test_cosine_init(path_to_axona_data):
    T = AxonaTrial(path_to_axona_data)
    T.load()
    C = CosineDirectionalTuning(T.TETRODE[1].spk_ts, T.xyTS, T.TETRODE[1].cut,
                                T.xy[0, :], T.xy[1, :])
    C.getPosIndices()
    clust_pos_indices = C.getClusterPosIndices(1)
    assert (isinstance(clust_pos_indices, np.ndarray))
    ts = C.getClusterSpikeTimes(1)
    assert (isinstance(ts, np.ndarray))
    dbs = C.getDirectionalBinPerPosition(6)
    assert (isinstance(dbs, np.ndarray))
    dbs = C.getDirectionalBinForCluster(1)
    assert (isinstance(dbs, np.ndarray))
    C.spk_sample_rate
    C.spk_sample_rate = 48000
    C.pos_sample_rate
    C.pos_sample_rate = 50
    C.min_runlength
    C.min_runlength = 5
    C.xy
    C.xy = 1
    C.hdir
    C.hdir = 1
    C.speed
    C.speed = 1
    C.pos_samples_for_spike
    C.pos_samples_for_spike = 1
Beispiel #2
0
def test_p2t_time(path_to_axona_data):
    T = AxonaTrial(path_to_axona_data)
    T.load()
    waveforms = T.TETRODE[1].waveforms
    waveforms = waveforms[T.TETRODE[1].cut == 1, :, :]
    spk_ts = T.TETRODE.get_spike_samples(1, 1)
    S = SpikeCalcsAxona(spk_ts)
    S.p2t_time(waveforms)
Beispiel #3
0
def test_half_amp_duration(path_to_axona_data):
    T = AxonaTrial(path_to_axona_data)
    T.load()
    waveforms = T.TETRODE[1].waveforms
    waveforms = waveforms[T.TETRODE[1].cut == 1, :, :]
    spk_ts = T.TETRODE.get_spike_samples(1, 1)
    S = SpikeCalcsAxona(spk_ts)
    S.half_amp_dur(waveforms)
Beispiel #4
0
def test_plot_cluster_space(path_to_axona_data):
    T = AxonaTrial(path_to_axona_data)
    T.load()
    waveforms = T.TETRODE[1].waveforms
    waveforms = waveforms[T.TETRODE[1].cut == 1, :, :]
    spk_ts = T.TETRODE.get_spike_samples(1, 1)
    S = SpikeCalcsAxona(spk_ts)
    fig = S.plotClusterSpace(waveforms)
    return fig
Beispiel #5
0
def get_spikecalcs_instance(path_to_axona_data) -> SpikeCalcsGeneric:
    T = AxonaTrial(path_to_axona_data)
    T.load()
    spk_ts = T.TETRODE[1].spk_ts
    S = SpikeCalcsGeneric(spk_ts)
    S.getClusterWaveforms(1, 1)
    S.waveforms = T.TETRODE[1].waveforms
    S.spk_clusters = T.TETRODE[1].cut
    return S
Beispiel #6
0
def test_pos_props_with_events(path_to_axona_data):
    T = AxonaTrial(path_to_axona_data)
    T.load()
    spike_ts = T.TETRODE.get_spike_samples(1, 1)
    pp2d = phasePrecession2D(T.EEG.sig, 250., T.xy, spike_ts, T.xyTS, ppc)
    laser_events = np.array(
        np.ceil(T.STM['on'] / T.STM.timebase * T.pos_sample_rate)).astype(int)
    peaksXY, _, labels, _ = pp2d.partitionFields()
    pp2d.getPosProps(labels, peaksXY, laserEvents=laser_events, plot=True)
Beispiel #7
0
def test_the_rest_of_CDT(path_to_axona_data):
    T = AxonaTrial(path_to_axona_data)
    T.load()
    C = CosineDirectionalTuning(T.TETRODE[1].spk_ts, T.xyTS, T.TETRODE[1].cut,
                                T.xy[0, :], T.xy[1, :])
    runs = C.getRunsOfMinLength()
    C.speedFilterRuns(runs)
    spk_ts = T.TETRODE.get_spike_samples(1, 1)
    pos_mask = np.ones_like(spk_ts).astype(bool)
    C.intrinsic_freq_autoCorr(spk_ts, pos_mask)
Beispiel #8
0
def test_LFP_oscillations(path_to_axona_data):
    T = AxonaTrial(path_to_axona_data)
    T.load()
    sig = T.EEG.sig
    fs = T.EEG.sample_rate
    LFP_Osc = LFPOscillations(sig, fs)
    LFP_Osc.getFreqPhase(sig, [6, 12])
    LFP_Osc.modulationindex(sig)
    LFP_Osc.plv(sig)
    LFP_Osc.filterForLaser(sig)
Beispiel #9
0
def test_get_param(path_to_axona_data):
    T = AxonaTrial(path_to_axona_data)
    T.load()
    waveforms = T.TETRODE[1].waveforms
    waveforms = waveforms[T.TETRODE[1].cut == 1, :, :]
    spk_ts = T.TETRODE.get_spike_samples(1, 1)
    S = SpikeCalcsAxona(spk_ts)
    params = ['Amp', 'P', 'T', 'Vt', 'tP', 'tT', 'PCA']
    for param in params:
        S.getParam(waveforms, param=param)
Beispiel #10
0
def test_circ_circ_corr(path_to_axona_data):
    T = AxonaTrial(path_to_axona_data)
    T.load()
    spike_ts = T.TETRODE.get_spike_samples(1, 1)
    pp2d = phasePrecession2D(T.EEG.sig, 250., T.xy, spike_ts, T.xyTS, ppc)
    pp2d._circCircCorrTLinear(theta=T.dir[0:10].data,
                              phi=np.random.vonmises(0, 4, 10),
                              k=10,
                              conf=True)

    pp2d._circCircCorrTLinear(theta=T.dir[0:3].data,
                              phi=np.random.vonmises(0, 4, 3),
                              k=3,
                              conf=True)
Beispiel #11
0
def test_axona_properties(path_to_axona_data):
    from ephysiopy.dacq2py.axonaIO import EEG
    T = AxonaTrial(path_to_axona_data)
    T.load()
    assert (isinstance(T.STM, dict))
    assert (isinstance(T.settings, dict))
    assert (isinstance(T.EEG, EEG))
    assert (isinstance(T.EGF, EEG))
    T.TETRODE
    spike_times = T.TETRODE.get_spike_samples(1, 1)
    assert (isinstance(spike_times, np.ndarray))
    with pytest.raises(KeyError):
        T.TETRODE[16]
    with pytest.raises(Exception):
        T.TETRODE.get_spike_samples(99, 99)
Beispiel #12
0
def test_plot_axona_EGF_power(path_to_axona_data):
    T = AxonaTrial(path_to_axona_data)
    T.load()
    T.plotEEGPower('egf', plot=False)
    fig = plt.gcf()
    return fig
Beispiel #13
0
def test_plot_summary(path_to_axona_data):
    T = AxonaTrial(path_to_axona_data)
    T.load()
    spike_times = T.TETRODE.get_spike_samples(1, 1)
    T.makeSummaryPlot(spike_times)
Beispiel #14
0
def test_plot_axona_spikes_on_path(path_to_axona_data):
    T = AxonaTrial(path_to_axona_data)
    T.load()
    T.plotSpikesOnPath(1, 1, plot=False)
    fig = plt.gcf()
    return fig
Beispiel #15
0
def test_plot_axona_HD_map(path_to_axona_data):
    T = AxonaTrial(path_to_axona_data)
    T.load()
    T.plotHDMap(1, 1, plot=False)
    fig = plt.gcf()
    return fig
Beispiel #16
0
def test_plot_axona_HD_map_with_mrv(path_to_axona_data):
    T = AxonaTrial(path_to_axona_data)
    T.load()
    T.plotHDMap(1, 1, plot=False, add_mrv=True, fill=True)
    fig = plt.gcf()
    return fig
Beispiel #17
0
def test_phase_precession_2d_setup(path_to_axona_data):
    T = AxonaTrial(path_to_axona_data)
    T.load()
    spike_ts = T.TETRODE.get_spike_samples(1, 1)
    phasePrecession2D(T.EEG.sig, 250., T.xy, spike_ts, T.xyTS, ppc)
Beispiel #18
0
def test_plot_axona_SAC(path_to_axona_data):
    T = AxonaTrial(path_to_axona_data)
    T.load()
    T.plotSAC(1, 1, plot=False)
    fig = plt.gcf()
    return fig
Beispiel #19
0
def test_plot_axona_EEG_power(path_to_axona_data):
    T = AxonaTrial(path_to_axona_data)
    T.load()
    T.plotEEGPower('eeg', ylim=25, plot=False)
    fig = plt.gcf()
    return fig
Beispiel #20
0
def test_plot_axona_speed_vs_HD(path_to_axona_data):
    T = AxonaTrial(path_to_axona_data)
    T.load()
    T.plotSpeedVsHeadDirection(1, 1, plot=False)
    fig = plt.gcf()
    return fig
Beispiel #21
0
def test_plot_axona_speed_vs_rate(path_to_axona_data):
    T = AxonaTrial(path_to_axona_data)
    T.load()
    T.plotSpeedVsRate(1, 1, plot=False, maxSpeed=1e6)
    fig = plt.gcf()
    return fig
Beispiel #22
0
def test_load_axona_trial(path_to_axona_data):
    T = AxonaTrial(path_to_axona_data)
    T.load()
Beispiel #23
0
def test_perform_regression(path_to_axona_data):
    T = AxonaTrial(path_to_axona_data)
    T.load()
    spike_ts = T.TETRODE.get_spike_samples(1, 1)
    pp2d = phasePrecession2D(T.EEG.sig, 250., T.xy, spike_ts, T.xyTS, ppc)
    pp2d.performRegression()
Beispiel #24
0
def test_plot_raster(path_to_axona_data):
    T = AxonaTrial(path_to_axona_data)
    T.load()
    old_events = T.ttl_timestamps.copy()
    T.ttl_timestamps = None
    T.plotRaster(1, 1, plot=False)
    T.ttl_timestamps = old_events
    T.plotRaster(1, 1, plot=False)
    fig = plt.gcf()
    ax = plt.gca()
    T.plotRaster(1, 1, ax=ax, histtype='rate')
    return fig