def test_loader_simple(waveform_loader):
    b = waveform_loader
    spike_samples = b.spike_samples
    loader = b.loader
    traces = loader.traces
    dc_offset = loader.dc_offset or 0
    scale_factor = loader.scale_factor or 1
    n_samples_traces, n_channels = traces.shape
    n_samples_waveforms = b.n_samples_waveforms
    h = n_samples_waveforms // 2

    assert loader.offset == 0
    assert loader.dc_offset in (dc_offset, None)
    assert (scale_factor, None) in loader.scale_factor

    def _transform(arr):
        return (arr - dc_offset) * scale_factor

    waveforms = loader[spike_samples[10:20]]
    assert waveforms.shape == (10, n_samples_waveforms, n_channels)
    t = spike_samples[15]
    w1 = waveforms[5, ...]
    w2 = _transform(traces[t - h:t + h, :])
    assert np.allclose(w1, w2)

    sl = SpikeLoader(loader, spike_samples)
    assert np.allclose(sl[15], w2)
dataset/ETHPy150Open kwikteam/phy/phy/traces/tests/test_waveform.py/test_loader_simple/swapped operands of `in`