Compare commits
5 Commits
11d76b205a
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
128bac0f23 | ||
|
|
6d61bc7e14 | ||
|
|
5708925442 | ||
| 32487e09a9 | |||
|
|
d9aed0551f |
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[project]
|
||||
name = "oepyhs2nix"
|
||||
name = "oephys2nix"
|
||||
version = "0.1.1"
|
||||
description = "Converting ophen-ephys data to nix format"
|
||||
readme = "README.md"
|
||||
|
||||
Reference in New Issue
Block a user