-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MRG: Extract measurement date and age for NIRX files #7891
Conversation
@larsoner this is failing due to processing of French date strings. Is there any inbuilt multilingual date string parsers in MNE already or do I need to write one? |
HHmmmm my changes also seem to break other things, Ill fix that. But still curious about the best way to process French dates. |
what do you mean French dates? like month with letter with accents? |
Like Travis says:
|
is it fixable by setting the LOCALE properly?
… |
The docs suggest that |
Thanks for the helpful suggestions. The locale is not embedded in the header. I had started writing a list of locales to iterate over, that's when I stopped and decided to ask here before progressing too far. So it sounds like there is no solution in MNE for this already, so I will continue to code along this path. |
Indeed AFAIK we have never had to deal with locale when parsing datetime. We can try adding some other |
here is an example that works:
import locale
from datetime import datetime
locale.setlocale(locale.LC_TIME, "fr_FR")
s = "jeu. 13 fév. 2020""09:08:47.511"
f = "%a. %d %b. %Y""%H:%M:%S.%f"
datetime.strptime(s, f)
however I had to use fév. and févr. which seems to be the standard.
|
Thanks for the code snippet. I came up with something very similar and ran in to the same problem. It's the |
Next Im going to check where this |
I see with company that produces this file how the come up with févr while
it appears the standard across languages is fév
I would use try except here to avoid failing to load such files but I
agree the mne code cannot fix all IO corner cases.
can you see with them how it happens? and maybe how they deal with this
internally?
… |
5f7f842
to
84ea52f
Compare
@rob-luke will you have time to revisit this in the next couple of weeks? I'll optimistically mark for 0.21 |
Yes I would like to cross this off. The milestone has sept 15 marked, that should be achievable |
@larsoner I am not sure what to do here with the non standard French encoding of dates. It seems to me that So if NIRX is providing non standard french date formats, and if I know all the non standard naming, I could create a translation function. But I don't know all the non standard naming and don't have access to a machine at the moment to determine this. Plus this would become quite unwieldy, what other non standard language formats do we then support. Would it be acceptable to try and parse the dates in the current |
yes I fear we need something custom. But I would reach out to
engineers at the company
that produces these files to report the issue.
|
Good idea. But I would like to verify the issue myself first if I am to contact them. Ideally someone could send me some files recorded in France. Failing that, I could set the local of our lab pc to France and record my own file, but Im currently locked out of the lab (at least for the next 3 weeks). So this won't be done by 0.21 release date. I suggest I create an English date PR for 0.21 and raise an issue for the non English dates to be solved when someone sends me some files or I can get in the lab. Acceptable? Or do you prefer I wait and do everything at once? |
acceptable
…On Mon, Sep 7, 2020 at 10:35 AM Robert Luke ***@***.***> wrote:
I would reach out to engineers at the company that produces these files to
report the issue.
Good idea. But I would like to verify the issue myself first if I am to
contact them. Ideally someone could send me some files recorded in France.
Failing that, I could set the local of our lab pc to France and record my
own file, but Im currently locked out of the lab (at least for the next 3
weeks). So this won't be done by 0.21 release date. I suggest I create an
English date PR for 0.21 and raise an issue for the non English dates to be
solved when someone sends me some files or I can get in the lab.
Acceptable? Or do you prefer I wait and do everything at once?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#7891 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABHKHHISNMEPIQE53QCN4DSESLOJANCNFSM4N3636UA>
.
|
3b050e3
to
d5477b2
Compare
fabde0b
to
945c143
Compare
@agramfort @larsoner can you please review. |
Co-authored-by: Alexandre Gramfort <[email protected]>
Co-authored-by: Alexandre Gramfort <[email protected]>
Thanks for the review. @agramfort and @larsoner could you please review again. |
thx @rob-luke |
* upstream/master: (489 commits) MRG, DOC: Fix ICA docstring, add whitening (mne-tools#8227) MRG: Extract measurement date and age for NIRX files (mne-tools#7891) Nihon Kohden EEG file reader WIP (mne-tools#6017) BUG: Fix scaling for src_mri_t in coreg (mne-tools#8223) MRG: Set pyvista as default 3d backend (mne-tools#8220) MRG: Recreate our helmet graphic (mne-tools#8116) [MRG] Adding get_montage for montage to BaseRaw objects (mne-tools#7667) ENH: Allow setting tqdm backend (mne-tools#8177) [MRG, IO] Persyst reader into Raw object (mne-tools#8176) MRG, BUG: Fix errors in IO/loading/projectors (mne-tools#8210) MAINT: vectorize _read_annotations_edf (mne-tools#8214) FIX : events_from_annotation when annotations.orig_time is None and f… (mne-tools#8209) FIX: do not project to sphere; DOC - explain how to get EEGLAB-like topoplots (mne-tools#7455) [MRG, DOC] Added linear algebra of transform to doc (mne-tools#7087) FIX: Travis failure on python3.8.1 (mne-tools#8207) BF: String formatting in exception message (mne-tools#8206) BUG: Fix STC limit bug (mne-tools#8202) MRG, DOC: fix ica tutorial (mne-tools#8175) CSP component order selection (mne-tools#8151) MRG, ENH: Add on_missing to plot_events (mne-tools#8198) ...
* Add meas_date and age to nirx io * Remove unused import * Update mne/io/nirx/nirx.py Co-authored-by: Alexandre Gramfort <[email protected]> * Update mne/io/nirx/nirx.py Co-authored-by: Alexandre Gramfort <[email protected]> * Get date for loop to work * Shorten tests * Dont use the word list * Flake fix Co-authored-by: Alexandre Gramfort <[email protected]>
What does this implement/fix?
Extract measurement date and birthday for NIRX files.
Additional information
The vendor software only allows saving of age as an integer. So I have taken the measurement date, subtracted the age integer from the years, and stored that as the birthday. Open to alternative suggestions.