How to use the nixio.File function in nixio

To help you get started, we’ve selected a few nixio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NeuralEnsemble / python-neo / neo / io / nixio.py View on Github external
:param filename: Full path to the file
        """
        check_nix_version()
        BaseIO.__init__(self, filename)
        self.filename = filename
        if mode == "ro":
            filemode = nix.FileMode.ReadOnly
        elif mode == "rw":
            filemode = nix.FileMode.ReadWrite
        elif mode == "ow":
            filemode = nix.FileMode.Overwrite
        else:
            raise ValueError("Invalid mode specified '{}'. "
                             "Valid modes: 'ro' (ReadOnly)', 'rw' (ReadWrite),"
                             " 'ow' (Overwrite).".format(mode))
        self.nix_file = nix.File.open(self.filename, filemode)

        if self.nix_file.mode == nix.FileMode.ReadOnly:
            self._file_version = '0.5.2'
            if "neo" in self.nix_file.sections:
                self._file_version = self.nix_file.sections["neo"]["version"]
        elif self.nix_file.mode == nix.FileMode.ReadWrite:
            if "neo" in self.nix_file.sections:
                self._file_version = self.nix_file.sections["neo"]["version"]
            else:
                self._file_version = '0.5.2'
                filemd = self.nix_file.create_section("neo", "neo.metadata")
                filemd["version"] = self._file_version
        else:
            # new file
            filemd = self.nix_file.create_section("neo", "neo.metadata")
            filemd["version"] = neover
github SpikeInterface / spikeextractors / spikeextractors / extractors / nixioextractors / nixioextractors.py View on Github external
def __init__(self, file_path):
        assert HAVE_NIXIO, self.installation_mesg
        SortingExtractor.__init__(self)
        self._file = nix.File.open(file_path, nix.FileMode.ReadOnly)
        md = self._file.sections
        if "sampling_frequency" in md:
            sfreq = md["sampling_frequency"]
            self._sampling_frequency = sfreq
        self._load_properties()
        self._kwargs = {'file_path': str(Path(file_path).absolute())}

nixio

Python reimplementation of NIXIO (http://g-node.github.io/nix/)

BSD-2-Clause
Latest version published 2 years ago

Package Health Score

49 / 100
Full package analysis