Commit 969f44e3 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

BF: FMRIB loader sets timezone (although not taking into account summer time)

parent 7b795f6a
......@@ -10,7 +10,7 @@ which contain data on imaged subjects.
import functools as ft
import datetime
import datetime as dt
import calendar
import pandas as pd
......@@ -50,19 +50,20 @@ def load_FMRIBImaging(infile):
year = int(date[ :4])
month = int(date[4:6])
day = int(date[6:8])
return datetime.date(year, month, day)
return dt.date(year, month, day)
def parse_acq_time(time):
hour = int(time[ :2])
minute = int(time[2:4])
second = int(time[4:6])
micro = int(time[7:])
return datetime.time(hour, minute, second, micro)
return dt.time(hour, minute, second, micro,
dt.timezone(dt.timedelta(0)))
def combine_datetime(date, time):
date = date.to_pydatetime().date()
time = time.to_pydatetime().time()
return datetime.datetime.combine(date, time)
time = time.to_pydatetime().timetz()
return dt.datetime.combine(date, time)
names = ['eid',
'acq_date',
......@@ -82,7 +83,9 @@ def load_FMRIBImaging(infile):
converters=converters,
delim_whitespace=True)
print('origtime', df['acq_time'])
df['acq_time'] = df['acq_date'].combine(df['acq_time'], combine_datetime)
print('combined', df['acq_time'])
df.drop('acq_date', axis=1, inplace=True)
return df
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment