Browse Source

removed the 'silent' feature from parse_file

xmlparsing
Holger Frey 4 years ago
parent
commit
a9f6c9ab60
  1. 15
      sensospot_data/parser.py

15
sensospot_data/parser.py

@ -68,15 +68,12 @@ def _cleanup_data_columns(data_frame): @@ -68,15 +68,12 @@ def _cleanup_data_columns(data_frame):
return renamed.drop(columns=surplus_columns)
def parse_file(data_file, silent=False):
""" parses one data file and adds metadata to result """
try:
def parse_file(data_file):
""" parses one data file and adds metadata to result
will race a ValueError, if metadata could not be extracted
"""
measurement_info = _extract_measurement_info(Path(data_file))
except ValueError as e:
if silent:
return None
else:
raise e
data_frame = _parse_csv(data_file)
data_frame[META_DATA_WELL_ROW] = measurement_info.row
data_frame[META_DATA_WELL_COLUMN] = measurement_info.column
@ -88,7 +85,7 @@ def parse_multiple_files(file_list): @@ -88,7 +85,7 @@ def parse_multiple_files(file_list):
""" parses a list of file paths to one combined dataframe """
if not file_list:
raise ValueError("Empty file list provided")
collection = (parse_file(path, silent=True) for path in file_list)
collection = (parse_file(path) for path in file_list)
filtered = (frame for frame in collection if frame is not None)
data_frame = next(filtered)
for next_frame in filtered:

Loading…
Cancel
Save