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

Time detection in g.part5 #52

Merged
merged 4 commits into from
Oct 8, 2017
Merged

Time detection in g.part5 #52

merged 4 commits into from
Oct 8, 2017

Conversation

jhmigueles
Copy link
Collaborator

Hi Vincent!

As I told you, I am active on GGIR again. The past week I found something strange, so maybe it is better if you have a look on this changes before merging them.

When running g.part5 in my computer, it didn't detect the time correctly, I mean, day and night identification had no sense at all, with larger values on mean night accelerations than in day accelerations for some days.

I used debug() to look deeply into the code and I found that when using timebb to find a determined timestamp (when looking for sustained inactivity behaviors and when looking for day and night identification), the timestamp identified did not correspond with the timestamp the code was looking for. I assumed a misfunctioning due to the class of the objects, so I as.character() to change the class of timebb and it seems to work correctly now.

As I said, this was not happening before summer, so it is strange this error, please, confirm that the error is not happening only in my data (for any reason) before to merge these changes.

Cheers,
Jairo

@jhmigueles
Copy link
Collaborator Author

I forgot to mention, changes are marked as #Change 1 and #Change 2 in the text (lines 166 and 296 of the g.part5 code).

@codecov-io
Copy link

codecov-io commented Oct 3, 2017

Codecov Report

Merging #52 into master will increase coverage by 0.05%.
The diff coverage is 73.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #52      +/-   ##
==========================================
+ Coverage   56.62%   56.68%   +0.05%     
==========================================
  Files          53       53              
  Lines        7715     7727      +12     
==========================================
+ Hits         4369     4380      +11     
- Misses       3346     3347       +1
Impacted Files Coverage Δ
R/g.shell.GGIR.R 0% <0%> (ø) ⬆️
R/g.part5.R 89.61% <100%> (+0.2%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f0898ce...936fe37. Read the comment docs.

@jhmigueles
Copy link
Collaborator Author

Sorry Vincent, I removed all the comments in the function in this pull request, I am going to close it and I will send it back to you again without modifying your comments in teh function.

@jhmigueles jhmigueles closed this Oct 3, 2017
@jhmigueles jhmigueles reopened this Oct 3, 2017
@jhmigueles
Copy link
Collaborator Author

Changes in lines 171 and 283 of the code

@vincentvanhees
Copy link
Member

I am not able to reproduce the issue in a GENEActiv file which i reprocessed with the latest version all the way from part1 to part5. Are you doing this too or are you working with part 1 output that was generated with an earlier version of GGIR?

@vincentvanhees
Copy link
Member

vincentvanhees commented Oct 4, 2017

If this is not picked up by our unit tests then we will need to create a test for it to alarm us when this happens in the future. Were you able to observe any patterns in the incorrect timestamps, e.g. where they all midnight or were they all X hours off from the actual time?

@jhmigueles
Copy link
Collaborator Author

This should be the problem, I was using milestone data generated with earlier versions of GGIR. I am thinking in a test, it could be somehing like:
if (timebb[s0] != as.character(timebb[s0])).... Then we run these changes.
Maybe there are more people working with data generated from earlier versions as happened to me, do you think it is worthy to include this test and code? If you think so, I will have it ready today.

@vincentvanhees
Copy link
Member

Hi Jairo, yes feel free to do that. By unit testing I was referring to the testthat part of the package . It tests the package at a function level, e.g. if function A takes X as its input does it produce the expected Y. This requires more work than adding a few lines, because probably we want to write tests that verify whether timestamps from formats around the world are handled correctly. Next, Travis then always checks for every new commit to the repository that those tests pass. It is considered an important part of quality assurance. So, having good tests is critical for this to be meaningful. For now it may be easier to just do what you suggested and add an issue that we need to build more tests for timestamps and GGIR version compatibility.

@jhmigueles
Copy link
Collaborator Author

Great Vincent, I have added the conditional I told you as a provisional solution. I am going to create the issue to add the test about timestamps and I will try to figure how these tests work out, and then I will go for the code for this test.
Thanks for the explanation =)

@vincentvanhees vincentvanhees merged commit 626d3d2 into wadpac:master Oct 8, 2017
m-patterson pushed a commit to m-patterson/GGIR that referenced this pull request May 11, 2020
vincentvanhees added a commit that referenced this pull request Jun 18, 2020
TavoloPerUno pushed a commit to TavoloPerUno/GGIR that referenced this pull request Jul 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants