diff --git a/docs/source/whatsnew/index.rst b/docs/source/whatsnew/index.rst index fbf5e64..02a6064 100644 --- a/docs/source/whatsnew/index.rst +++ b/docs/source/whatsnew/index.rst @@ -4,7 +4,7 @@ Release notes ************* -This is the list of changes to pandas-xyz between each release. For full details, +This is the list of changes to heartandsole between each release. For full details, see the `commit logs `_. Version 0.0 @@ -13,6 +13,7 @@ Version 0.0 .. toctree:: :maxdepth: 2 - v0.0.20 + v0.0.23 + v0.0.22 v0.0.21 - v0.0.22 \ No newline at end of file + v0.0.20 \ No newline at end of file diff --git a/docs/source/whatsnew/v0.0.23.rst b/docs/source/whatsnew/v0.0.23.rst new file mode 100644 index 0000000..b79f637 --- /dev/null +++ b/docs/source/whatsnew/v0.0.23.rst @@ -0,0 +1,14 @@ +.. _whatsnew_0023: + +What's new in 0.0.23 (June 30, 2021) +------------------------------------ + +.. _whatsnew_0023.bug_fixes: + +Bug fixes +~~~~~~~~~ + +- Removed lap/bout inference from :meth:`Activity.from_fit` because it + made file read-in take forever. Will reconsider the approach in the + future. + diff --git a/heartandsole/__init__.py b/heartandsole/__init__.py index dc8c114..7ab2679 100644 --- a/heartandsole/__init__.py +++ b/heartandsole/__init__.py @@ -3,7 +3,7 @@ import heartandsole.api from heartandsole.util import time_from_timestring, timestring_from_time -__version__ = '0.0.22' +__version__ = '0.0.23' # __all__ = [ # 'Activity', # ] diff --git a/heartandsole/core/activity.py b/heartandsole/core/activity.py index 4516e17..066cec8 100644 --- a/heartandsole/core/activity.py +++ b/heartandsole/core/activity.py @@ -351,32 +351,35 @@ def _build_dataframe_from_msg(msg_type): # ------------------------------------------------------------------ # Add 'bout' and 'lap' columns to record DF. + # TODO: Figure out how to make this not take so long. It ruins the + # read-in process for large files. In general, I'll leave off the + # lap/bout feature for all files for now. # If the record timestamp straddles two laps, put it into the # earlier lap. - activity.records['lap'] = [ - activity.laps.index[ - activity.timestamp.laps['start'].le(timestamp_rec) - & activity.timestamp.laps['end'].ge(timestamp_rec) - # laps[f'{TIMESTAMP}_start'].le(timestamp_rec) - # & laps[f'{TIMESTAMP}_end'].ge(timestamp_rec) - ][0] - for timestamp_rec in activity.timestamp.stream - ] - - events = _build_dataframe_from_msg('event') - start_events = events[events['event_type'] == 'start'].reset_index() - pause_events = events[events['event_type'] == 'stop_all'].reset_index() - - # If the record timestamp straddles two bouts, put it into the - # earlier bout. (That should be impossible, but JIC) - activity.records['bout'] = [ - start_events.index[ - start_events['timestamp'].le(timestamp_rec) - & pause_events['timestamp'].ge(timestamp_rec) - ][0] - for timestamp_rec in activity.timestamp.stream - ] + # activity.records['lap'] = [ + # activity.laps.index[ + # activity.timestamp.laps['start'].le(timestamp_rec) + # & activity.timestamp.laps['end'].ge(timestamp_rec) + # # laps[f'{TIMESTAMP}_start'].le(timestamp_rec) + # # & laps[f'{TIMESTAMP}_end'].ge(timestamp_rec) + # ][0] + # for timestamp_rec in activity.timestamp.stream + # ] + + # events = _build_dataframe_from_msg('event') + # start_events = events[events['event_type'] == 'start'].reset_index() + # pause_events = events[events['event_type'] == 'stop_all'].reset_index() + + # # If the record timestamp straddles two bouts, put it into the + # # earlier bout. (That should be impossible, but JIC) + # activity.records['bout'] = [ + # start_events.index[ + # start_events['timestamp'].le(timestamp_rec) + # & pause_events['timestamp'].ge(timestamp_rec) + # ][0] + # for timestamp_rec in activity.timestamp.stream + # ] # ------------------------------------------------------------------ @@ -467,11 +470,10 @@ def from_tcx(cls, file_obj): for tp in reader.trackpoints ]) - # This gives us the RECORDED time during a lap - subtracts paused - # time. At least allows me to identify laps that contain pauses. - records['lap'] = [ - i for i, l in enumerate(reader.laps) for t in l.trackpoints - ] + # TODO: Rethink how I want to use this lap column. + # records['lap'] = [ + # i for i, l in enumerate(reader.laps) for t in l.trackpoints + # ] # Make the lap column into an additional index level. # TODO: Consider if 'time' or 'timestamp' might make a good