Skip to content

Issue with Shape Mismatch Error in calculate_drift_metrics function in metrics.py #94

@OlyOlympic

Description

@OlyOlympic

Hello, @jsiegle

I am encountering an issue when using the calculate_drift_metrics function in the ecephys_spike_sorting\modules\quality_metrics\metrics.py file. The error occurs due to a shape mismatch between variables, and the shapes always differ by 1. Below is the relevant function code:
def calculate_drift_metrics(spike_times,
spike_clusters,
spike_templates,
unit_template_ids,
total_units,
pc_features,
pc_feature_ind,
channel_pos,
interval_length,
min_spikes_per_interval)

I am receiving a ValueError related to mismatched shapes when I try to run this function. The dimensions of the variables seem to differ by 1 each time, which causes the error.

_File d:\bo\ecephys\ecephys_spike_sorting-master\ecephys_spike_sorting\modules\quality_metrics\metrics.py:142, in calculate_metrics(spike_times, spike_clusters, spike_templates, amplitudes, channel_map, channel_pos, templates, pc_features, pc_feature_ind, params, epochs)
133 the_silhouette_score = calculate_silhouette_score(spike_clusters[in_epoch],
134 spike_templates[in_epoch],
135 total_units,
136 pc_features[in_epoch,:,:],
137 pc_feature_ind,
...
556 # majority template for htat cluster. These operations make copies of the
557 # arrays.
558 m_spike_clusters = spike_clusters[match_maj]

ValueError: operands could not be broadcast together with shapes (2382853,) (2382852,)_

Could you help me understand why this happens and how I can resolve the issue?
I would really appreciate any insights or suggestions for solving this problem!
Thanks in advance!

Best regards,
Oly

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions