Conversation
This reverts commit ec80e6c.
…age accelerometer. Here, I natively implement date_parser and imputeMissing.
ghammad
left a comment
There was a problem hiding this comment.
Dear @naja23
thanks a lot for the PR. Wonderfull to see user's involvement in making pyActigraphy better/easier to use.
While you address my comments, I will contact the biobankanalysis (accelerometer) developers to clarify our intentions. At the moment, their code is duplicated in your PR. And, as it has a license, we need to make sure this PR is aligned with their license requirements. However, as these are small modifications (and yet important), I do expect a positive outcome. I will get you posted.
README.rst
Outdated
|
|
||
|
|
||
| **pyActigraphy** | ||
| **pyActigraphy** |
There was a problem hiding this comment.
Is it needed? I do not see any formatting issue on GitHub.com, nor on GitHub.io.
There was a problem hiding this comment.
This is not required. I was just experimenting GitHub desktop functionality. The extra space has been removed.
pyActigraphy/io/bba/bba.py
Outdated
| from accelerometer.utils import date_parser | ||
| from accelerometer.summarisation import imputeMissing | ||
| from pandas.tseries.frequencies import to_offset | ||
| #from accelerometer.utils import date_parser |
There was a problem hiding this comment.
Please remove old imports/commented lines.
pyActigraphy/io/bba/bba.py
Outdated
| # Native implementation of date_parser and imputeMissing | ||
| def date_parser(t): | ||
| """ | ||
| Adapted from the accelerometer package (utils.py) |
There was a problem hiding this comment.
Could you:
- provide a link to the accelerometer package? And the version you used (for future ref)? A tag is fine (for ex: v7.2.1);
- add a description for the function as well as for its input parameters (cf other functions in this class).
There was a problem hiding this comment.
I've provided a link to accelerometer 7.2.1 and the copyright notice as per the license.md. I think our use is covered by paragraph 1.2, which grants licence to "reproduce, modify, transmit (...) for academic, research or other scholarly use.".
pyActigraphy/io/bba/bba.py
Outdated
|
|
||
| def imputeMissing(data, extrapolate=True): | ||
| """ | ||
| Adapted from the accelerometer package (summarisation.py). |
There was a problem hiding this comment.
Could you:
- provide a link to the accelerometer package? And the version you used (for future ref)? A tag is fine (for ex: v7.2.1);
- add a description for the function as well as for its input parameters (cf other functions in this class)
| t = re.sub(r'\[(.*?)\]', '', t) | ||
| return pd.to_datetime(t, utc=True).tz_convert(tz) | ||
|
|
||
| def imputeMissing(data, extrapolate=True): |
There was a problem hiding this comment.
At the moment, this function does not impute missing data but rather pad the data boundaries so that it covers a full day (24h). It misses the fillna function and its application (see https://github.com/OxWearables/biobankAccelerometerAnalysis/blob/ed0caad712a9686deb2bf3a37273c1dedd14beb6/src/accelerometer/summarisation.py#L250).
There was a problem hiding this comment.
I've now included the function fillna.
There was a problem hiding this comment.
@naja23 thanks for adding fillna. However it still misses the rest of the function from (https://github.com/OxWearables/biobankAccelerometerAnalysis/blob/ed0caad712a9686deb2bf3a37273c1dedd14beb6/src/accelerometer/summarisation.py#L264) up to return data.
There was a problem hiding this comment.
I think the function is now completely added! Also, imported numpy as it is required for fillna to work. Thanks for your assistance!
There was a problem hiding this comment.
Thanks for the changes. As mentioned earlier, I started a discussion with the accelerometer package developers. Let see how it goes before moving on the PR.
There was a problem hiding this comment.
FWIW, the accelerometer license is strictly speaking not open source, and including it here conflicts with the GPL license of pyActigraphy.
I wonder if a better solution would be to use importlib to dynamically import accelerometer when needed in bba.py, and to fail with an error message containing installation instructions if the package is not already available. That way you wouldn't need to copy over the code, but could still remove the accelerometer dependency for anyone who doesn't need support for this file type.
Removed old imports/commented lines
…age accelerometer. Here, I natively implement date_parser and imputeMissing. I added a docstring and fillna in imputeMissing.
# Conflicts: # pyActigraphy/io/bba/bba.py
ghammad
left a comment
There was a problem hiding this comment.
Almost there. Thanks for your work.
| t = re.sub(r'\[(.*?)\]', '', t) | ||
| return pd.to_datetime(t, utc=True).tz_convert(tz) | ||
|
|
||
| def imputeMissing(data, extrapolate=True): |
There was a problem hiding this comment.
@naja23 thanks for adding fillna. However it still misses the rest of the function from (https://github.com/OxWearables/biobankAccelerometerAnalysis/blob/ed0caad712a9686deb2bf3a37273c1dedd14beb6/src/accelerometer/summarisation.py#L264) up to return data.
Fixed the dependency conflict generated by the accelerometer package. Instead of importing the
date_parserandimputeMissingfunctions from accelerometer, I natively implemented these functions. Also removed the requirement for accelerometer instalation insetup.py.