Exporting to phy changes cluster channels
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with the supplied script, especially read_phy, recording.set_probe, and export_to_phy, and inspect how channel_positions.npy is used before cluster_info.tsv is written. Reproduce the export with the shown analyzer and compare channel numbers before export with cluster_info.tsv afterward. Done means exported channel numbers match the analyzer and the resulting waveforms and quality metrics use the intended channels.
Written by the indexing model from the issue text.
Description
After manual curation, I'm recalculating cluster waveforms and some quality metrics using the script below. However, when I export to phy, the channel numbers are wrong. When I pause/debug the script before export_to_phy, channel numbers are correct, but inspecting cluster_info.tsv after exporting, they're different. I would fix this post-hoc, but because the channel numbers are wrong, the calculated waveforms and subsequent waveform based quality metrics are also incorrect. I'd very much appreciate any help!
rec_folder = Path(probe_folder, probe)
probe_number = find_numbers_in_string(probe)
phy_dir = rec_folder
ac_dir = Path(phy_dir, 'postprocessed')
ac_dir_wave = Path(ac_dir, 'waveforms')
ac_dir_phy = Path(ac_dir, 'phy')
if not os.path.isdir(ac_dir_phy):
waveform_folder = Path(phy_dir, "analyzer")
report_folder = Path(phy_dir, 'report')
# Load your sorted units from the Phy folder
sorting = read_phy(phy_dir)
# Get channel locations from .npy file
path_channel_location = Path(phy_dir, 'channel_positions.npy')
channel_locations = np.load(path_channel_location)
num_channels = channel_locations.shape[0]
# Load the original recording
recording = si.read_binary(Path(ses_folder, "ksData_probe" + str(probe_number[0]) + ".dat"),
sampling_frequency=fs,
num_channels=num_channels,
dtype="int16")
probe_64, locations = utils.gen_probe()
recording.set_probe(probe_64, in_place=True)
#recording.set_dummy_probe_from_locations(channel_locations)
recording.annotate(is_filtered=True)
sorting = remove_excess_spikes(sorting, recording)
sorting = remove_duplicated_spikes(sorting=sorting, censored_period_ms=0.5, method="keep_first")
#sorting = sorting.remove_empty_units()
print("building analyzer")
analyzer = si.create_sorting_analyzer(sorting=sorting, recording=recording, return_scaled=False)
analyzer.compute("random_spikes")
analyzer.compute("waveforms", save=True)
templates = analyzer.compute("templates", save=True)
analyzer.compute(
"spike_amplitudes",
peak_sign="pos"
)
analyzer.compute("noise_levels")
amp_cutoff = analyzer.compute(
"quality_metrics",
qm_params=dqm_params
)
print("Saving analyizer")
analyzer.save_as(format="binary_folder", folder=ac_dir_wave)
print("Exproting to phy")
export_to_phy(analyzer, output_folder=ac_dir_phy, copy_binary=False, additional_properties=['quality'], remove_if_exists=True)
print("Finished" + str(ac_dir_phy))
- Dominant language
- Python
- Stars
- 847
- Forks
- 280
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 29
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from SpikeInterface/spikeinterface
-
testing
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
SpikeInterface/spikeinterface#4756 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
SpikeInterface/spikeinterface#4745 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
SpikeInterface/spikeinterface#4510 · 2 comments ·
-
performance
Difficulty 4/5 3-5 days Newbie friendliness 55/100
SpikeInterface/spikeinterface#4787 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
SpikeInterface/spikeinterface#4781 · 1 comment ·
All issues in SpikeInterface/spikeinterface
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
zostera/django-bootstrap4#894 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
use-agent-os/agent-os#3276 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
zephyrproject-rtos/zephyr#119726 ·
-
area/auth bug comp/agent P3 platform/discord type/security
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
NousResearch/hermes-agent#117848 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
zilliztech/memsearch#759 ·