probe not ordered by 'device_channel_indices'
Hi,
I am loading a json file exported from ONIX using read_probeinterface. I see that the probe loaded is not ordered by 'device_channel_indices'. I suspect this is the reason for some downstream problems (waveform extraction fails).
probes = read_probeinterface(json_file)
raw_rec = raw_rec.set_probegroup(probes)
how can I order the probes object by 'device_channel_indices' before assigning it?
Thanks!
the json exported from onix is ordered by "contac_ids" and not 'device_channel_indices' .
Hi @RobertoDF
You don't need to reorder the probe. When setting a probe/probegroup, SpikeInterface reorders by device_channel_indices automatically ;)
You can check with:
pg = raw_rec.get_probegroup()
pg.to_dataframe()
oh! ok than maybe the problem is that I should keep the original order!?
is that possible to do easily?
Are you getting any errors? If not then don't worry about it :)
The main problem is that when I extract the waveforms, thay are all flat.
The code does work with other rec types though.
Are you filtering the data before creating the analyzer? From the plots, that seems to be the issue...
no, I just do
raw_rec = read_binary(path_recording,
sampling_frequency=fs_hz,
dtype=np.uint16,
num_channels=num_channels,
gain_to_uV=gain_to_uV,
offset_to_uV=offset_to_uV)
probes = read_probeinterface(probe_json)
raw_rec = raw_rec.set_probegroup(probes)
raw_rec = spre.scale_to_uV(recording=raw_rec)
I see that the scaling happens automatically in the sorting_analyzer. is it bad to provide the already scaled trace?
I just noticed that they are not totally flat, this is the biggest cluster by amplitude
they are just unusually small.
Ah yes, you don't need to scale twice. The create_sorting_analyzer will automatically scale to uV since by the default it has a parameter called return_scaled=True.
If you don't pre-filter the recording, at least with a high pass, there might be low-freq fluctuations that might affect waveform extraction and templates. Can you try to highpass filter the recording before creating the analyzer?
am I correct in thinking that it is enough to high pass at the line of the sorting analyzer?
create_sorting_analyzer(sorting, spre.highpass_filter(recording=sub_rec))
kilosort is already doing it by itself when sorting.
yes that's correct :)
Ok this looks better now thanks!