Compare commits

..

5 Commits

Author SHA1 Message Date
wendtalexander
128bac0f23 [pyproject] renaming 2026-05-20 09:42:14 +02:00
wendtalexander
6d61bc7e14 [repros] fixing if the last repro was empty because it was to small 2026-05-20 09:42:01 +02:00
wendtalexander
5708925442 [main] closing after writing 2026-05-20 09:41:22 +02:00
32487e09a9 [sorting] fixing cleanup 2026-05-07 11:55:37 +02:00
wendtalexander
d9aed0551f [sorting] need more fixing 2026-05-06 16:58:56 +02:00
4 changed files with 29 additions and 15 deletions

View File

@@ -131,6 +131,7 @@ def convert(
stim = StimulusToNix(open_ephys, str(relacs), str(nix_path))
stim.create_repros_automatically()
stim.print_table()
stim.close()
@app.command()

View File

@@ -1,21 +1,11 @@
import logging
import pathlib
import sys
import matplotlib.pyplot as plt
import nixio
import numpy as np
import rlxnix as rlx
import spikeinterface.core as si
from IPython import embed
from neo.io import OpenEphysBinaryIO
from nixio.exceptions import DuplicateName
from rich.console import Console
from rich.table import Table
from rlxnix.plugins.efish.utils import extract_am
from scipy import signal
from oephys2nix.metadata import create_dict_from_section, create_metadata_from_dict
log = logging.getLogger(__name__)
console = Console()
@@ -46,6 +36,7 @@ class AppendSorting:
self.sorting, mode="extremum", peak_sign="neg", outputs="index"
)
self.data = self.block.data_arrays["data"]
self._clean()
self.append_sorting_to_recording()
def append_sorting_to_recording(self):
@@ -87,6 +78,19 @@ class AppendSorting:
f"unit-{unit}", "sorting.spike_index", multi_tag_positions
)
multi_tag.references.append(self.data)
gr.mulit_tags.append(positions)
def _clean(self):
try:
gr = self.block.groups["units"]
except IndexError:
return
for das in gr.data_arrays:
del self.das[das.name]
for mtag in gr.multi_tags:
del self.block.mulit_tags[mtag.name]
del self.das[mtag.name + "-positions"]
def close(self):
self.nixfile.close()

View File

@@ -438,10 +438,19 @@ class StimulusToNix:
continue
last_repro_name = self.dataset.repro_runs()[i - 1].name
try:
log.debug("Did find the last repro")
last_repro_position = (
self.block.groups[last_repro_name].tags[0].position[0]
+ self.block.groups[last_repro_name].tags[0].extent[0]
)
except KeyError:
log.debug("Last repro did not exit")
log.info("Finish writing")
break
embed()
exit()
self._append_tag(
repro,
last_repro_position.reshape(-1, 1),

View File

@@ -1,5 +1,5 @@
[project]
name = "oepyhs2nix"
name = "oephys2nix"
version = "0.1.1"
description = "Converting ophen-ephys data to nix format"
readme = "README.md"