-
Notifications
You must be signed in to change notification settings - Fork 9
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
Extract first and last timestamp from input csv data #41
Conversation
start_time = pd.to_datetime(info['StartTime']) | ||
end_time = pd.to_datetime(info['EndTime']) | ||
start_time = pd.to_datetime(data['time'].iloc[0]) | ||
end_time = pd.to_datetime(data['time'].iloc[-1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This always overwrites the start and end time, even for the axivity device. Perhaps this should only be done for csv files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this PR still active?
Also, to avoid using magic numbers, we can name 0, and -1 as start_time_idx
or end_time_idx
.
extract_descriptives <- function(colName, log_transform = TRUE) {
summary_a <- summarise(comparison[[paste0(colName, "_a")]])
summary_m <- summarise(comparison[[paste0(colName, "_m")]])
if (log_transform == TRUE) {
return(data.frame("Axivity AX3" = paste0(format(summary_a$Median, digits=3, scientific=FALSE)," (", format(summary_a$Q1, digits=3, scientific=FALSE), "-", format(summary_a$Q3, digits=3, scientific=FALSE), ")"),
"Matrix 003" = paste0(format(summary_m$Median, digits=3, scientific=FALSE)," (", format(summary_m$Q1, digits=3, scientific=FALSE), "-", format(summary_m$Q3, digits=3, scientific=FALSE), ")")))
}
else {
return(data.frame("Axivity AX3" = paste0(format(summary_a$Mean, digits=3, scientific=FALSE)," (", format(summary_a$SD, digits=3, scientific=FALSE), ")"),
"Matrix 003" = paste0(format(summary_m$Mean, digits=3, scientific=FALSE), " (", format(summary_m$SD, digits=3, scientific=FALSE), ")")))
}
}
outcomes_list <- list("acc-week-avg", "wearTime-overall(days)", "above-25", "above-50", "above-75",
"above-100", "above-125", "above-150", "above-175", "above-200",
"light-hrs", "moderate-vigorous-hrs", "sedentary-hrs", "sleep-hrs")
log_list <- list(T, T, F, F, F, T, T, T, T, T, T, T, F, F)
descriptive_table <- list()
for(i in seq_along(outcomes_list)) {
descriptive_table[[i]] <- extract_descriptives(outcomes_list[[i]], log_list[[i]])
}
#descriptive_table <- do.call(rbind, descriptive_table)
#descriptive_table$colName <- outcomes_list
descriptive_table <- data.frame(descriptive_table)
write.csv(descriptive_table, file = "J:/Projects/Accelerometer_Comparison/Data/bbaa_outcomes_summary.csv", row.names=FALSE)
________________________________
From: Aidan Acquah ***@***.***>
Sent: Wednesday, October 25, 2023 11:06 AM
To: OxWearables/asleep ***@***.***>
Cc: Brocklebank, Laura ***@***.***>; Author ***@***.***>
Subject: Re: [OxWearables/asleep] Extract first and last timestamp from input csv data (PR #41)
⚠ Caution: External sender
@aidanacquah commented on this pull request.
________________________________
In src/asleep/get_sleep.py<#41 (comment)>:
@@ -69,8 +69,8 @@ def get_parsed_data(raw_data_path, info_data_path, resample_hz, args):
data = data.reset_index()
# apply time shift
- start_time = pd.to_datetime(info['StartTime'])
- end_time = pd.to_datetime(info['EndTime'])
+ start_time = pd.to_datetime(data['time'].iloc[0])
+ end_time = pd.to_datetime(data['time'].iloc[-1])
This always overwrites the start and end time, even for the axivity device. Perhaps this should only be done for csv files.
—
Reply to this email directly, view it on GitHub<#41 (review)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AZVCZCCZJHKHJNCOU5PB6GLYBDQDBAVCNFSM6AAAAAA6HI25AKVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTMOJWHA4DSMBUGI>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Closing this PR as the code is better factored in #51 |
Addressing bug found in #40