Skip to content

Commit c53157d

Browse files
Peter N. SteinmetzPeter N. Steinmetz
authored andcommitted
Allow 0 or more colons after Opened and Closed. Split long lines.
1 parent 38e910e commit c53157d

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

neo/rawio/neuralynxrawio/nlxheader.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def convert_channel_ids_names(self, filename):
206206
# Filename and datetime may appear in header lines starting with # at
207207
# beginning of header or in later versions as a property. The exact format
208208
# used depends on the application name and its version as well as the
209-
# -FileVersion property.
209+
# -FileVersion property. Examples of each known case are shown below in comments.
210210
#
211211
# There are 4 styles understood by this code and the patterns used for parsing
212212
# the items within each are stored in a dictionary. Each dictionary is then
@@ -277,8 +277,10 @@ def convert_channel_ids_names(self, filename):
277277
# ## Date Opened: (mm/dd/yyy): 12/14/2015 At Time: 15:58:32
278278
# ## Date Closed: (mm/dd/yyy): 12/14/2015 At Time: 15:58:32
279279
"neuraview2": dict(
280-
datetime1_regex=r"## (Time|Date) Opened: \((m/d/y|mm/dd/yyy)\): (?P<date>\S+)" r" At Time: (?P<time>\S+)",
281-
datetime2_regex=r"## (Time|Date) Closed: \((m/d/y|mm/dd/yyy)\): (?P<date>\S+)" r" At Time: (?P<time>\S+)",
280+
datetime1_regex=r"## (Time|Date) Opened:* \((m/d/y|mm/dd/yyy)\): (?P<date>\S+)" \
281+
r" At Time: (?P<time>\S+)",
282+
datetime2_regex=r"## (Time|Date) Closed:* \((m/d/y|mm/dd/yyy)\): (?P<date>\S+)" \
283+
r" At Time: (?P<time>\S+)",
282284
datetimeformat="%m/%d/%Y %H:%M:%S",
283285
),
284286
# pegasus version 2.1.1 and Cheetah beyond version 5.6.4 - example
@@ -300,8 +302,10 @@ def convert_channel_ids_names(self, filename):
300302
),
301303
# version with time open and closed in ## header lines
302304
"openClosedInHeader": dict(
303-
datetime1_regex=r"## (Time|Date) Opened \(m/d/y\): (?P<date>\S+)" r" (\(h:m:s\.ms\)|At Time:) (?P<time>\S+)",
304-
datetime2_regex=r"## (Time|Date) Closed \(m/d/y\): (?P<date>\S+)" r" (\(h:m:s\.ms\)|At Time:) (?P<time>\S+)",
305+
datetime1_regex=r"## (Time|Date) Opened:* \(m/d/y\): (?P<date>\S+)" \
306+
r" (\(h:m:s\.ms\)|At Time:) (?P<time>\S+)",
307+
datetime2_regex=r"## (Time|Date) Closed:* \(m/d/y\): (?P<date>\S+)" \
308+
r" (\(h:m:s\.ms\)|At Time:) (?P<time>\S+)",
305309
datetimeformat="%m/%d/%Y %H:%M:%S.%f",
306310
)
307311
}
@@ -347,6 +351,9 @@ def readTimeDate(self, txt_header):
347351
hpd = NlxHeader.header_pattern_dicts["inProps"]
348352

349353
# opening time
354+
# :TODO: Processing for this and close time should be changed to not depend on storing
355+
# in a particular formatted string by header type, but rather always should be
356+
# formatted in one standard way.
350357
sr = re.search(hpd["datetime1_regex"], txt_header)
351358
if not sr:
352359
raise IOError(

0 commit comments

Comments
 (0)