-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
25 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
# Authors: Alexandre Gramfort <[email protected]> | ||
# Matti Hamalainen <[email protected]> | ||
# Teon Brooks <[email protected]> | ||
|
@@ -6,7 +7,7 @@ | |
|
||
from collections import Counter | ||
from copy import deepcopy | ||
from datetime import datetime as dt | ||
import datetime | ||
import os.path as op | ||
import re | ||
|
||
|
@@ -55,6 +56,15 @@ def _summarize_str(st): | |
return st[:56][::-1].split(',', 1)[-1][::-1] + ', ...' | ||
|
||
|
||
def _stamp_to_dt(stamp): | ||
"""Convert timestamp to datetime object in Windows-friendly way.""" | ||
# The min on windows is 86400 | ||
stamp = np.array(stamp, int) # usually comes as int32 | ||
assert stamp.shape == (2,) | ||
return (datetime.datetime.utcfromtimestamp(stamp[0]) + | ||
datetime.timedelta(0, 0, stamp[1])) # day, sec, μs | ||
|
||
|
||
# XXX Eventually this should be de-duplicated with the MNE-MATLAB stuff... | ||
class Info(dict): | ||
"""Measurement information. | ||
|
@@ -398,7 +408,7 @@ def __repr__(self): | |
entr = _summarize_str(entr) | ||
elif k == 'meas_date' and np.iterable(v): | ||
# first entry in meas_date is meaningful | ||
entr = dt.fromtimestamp(v[0]).strftime('%Y-%m-%d %H:%M:%S') | ||
entr = _stamp_to_dt(v).strftime('%Y-%m-%d %H:%M:%S') + ' GMT' | ||
elif k == 'kit_system_id' and v is not None: | ||
from .kit.constants import SYSNAMES as KIT_SYSNAMES | ||
entr = '%i (%s)' % (v, KIT_SYSNAMES.get(v, 'unknown')) | ||
|
@@ -675,7 +685,7 @@ def _write_dig_points(fname, dig_points): | |
if ext == '.txt': | ||
with open(fname, 'wb') as fid: | ||
version = __version__ | ||
now = dt.now().strftime("%I:%M%p on %B %d, %Y") | ||
now = datetime.datetime.now().strftime("%I:%M%p on %B %d, %Y") | ||
fid.write(b("% Ascii 3D points file created by mne-python version " | ||
"{version} at {now}\n".format(version=version, | ||
now=now))) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters