diff --git a/oephys2nix/tonix.py b/oephys2nix/tonix.py index e4dbce8..9767a8e 100644 --- a/oephys2nix/tonix.py +++ b/oephys2nix/tonix.py @@ -14,6 +14,36 @@ log = logging.getLogger(__name__) class RawToNix: + """Appending all raw data from relacs and open-ephsy to a new nix file. + + Parameters + ---------- + open_ephys_path: pathlib.Path + Path to open-ephys recording + relacs_nix_path : str + Path to relacs nix file + nix_file : str + Path to new nix file + + Attributes + ---------- + relacs_nix_file : nixio.File + Relacs nix file + dataset : rlx.Dataset + Dataset of the relacs file + relacs_block : nixio.Block + Relacs block + relacs_sections : nixio.Section + Relacs section + neo_data : neo.OpenEphysBinaryIO + Open Ephys data + nix_file : nixio.File + New nix file + block : nixio.Block + New nix file block + + """ + def __init__(self, open_ephys_path: pathlib.Path, relacs_nix_path: str, nix_file: str): self.relacs_nix_file = nixio.File.open(relacs_nix_path, nixio.FileMode.ReadOnly) self.dataset = rlx.Dataset(relacs_nix_path) @@ -25,7 +55,8 @@ class RawToNix: self.nix_file.create_block("open-ephys.data", "open-ephys.sampled") self.block = self.nix_file.blocks[0] - def append_section(self): + def append_section(self) -> None: + """Append sections from relacs.""" sec = self.nix_file.create_section( self.relacs_sections[0].name, self.relacs_sections[0].type ) @@ -33,7 +64,8 @@ class RawToNix: create_metadata_from_dict(d, sec) self.block.metadata = sec - def append_fish_lines(self): + def append_fish_lines(self) -> None: + """Append fish lines from open-ephys.""" efishs = ["ttl-line", "global-eod", "stimulus", "local-eod", "sinus"] efish_types = [ @@ -63,7 +95,8 @@ class RawToNix: ) efish_group.data_arrays.append(data_array) - def append_relacs_lines(self): + def append_relacs_lines(self) -> None: + """Append relacs lines.""" relacs = [ "V-1", "EOD", @@ -111,7 +144,8 @@ class RawToNix: efish_group.data_arrays.append(data_array) - def append_raw_data(self): + def append_raw_data(self) -> None: + """Append Open-Ephys Raw data.""" gr = self.block.create_group("neuronal-data", "open-epyhs.sampled") raw_neo_data = self.neo_data[0].segments[0].analogsignals[0].load() @@ -128,6 +162,7 @@ class RawToNix: ) gr.data_arrays.append(nix_data_array) - def close(self): + def close(self) -> None: + """Close all nix files.""" self.nix_file.close() self.relacs_nix_file.close()