From ac3b3d48ec4c268b1069a6e5fb5ede987e7d8e81 Mon Sep 17 00:00:00 2001 From: "Peter N. Steinmetz" Date: Fri, 20 Sep 2024 17:18:05 -0700 Subject: [PATCH 01/11] Extracting check and conversions from read_properties. --- neo/rawio/neuralynxrawio/nlxheader.py | 228 ++++++++++++++------------ 1 file changed, 127 insertions(+), 101 deletions(-) diff --git a/neo/rawio/neuralynxrawio/nlxheader.py b/neo/rawio/neuralynxrawio/nlxheader.py index ea3afd01a..4a28242e1 100644 --- a/neo/rawio/neuralynxrawio/nlxheader.py +++ b/neo/rawio/neuralynxrawio/nlxheader.py @@ -22,7 +22,9 @@ def _to_bool(txt): else: raise Exception("Can not convert %s to bool" % txt) - # keys that may be present in header which we parse + # Keys that may be present in header which we parse. First entry of tuple is what is + # present in header, second entry is key which will be used in dictionary, third entry + # type the value will be converted to. txt_header_keys = [ ("AcqEntName", "channel_names", None), # used ("FileType", "", None), @@ -68,68 +70,6 @@ def _to_bool(txt): ("NLX_Base_Class_Type", "", None), # in version 4 and earlier versions of Cheetah ] - # 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 4 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 = { - # BML - "bml": dict( - datetime1_regex=r"## Time Opened: \(m/d/y\): (?P\S+)" r" At Time: (?P