Skip to content
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

General bug fixes #5

Merged
merged 5 commits into from
Nov 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions forest/jasmine/data2mobmat.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ def collapse_data(data, itrvl, accuracylim):
fourth is none
"""
data = data[data.accuracy<accuracylim]
t_start = np.array(data.timestamp)[0]/1000
t_end = np.array(data.timestamp)[-1]/1000
t_start = sorted(np.array(data.timestamp))[0]/1000
t_end = sorted(np.array(data.timestamp))[-1]/1000
avgmat = np.empty([int(np.ceil((t_end-t_start)/itrvl))+2,4])
sys.stdout.write("Collapse data within " + str(itrvl)+" second intervals ..."+'\n')
IDam = 0
Expand Down
4 changes: 2 additions & 2 deletions forest/jasmine/traj2stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ def gps_summaries(traj,tz_str,option):
sys.stdout.write("Calculating the daily summary stats..." + '\n')
time_list = stamp2datetime(traj[0,3],tz_str)
time_list[3]=0; time_list[4]=0; time_list[5]=0
start_stamp = datetime2stamp(time_list,tz_str) + 3600*24
start_stamp = datetime2stamp(time_list,tz_str)
time_list = stamp2datetime(traj[-1,3],tz_str)
time_list[3]=0; time_list[4]=0; time_list[5]=0
end_stamp = datetime2stamp(time_list,tz_str)
end_stamp = datetime2stamp(time_list,tz_str) + 3600*24
## if it starts from 2019-3-8 11 o'clock, then our daily summary starts from 2019-3-9)
h = (end_stamp - start_stamp)/60/60/24
window = 60*60*24
Expand Down
5 changes: 2 additions & 3 deletions forest/poplar/functions/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,12 @@ def log_to_csv(log_dir, level = logging.DEBUG,
'''
try:
# initialize csv
filepath = setup_csv(name = log_name, directory = log_dir,
header = header)
filepath = setup_csv(name=log_name, dirpath=log_dir, header=header)
# configure logging output
logging.basicConfig(format = log_format,
filename = filepath,
level = level, force = True)
# success message
logger.info('Writing log messages to %s.csv...' % log_name)
except:
logger.warning('Unable to write logging messages.')
logger.warning('Unable to write logging messages.')
10 changes: 5 additions & 5 deletions forest/poplar/legacy/common_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def read_data(ID:str, study_folder: str, datastream:str, tz_str: str, time_start
else:
stamp_start1 = identifiers["timestamp"][0]/1000
else:
stamp_start1 = filestamps[0]
stamp_start1 = sorted(filestamps)[0]
## now determine the starting and ending time according to the Docstring
if time_start == None:
stamp_start = stamp_start1
Expand All @@ -119,12 +119,12 @@ def read_data(ID:str, study_folder: str, datastream:str, tz_str: str, time_start
##Last hour: look at all the subject's directories (except survey) and find the latest date for each directory
directories = os.listdir(study_folder + "/" + ID)
directories = list(set(directories)-set(["survey_answers","survey_timings"]))
lastDate = []
all_timestamps = []
for i in directories:
files = os.listdir(study_folder + "/" + ID + "/" + i)
lastDate.append(files[-1])
stamp_end_vec = [filename2stamp(j) for j in lastDate]
stamp_end1 = max(stamp_end_vec)
all_timestamps += [filename2stamp(filename) for filename in files]
ordered_timestamps = sorted([timestamp for timestamp in all_timestamps if timestamp is not None])
stamp_end1 = ordered_timestamps[-1]
if time_end == None:
stamp_end = stamp_end1
else:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

setup(
name = 'forest',
version = '0.1',
version = '0.1.1',
description = '--add description here--',
long_description = readme,
author = 'Onnela Lab',
Expand Down