Describe the bug
EDF file that has dummy year/month/day of 0's cannot be read by mne.io.read_raw_edf() and exits with error "month must be in 1..12"
Expected results
I except the code still be able to read the data in the .edf file, and I would suggest that another dummy date is used instead of the 0's in the file, i propose using 1900-01-01.
Current code in mne/io/edf/edf.py:
# Recording ID
meas_id = {}
meas_id['recording_id'] = fid.read(80).decode('latin-1').strip(' \x00')
day, month, year = [int(x) for x in
re.findall(r'(\d+)', fid.read(8).decode())]
hour, minute, sec = [int(x) for x in
re.findall(r'(\d+)', fid.read(8).decode())]
century = 2000 if year < 50 else 1900
Proposal (same as above, only an additional if clause):
# Recording ID
meas_id = {}
meas_id['recording_id'] = fid.read(80).decode('latin-1').strip(' \x00')
day, month, year = [int(x) for x in
re.findall(r'(\d+)', fid.read(8).decode())]
hour, minute, sec = [int(x) for x in
re.findall(r'(\d+)', fid.read(8).decode())]
century = 2000 if year < 50 else 1900
if any([day == 0, month == 0, year == 0]):
year = 1900
month = 1
day = 1
If you think this is a solution you'd accept, I can also do a Pull request, although I am happy to hand it over to someone else too, as it is just a simple if clause add-on.
Best,
Wolfgang
Describe the bug
EDF file that has dummy year/month/day of 0's cannot be read by mne.io.read_raw_edf() and exits with error "month must be in 1..12"
Expected results
I except the code still be able to read the data in the .edf file, and I would suggest that another dummy date is used instead of the 0's in the file, i propose using 1900-01-01.
Current code in mne/io/edf/edf.py:
Proposal (same as above, only an additional if clause):
If you think this is a solution you'd accept, I can also do a Pull request, although I am happy to hand it over to someone else too, as it is just a simple if clause add-on.
Best,
Wolfgang