Closed CodyCBakerPhD closed 7 months ago
Almost there!
The generate_*
function generates data in uV, so if you set additional gains you're applying the conversion twice.
In order to match the range and scaling of NP1.0 you should do the following:
artificial_ap_band = artificial_ap_band.scale(gain=1/ap_conversion_factor_to_uV)
int16_artificial_ap_band = artificial_ap_band.astype(dtype="int16")
int16_artificial_ap_band.set_channel_gains(ap_conversion_factor_to_uV)
For generating the LF stream, you can use the resample
function.
Note that NP has a hardware filter at 1000Hz for LF and its sampled at 2.5KHz:
artificial_lf_filter = spikeinterface.preprocessing.bandpass_filter(
recording=artificial_ap_band, freq_min=0.5, freq_max=1000
)
artificial_lf_band = spikeinterface.preprocessing.resample(
recording=artificial_lf_band, resample_rate=2500
)
int16_artificial_lf_band = artificial_lf_band.astype(dtype="int16")
int16_artificial_lf_band.set_channel_gains(ap_conversion_factor_to_uV)
Note that the simulated reording will not have low frequency components.
With respect to these lines
Moving discussion from Slack and looking for advice from @alejoe91
We're trying to approximate synthetic AP/LF bands and their associated spiking activity + waveforms (which get written as Phy)
(i) what filter should we use (using bandpass ATM; if so, what frequency range would you recommend) to approximate LF - also, how would you recommend downsampling?
(ii) for doing
recording.astype("int16")
, do you think I should do that before or afterextract_waveforms
?_Originally posted by @CodyCBakerPhD in https://github.com/NeurodataWithoutBorders/nwb-guide/pull/530#discussion_r1477102364_