@@ -85,12 +85,12 @@ def _to_bool(txt):
8585 #
8686 # There are now separate patterns for the in header line and in properties cases which cover
8787 # the known variations in each case. They are compiled here once for efficiency.
88- openDatetime1_pat = re .compile (r"## (Time|Date) Opened:* \((m/d/y|mm/dd/yyy)\): (?P<date>\S+)" \
88+ _openDatetime1_pat = re .compile (r"## (Time|Date) Opened:* \((m/d/y|mm/dd/yyy)\): (?P<date>\S+)" \
8989 r"\s+(\(h:m:s\.ms\)|At Time:) (?P<time>\S+)" )
90- openDatetime2_pat = re .compile (r"-TimeCreated (?P<date>\S+) (?P<time>\S+)" )
91- closeDatetime1_pat = re .compile (r"## (Time|Date) Closed:* \((m/d/y|mm/dd/yyy)\): " \
90+ _openDatetime2_pat = re .compile (r"-TimeCreated (?P<date>\S+) (?P<time>\S+)" )
91+ _closeDatetime1_pat = re .compile (r"## (Time|Date) Closed:* \((m/d/y|mm/dd/yyy)\): " \
9292 r"(?P<date>\S+)\s+(\(h:m:s\.ms\)|At Time:) (?P<time>\S+)" )
93- closeDatetime2_pat = re .compile (r"-TimeClosed (?P<date>\S+) (?P<time>\S+)" )
93+ _closeDatetime2_pat = re .compile (r"-TimeClosed (?P<date>\S+) (?P<time>\S+)" )
9494
9595 # Precompiled filename pattern
9696 _filename_pat = re .compile (r"## File Name:* (?P<filename>.*)" )
@@ -182,15 +182,15 @@ def __init__(self, filename, props_only=False):
182182 if not props_only and not txt_header .startswith ("########" ):
183183 ValueError ("Neuralynx files must start with 8 # characters." )
184184
185- self .read_properties (filename , txt_header )
186- self .setApplicationAndVersion ()
187- numChidEntries = self .convert_channel_ids_names (filename )
188- self .setBitToMicroVolt ()
189- self .setInputRanges (numChidEntries )
185+ self ._readProperties (filename , txt_header )
186+ self ._setApplicationAndVersion ()
187+ numChidEntries = self ._convertChannelIdsNames (filename )
188+ self ._setBitToMicroVolt ()
189+ self ._setInputRanges (numChidEntries )
190190 self ._setFilenameProp (txt_header )
191191
192192 if not props_only :
193- self .readTimeDate (txt_header )
193+ self ._setTimeDate (txt_header )
194194
195195 @staticmethod
196196 def get_text_header (filename ):
@@ -202,7 +202,7 @@ def get_text_header(filename):
202202 txt_header = f .read (NlxHeader .HEADER_SIZE )
203203 return txt_header .strip (b"\x00 " ).decode ("latin-1" )
204204
205- def read_properties (self , filename , txt_header ):
205+ def _readProperties (self , filename , txt_header ):
206206 """
207207 Read properties from header and place in OrderedDictionary which this object is.
208208 :param filename: name of ncs file, used for extracting channel number
@@ -222,7 +222,7 @@ def read_properties(self, filename, txt_header):
222222 value = type_ (value )
223223 self [name ] = value
224224
225- def setApplicationAndVersion (self ):
225+ def _setApplicationAndVersion (self ):
226226 """
227227 Set "ApplicationName" property and app_version attribute based on existing properties
228228 """
@@ -251,7 +251,7 @@ def setApplicationAndVersion(self):
251251
252252 self ["ApplicationVersion" ] = Version (app_version )
253253
254- def convert_channel_ids_names (self , filename ):
254+ def _convertChannelIdsNames (self , filename ):
255255 """
256256 Convert channel ids and channel name properties, if present.
257257
@@ -281,7 +281,7 @@ def convert_channel_ids_names(self, filename):
281281
282282 return len (chid_entries )
283283
284- def setBitToMicroVolt (self ):
284+ def _setBitToMicroVolt (self ):
285285 # convert bit_to_microvolt
286286 if "bit_to_microVolt" in self :
287287 btm_entries = re .findall (r"\S+" , self ["bit_to_microVolt" ])
@@ -291,7 +291,7 @@ def setBitToMicroVolt(self):
291291 assert len (self ["bit_to_microVolt" ]) == len ( self ["channel_ids" ]), \
292292 "Number of channel ids does not match bit_to_microVolt conversion factors."
293293
294- def setInputRanges (self , numChidEntries ):
294+ def _setInputRanges (self , numChidEntries ):
295295 if "InputRange" in self :
296296 ir_entries = re .findall (r"\w+" , self ["InputRange" ])
297297 if len (ir_entries ) == 1 :
@@ -313,14 +313,14 @@ def _setFilenameProp(self, txt_header):
313313 # some file types quote the property so strip that also
314314 self ['OriginalFileName' ] = self ['OriginalFileName' ].strip (' "\t \r \n ' )
315315
316- def readTimeDate (self , txt_header ):
316+ def _setTimeDate (self , txt_header ):
317317 """
318318 Read time and date from text of header
319319 """
320320
321321 # opening time
322- sr = NlxHeader .openDatetime1_pat .search (txt_header )
323- if not sr : sr = NlxHeader .openDatetime2_pat .search (txt_header )
322+ sr = NlxHeader ._openDatetime1_pat .search (txt_header )
323+ if not sr : sr = NlxHeader ._openDatetime2_pat .search (txt_header )
324324 if not sr :
325325 raise IOError (
326326 f"No matching header open date/time for application { self ['ApplicationName' ]} " +
@@ -331,8 +331,8 @@ def readTimeDate(self, txt_header):
331331 self ['recording_opened' ] = dateutil .parser .parse (f"{ dt1 ['date' ]} { dt1 ['time' ]} " )
332332
333333 # close time, if available
334- sr = NlxHeader .closeDatetime1_pat .search (txt_header )
335- if not sr : sr = NlxHeader .closeDatetime2_pat .search (txt_header )
334+ sr = NlxHeader ._closeDatetime1_pat .search (txt_header )
335+ if not sr : sr = NlxHeader ._closeDatetime2_pat .search (txt_header )
336336 if sr :
337337 dt2 = sr .groupdict ()
338338 self ['recording_closed' ] = dateutil .parser .parse (f"{ dt2 ['date' ]} { dt2 ['time' ]} " )
0 commit comments