affinewarp icon indicating copy to clipboard operation
affinewarp copied to clipboard

Transformed Units Have Drastically Reduced Fire Rates

Open mohrabi opened this issue 2 years ago • 2 comments

Hi! So I have been trying to apply ShiftWarping on my dataset, but the transformed neurons have reduced spike count rate and in some of the trials, after a certain point of time, transformed units burst! I have no idea whether if this phenomenon is expected or it is due to my code.

The raster plot for one of my neurons is attached, before and after time warping.

130361430-c98d5ec8-f895-473c-b713-9445d158f870

mohrabi avatar Aug 22 '21 15:08 mohrabi

The results look very strange. The bursting artifacts are edge effects. Can you provide a short code snippet which shows what you are doing?

ahwillia avatar Aug 22 '21 22:08 ahwillia

Oops sorry! I meant LinearWarping

Anyway, here is my code:

twModelLinear = PiecewiseWarping(n_knots=0, warp_reg_scale=1e-6, 
                           smoothness_reg_scale=20.0) 
twModelLinear.fit(np.einsum('ijk->ikj', data.su), iterations=20)
linearTwSu = np.einsum('ijk->ikj', twModelLinear.transform(np.einsum('ijk->ikj', data.su)))

twModel = twModelShift
twSu       = shiftedTwSu

fig, axes = plt.subplots(2, data.nUnit, figsize=(32,8))
for iUnit in range(data.nUnit):
    spikeInds = [np.where(data.su[i, iUnit, :] == 1)[0] for i in range(data.nTrial)]
    axes[0, iUnit].eventplot(np.array(spikeInds, dtype=object))
    
    spikeInds = [np.where(twSu[i, iUnit, :] == 1)[0] for i in range(data.nTrial)]
    axes[1, iUnit].eventplot(np.array(spikeInds, dtype=object))

and about that edge artifact, is there a clean way to identify (and probably remove) the corrupted trials? For example a simple method by which we can extract the valid time samples based on the warp functions.

mohrabi avatar Aug 23 '21 04:08 mohrabi