From c35e832efe873545cc1c3fca14dc1707e510e26e Mon Sep 17 00:00:00 2001 From: "Peter N. Steinmetz" Date: Tue, 4 Aug 2020 10:24:03 -0700 Subject: [PATCH 01/16] Ignore virtual environments. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f9242537b..debc97c68 100644 --- a/.gitignore +++ b/.gitignore @@ -64,3 +64,4 @@ Thumbs.db ################################### neo/test/io/neurosharemergeio.py files_for_testing_neo +/venv From 693b46cb78d09ebf387d3096d08ef787fb6837c1 Mon Sep 17 00:00:00 2001 From: "Peter N. Steinmetz" Date: Thu, 6 Aug 2020 11:52:27 -0700 Subject: [PATCH 02/16] Permit filename extensions in other than lowercase. --- neo/rawio/neuralynxrawio.py | 1 + 1 file changed, 1 insertion(+) diff --git a/neo/rawio/neuralynxrawio.py b/neo/rawio/neuralynxrawio.py index c18fd8ee8..993054d94 100644 --- a/neo/rawio/neuralynxrawio.py +++ b/neo/rawio/neuralynxrawio.py @@ -87,6 +87,7 @@ def _parse_header(self): _, ext = os.path.splitext(filename) ext = ext[1:] # remove dot + ext = ext.lower() # make lower case for comparisons if ext not in self.extensions: continue From db6846ce96f250b52dbc9b248f2fcf4ebf35462c Mon Sep 17 00:00:00 2001 From: "Peter N. Steinmetz" Date: Fri, 7 Aug 2020 11:27:32 -0700 Subject: [PATCH 03/16] Changes to handle headers from earlier Cheetah versions and BML. --- neo/rawio/neuralynxrawio.py | 97 ++++++++++++++++++++++++------------- 1 file changed, 64 insertions(+), 33 deletions(-) diff --git a/neo/rawio/neuralynxrawio.py b/neo/rawio/neuralynxrawio.py index 993054d94..c447cfedf 100644 --- a/neo/rawio/neuralynxrawio.py +++ b/neo/rawio/neuralynxrawio.py @@ -577,23 +577,51 @@ def _to_bool(txt): (r'Feature \w+ \d+', '', None), ('SessionUUID', '', None), ('FileUUID', '', None), - ('CheetahRev', '', None), # only for old version + ('CheetahRev', '', None), # only for older versions of Cheetah ('ProbeName', '', None), ('OriginalFileName', '', None), ('TimeCreated', '', None), ('TimeClosed', '', None), - ('ApplicationName', '', None), # also include version number + ('ApplicationName', '', None), # also include version number when present ('AcquisitionSystem', '', None), ('ReferenceChannel', '', None), ] +# Filename and datetime may appear in header lines starting with # at +# beginning of header or in later versions as a property. The exact format +# used depends on the application name and its version as well as the +# -FileVersion property. +# +# There are 3 styles understood by this code and the patterns used for parsing +# the items within each are stored in a dictionary. Each dictionary is then +# stored in main dictionary keyed by an abbreviation for the style. +header_pattern_dicts = { + # Cheetah before version 5 and BML + 'bv5': dict( + datetime1_regex=r'## Time Opened \(m/d/y\): (?P\S+) At Time: (?P