@@ -179,7 +179,7 @@ def __init__(self, sourcefile: Path, _data: dict, options: dict):
179179 super ().__init__ (sourcefile , _data , options )
180180
181181 # Read the log-tables from the Presentation log file
182- self ._sourcetable = pd .read_csv (self .sourcefile , sep = '\t ' , skiprows = options .get ('skiprows' ,3 ), skip_blank_lines = True )
182+ self ._sourcetable = pd .read_csv (self .sourcefile , sep = '\t ' , skiprows = options .get ('skiprows' ,3 ), skip_blank_lines = True ) if self . sourcefile . is_file () else pd . DataFrame ()
183183 """The Presentation log-tables (https://www.neurobs.com/pres_docs/html/03_presentation/07_data_reporting/01_logfiles/index.html)"""
184184 self ._sourcecols = self ._sourcetable .columns
185185 """Store the original column names"""
@@ -188,13 +188,16 @@ def __init__(self, sourcefile: Path, _data: dict, options: dict):
188188 def logtable (self ) -> pd .DataFrame :
189189 """Returns a Presentation log-table"""
190190
191- df = self ._sourcetable
192- nrows = len (df )
191+ df = self ._sourcetable
192+ if not (nrows := len (df )):
193+ return df
194+
195+ # Get the row indices to slice the event, stimulus, video or survey table
193196 stimulus_header = (df .iloc [:, 0 ] == 'Event Type' ).idxmax () or nrows
194197 video_header = (df .iloc [:, 0 ] == 'filename' ).idxmax () or nrows
195198 survey_header = (df .iloc [:, 0 ] == 'Time' ).idxmax () or nrows
196199
197- # Get the row indices to slice the event, stimulus, video or survey table
200+ # Get the first and last row index of the table of interest
198201 df .columns = self ._sourcecols
199202 if self .options ['table' ].lower () == 'event' :
200203 begin = 0
0 commit comments