Skip to content

Phy only shows average templates after spikeinterface.export_to_phy; raw per-spike waveforms cannot be displayed #4169

Closed

Description

@Sicheng-package

Phy only shows average templates after spikeinterface.export_to_phy; raw per-spike waveforms cannot be displayed.What can i do to solve this issue?

Activity

  1. alejoe91 commented on Oct 13, 2025

    @alejoe91
    Member

    Hi, do you see the raw traces? The per-spike waveforms are extracted from the traces on the fly, so if Phy cannot load traces, then it won't show single waveforms either!

  2. Sicheng-package commented on Oct 13, 2025

    @Sicheng-package
    Author

    Hi, thanks for the quick reply.
    I also can’t see raw traces in Phy. TraceView fails to open, so single-spike waveforms don’t show either.

    What I see in Phy
    (phy2) E:\testephys\phy_qcpass_clusters2> phy template-gui params.py
    22:00:32.261 [W] model:1415 File None does not exist.
    22:00:34.752 [W] model:667 Skipping spike waveforms that do not exist, they will be extracted on the fly from the raw data as needed.
    22:00:34.754 [W] traces:462 File E:\testephys\phy_qcpass_clusters2\None does not exist.
    22:00:34.754 [W] traces:462 File E:\testephys\phy_qcpass_clusters2\None does not exist.
    QMimeDatabase: Error loading internal MIME data
    An error has been encountered at line 1 of : Premature end of document.:
    22:17:41.848 [W] gui:671 Could not create view TraceView.
    22:17:49.060 [W] gui:671 Could not create view TraceView.
    22:18:04.658 [W] gui:671 Could not create view TraceView.

    The key part seems to be File None does not exist. and the TraceView creation failure.

    How I exported from SpikeInterface

    export_to_phy

    an_qc = an.select_units(unit_ids=qc_unit_ids)
    sorting_dedup.copy_metadata(an_qc.sorting, ids=an_qc.sorting.unit_ids)
    normalize_str_props(an_qc.sorting, keys=("group","KSLabel","quality"))
    props_for_export = [p for p in ("group","KSLabel","quality") if p in an_qc.sorting.get_property_keys()]

    from pathlib import Path
    PHY_DIR = Path(r"E:/testephys/phy_qcpass_clusters2")

    export_to_phy(
    sorting_analyzer=an_qc,
    output_folder=PHY_DIR,
    remove_if_exists=True,
    copy_binary=False, # <-- I set this to False
    additional_properties=props_for_export,
    )
    print("Exported to Phy ->", PHY_DIR)

    Should I re-export with copy_binary=True so the exporter writes a proper .bin and params.py?

  3. alejoe91 commented on Oct 13, 2025

    @alejoe91
    Member

    Exactly, that's the reason. You need copy_binary=True

  4. Sicheng-package commented on Oct 15, 2025

    @Sicheng-package
    Author

    Thanks — that was exactly it. Setting copy_binary=True makes Phy load the traces, so single-spike waveforms show up. 🙏

    Quick question: does SpikeInterface have a built-in way to handle events/TTL (e.g., extracting edges from NIDQ and aligning spikes to events) so I can keep everything inside SI? I know I can load the NIDQ stream with read_spikeglx(..., stream_name="nidq"), and I see there’s a BaseEvent API for events, but is there an official helper/example for turning NIDQ TTLs into BaseEvent objects and doing basic alignment/PETH? If so, could you share a pointer? Thanks a lot!

  5. alejoe91 commented on Oct 15, 2025

    @alejoe91
    Member

    Good question. Note really currently but @h-mayorquin can comment on it.

    Tagging also @guptadivyansh and @manimoh since they looked into this:
    NeuralEnsemble/python-neo#1657

  6. h-mayorquin commented on Oct 15, 2025

    @h-mayorquin
    Contributor

    There is a SpikeGLXEventExtractor in the extractor clasess that should give you the timing of the events. It would be good to have it tested.

    As far as I am aware we don't the machinery for doing the interpolation but that should not be too difficult with numpy.

  7. Sicheng-package commented on Oct 15, 2025

    @Sicheng-package
    Author

    Thanks a lot for the pointer to SpikeGLXEventExtractor—that’s exactly what I needed for getting event timings. I’ll test it on my SpikeGLX datasets.

  8. h-mayorquin commented on Oct 19, 2025

    @h-mayorquin
    Contributor

    Great. Let us know if it works as expected and, if you can, give us some stars on the repo as that is good for us to get funding for doing more development : )

  9. Sicheng-package commented on Oct 19, 2025

    @Sicheng-package
    Author

    Everything is working great on my side—thanks for the pointers!
    I extracted the events and performed interpolation to align AP and NIDAQ to the same timebase.
    Also, I just ⭐️ the repo—hope it helps with funding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    exportersRelated to exporters module

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions