diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e9ab945..901c2fe 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,4 +6,5 @@ The list of changes to RunPandas between each release can be found below. For full details see the commit logs at https://github.com/corriporai/runpandas. .. include:: docs/source/whatsnew/v0.1.0.txt -.. include:: docs/source/whatsnew/v0.2.0.txt \ No newline at end of file +.. include:: docs/source/whatsnew/v0.2.0.txt +.. include:: docs/source/whatsnew/v0.3.0.txt \ No newline at end of file diff --git a/README.rst b/README.rst index 3ae358e..47f8893 100644 --- a/README.rst +++ b/README.rst @@ -247,9 +247,122 @@ data or the distance ``dist`` data: 4686.31103516 -Let’s play with the data. Let’s show distance vs as an example of what -and how we can create visualizations. In this example, we will use the -built in, matplotlib based plot function. +The ``Activity`` dataframe also contains special properties that +presents some statistics from the workout such as elapsed time, the +moving time and the distance of workout in meters. + +.. code:: ipython3 + + #total time elapsed for the activity + print(activity.ellapsed_time) + #distance of workout in meters + print(activity.distance) + + +.. parsed-literal:: + + 0 days 00:33:11 + 4686.31103516 + + +Occasionally, some observations such as speed, distance and others must +be calculated based on available data in the given activity. In +runpandas there are special accessors (``runpandas.acessors``) that +computes some of these metrics. We will compute the ``speed`` and the +``distance per position`` observations using the latitude and longitude +for each record and calculate the haversine distance in meters and the +speed in meters per second. + +.. code:: ipython3 + + #compute the distance using haversine formula between two consecutive latitude, longitudes observations. + activity['distpos'] = activity.compute.distance() + activity['distpos'].head() + + + + +.. parsed-literal:: + + time + 00:00:00 NaN + 00:00:01 0.333146 + 00:00:06 1.678792 + 00:00:12 11.639901 + 00:00:16 9.183847 + Name: distpos, dtype: float64 + + + +.. code:: ipython3 + + #compute the distance using haversine formula between two consecutive latitude, longitudes observations. + activity['speed'] = activity.compute.speed(from_distances=True) + activity['speed'].head() + + + + +.. parsed-literal:: + + time + 00:00:00 NaN + 00:00:01 0.333146 + 00:00:06 0.335758 + 00:00:12 1.939984 + 00:00:16 2.295962 + Name: speed, dtype: float64 + + + +Sporadically, there will be a large time difference between consecutive +observations in the same workout. This can happen when device is paused +by the athlete or therere proprietary algorithms controlling the +operating sampling rate of the device which can auto-pause when the +device detects no significant change in position. In runpandas there is +an algorithm that will attempt to calculate the moving time based on the +GPS locations, distances, and speed of the activity. + +To compute the moving time, there is a special acessor that detects the +periods of inactivity and returns the ``moving`` series containing all +the observations considered to be stopped. + +.. code:: ipython3 + + activity_only_moving = activity.only_moving() + print(activity_only_moving['moving'].head()) + + +.. parsed-literal:: + + time + 00:00:00 False + 00:00:01 False + 00:00:06 False + 00:00:12 True + 00:00:16 True + Name: moving, dtype: bool + + +Now we can compute the moving time, the time of how long the user were +active. + +.. code:: ipython3 + + activity_only_moving.moving_time + + + + +.. parsed-literal:: + + Timedelta('0 days 00:33:05') + + + +Now, let’s play with the data. Let’s show distance vs as an example of +what and how we can create visualizations. In this example, we will use +the built in, matplotlib based plot function. .. code:: ipython3 diff --git a/docs/source/_version.txt b/docs/source/_version.txt index 22a84b6..50fc8ff 100644 --- a/docs/source/_version.txt +++ b/docs/source/_version.txt @@ -1 +1 @@ -Version: **0.2.0** Date: **January 12, 2021** +Version: **0.2.0 (+18, 23d03a8)** Date: **March 13, 2021** diff --git a/docs/source/conf.py b/docs/source/conf.py index 46e77f9..a9747d4 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -45,7 +45,7 @@ source_parsers = { - '.md': 'recommonmark.parser.CommonMarkParser', + ".md": "recommonmark.parser.CommonMarkParser", } source_suffix = [".rst", ".md", ".ipynb"] @@ -75,7 +75,7 @@ version_file.write(f"Version: **{version}** Date: **{doc_date}**\n") # Default language for syntax highlighting in reST and Markdown cells: -highlight_language = 'none' +highlight_language = "none" language = None @@ -90,7 +90,7 @@ todo_include_todos = True # Don't add .txt suffix to source files: -html_sourcelink_suffix = '' +html_sourcelink_suffix = "" # -- Options for HTML output ------------------------------------------------- @@ -117,6 +117,7 @@ html_logo = "./_static/images/runpandas_banner.png" html_favicon = "./_static/images/favicon.ico" + def setup(app): app.add_css_file("custom.css") # may also be an URL @@ -158,7 +159,6 @@ def setup(app): """ - # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). diff --git a/docs/source/getting_started.rst b/docs/source/getting_started.rst index 30f7c2a..0a9d674 100644 --- a/docs/source/getting_started.rst +++ b/docs/source/getting_started.rst @@ -31,6 +31,7 @@ RunPandas depends on the following packages: - ``pandas`` - ``fitparse`` - ``stravalib`` +- ``haversine`` ^^^^^^^^^^^^^^^^^^^^^ Detailed instructions @@ -45,7 +46,7 @@ What now - If you don’t have Runpandas yet, check :doc:`Installation `. -- If you have never used RunPandas and want to get familiar with it and its core functionality quickly, see our Runpandas book. +- If you have never used RunPandas and want to get familiar with it and its core functionality quickly, see our `Runpandas book `_. - Detailed instructions about how to work with Runpandas, how to read files or perform activity analysis are part of our :doc:`User Guide `. diff --git a/docs/source/reference/acessors.rst b/docs/source/reference/acessors.rst new file mode 100644 index 0000000..a2b7e64 --- /dev/null +++ b/docs/source/reference/acessors.rst @@ -0,0 +1,25 @@ +======== +Acessors +======== +.. currentmodule:: runpandas.types.acessors + + +Special acessors to perform activity transformations or derived observations based on activity data. + +Moving +------ + +.. autosummary:: + :toctree: api/ + + moving._InactivityAssessor + +Metrics +------- + +.. autosummary:: + :toctree: api/ + + metrics.MetricsAcessor + metrics.MetricsAcessor.speed + metrics.MetricsAcessor.distance \ No newline at end of file diff --git a/docs/source/reference/api/runpandas.types.Activity.distance.rst b/docs/source/reference/api/runpandas.types.Activity.distance.rst new file mode 100644 index 0000000..8e6eb63 --- /dev/null +++ b/docs/source/reference/api/runpandas.types.Activity.distance.rst @@ -0,0 +1,6 @@ +runpandas.types.Activity.distance +================================= + +.. currentmodule:: runpandas.types + +.. autoproperty:: Activity.distance \ No newline at end of file diff --git a/docs/source/reference/api/runpandas.types.Activity.ellapsed_time.rst b/docs/source/reference/api/runpandas.types.Activity.ellapsed_time.rst new file mode 100644 index 0000000..703127e --- /dev/null +++ b/docs/source/reference/api/runpandas.types.Activity.ellapsed_time.rst @@ -0,0 +1,6 @@ +runpandas.types.Activity.ellapsed\_time +======================================= + +.. currentmodule:: runpandas.types + +.. autoproperty:: Activity.ellapsed_time \ No newline at end of file diff --git a/docs/source/reference/api/runpandas.types.Activity.from_file.rst b/docs/source/reference/api/runpandas.types.Activity.from_file.rst new file mode 100644 index 0000000..7112158 --- /dev/null +++ b/docs/source/reference/api/runpandas.types.Activity.from_file.rst @@ -0,0 +1,6 @@ +runpandas.types.Activity.from\_file +=================================== + +.. currentmodule:: runpandas.types + +.. automethod:: Activity.from_file \ No newline at end of file diff --git a/docs/source/reference/api/runpandas.types.Activity.moving_time.rst b/docs/source/reference/api/runpandas.types.Activity.moving_time.rst new file mode 100644 index 0000000..7fb67dc --- /dev/null +++ b/docs/source/reference/api/runpandas.types.Activity.moving_time.rst @@ -0,0 +1,6 @@ +runpandas.types.Activity.moving\_time +===================================== + +.. currentmodule:: runpandas.types + +.. autoproperty:: Activity.moving_time \ No newline at end of file diff --git a/docs/source/reference/api/runpandas.types.Activity.rst b/docs/source/reference/api/runpandas.types.Activity.rst new file mode 100644 index 0000000..e77fef0 --- /dev/null +++ b/docs/source/reference/api/runpandas.types.Activity.rst @@ -0,0 +1,236 @@ +runpandas.types.Activity +======================== + +.. currentmodule:: runpandas.types + +.. autoclass:: Activity + + + .. automethod:: __init__ + + + .. rubric:: Methods + + .. autosummary:: + + ~Activity.__init__ + ~Activity.abs + ~Activity.add + ~Activity.add_prefix + ~Activity.add_suffix + ~Activity.agg + ~Activity.aggregate + ~Activity.align + ~Activity.all + ~Activity.any + ~Activity.append + ~Activity.apply + ~Activity.applymap + ~Activity.asfreq + ~Activity.asof + ~Activity.assign + ~Activity.astype + ~Activity.at_time + ~Activity.between_time + ~Activity.bfill + ~Activity.bool + ~Activity.boxplot + ~Activity.clip + ~Activity.combine + ~Activity.combine_first + ~Activity.convert_dtypes + ~Activity.copy + ~Activity.corr + ~Activity.corrwith + ~Activity.count + ~Activity.cov + ~Activity.cummax + ~Activity.cummin + ~Activity.cumprod + ~Activity.cumsum + ~Activity.describe + ~Activity.diff + ~Activity.div + ~Activity.divide + ~Activity.dot + ~Activity.drop + ~Activity.drop_duplicates + ~Activity.droplevel + ~Activity.dropna + ~Activity.duplicated + ~Activity.eq + ~Activity.equals + ~Activity.eval + ~Activity.ewm + ~Activity.expanding + ~Activity.explode + ~Activity.ffill + ~Activity.fillna + ~Activity.filter + ~Activity.first + ~Activity.first_valid_index + ~Activity.floordiv + ~Activity.from_dict + ~Activity.from_file + ~Activity.from_records + ~Activity.ge + ~Activity.get + ~Activity.groupby + ~Activity.gt + ~Activity.head + ~Activity.hist + ~Activity.idxmax + ~Activity.idxmin + ~Activity.infer_objects + ~Activity.info + ~Activity.insert + ~Activity.interpolate + ~Activity.isin + ~Activity.isna + ~Activity.isnull + ~Activity.items + ~Activity.iteritems + ~Activity.iterrows + ~Activity.itertuples + ~Activity.join + ~Activity.keys + ~Activity.kurt + ~Activity.kurtosis + ~Activity.last + ~Activity.last_valid_index + ~Activity.le + ~Activity.lookup + ~Activity.lt + ~Activity.mad + ~Activity.mask + ~Activity.max + ~Activity.mean + ~Activity.median + ~Activity.melt + ~Activity.memory_usage + ~Activity.merge + ~Activity.min + ~Activity.mod + ~Activity.mode + ~Activity.mul + ~Activity.multiply + ~Activity.ne + ~Activity.nlargest + ~Activity.notna + ~Activity.notnull + ~Activity.nsmallest + ~Activity.nunique + ~Activity.pct_change + ~Activity.pipe + ~Activity.pivot + ~Activity.pivot_table + ~Activity.pop + ~Activity.pow + ~Activity.prod + ~Activity.product + ~Activity.quantile + ~Activity.query + ~Activity.radd + ~Activity.rank + ~Activity.rdiv + ~Activity.reindex + ~Activity.reindex_like + ~Activity.rename + ~Activity.rename_axis + ~Activity.reorder_levels + ~Activity.replace + ~Activity.resample + ~Activity.reset_index + ~Activity.rfloordiv + ~Activity.rmod + ~Activity.rmul + ~Activity.rolling + ~Activity.round + ~Activity.rpow + ~Activity.rsub + ~Activity.rtruediv + ~Activity.sample + ~Activity.select_dtypes + ~Activity.sem + ~Activity.set_axis + ~Activity.set_index + ~Activity.set_specs + ~Activity.shift + ~Activity.skew + ~Activity.slice_shift + ~Activity.sort_index + ~Activity.sort_values + ~Activity.squeeze + ~Activity.stack + ~Activity.std + ~Activity.sub + ~Activity.subtract + ~Activity.sum + ~Activity.swapaxes + ~Activity.swaplevel + ~Activity.tail + ~Activity.take + ~Activity.to_clipboard + ~Activity.to_csv + ~Activity.to_dict + ~Activity.to_excel + ~Activity.to_feather + ~Activity.to_gbq + ~Activity.to_hdf + ~Activity.to_html + ~Activity.to_json + ~Activity.to_latex + ~Activity.to_markdown + ~Activity.to_numpy + ~Activity.to_pandas + ~Activity.to_parquet + ~Activity.to_period + ~Activity.to_pickle + ~Activity.to_records + ~Activity.to_sql + ~Activity.to_stata + ~Activity.to_string + ~Activity.to_timestamp + ~Activity.to_xarray + ~Activity.transform + ~Activity.transpose + ~Activity.truediv + ~Activity.truncate + ~Activity.tshift + ~Activity.tz_convert + ~Activity.tz_localize + ~Activity.unstack + ~Activity.update + ~Activity.var + ~Activity.where + ~Activity.xs + + + + + + .. rubric:: Attributes + + .. autosummary:: + + ~Activity.T + ~Activity.at + ~Activity.attrs + ~Activity.axes + ~Activity.columns + ~Activity.distance + ~Activity.dtypes + ~Activity.ellapsed_time + ~Activity.empty + ~Activity.iat + ~Activity.iloc + ~Activity.index + ~Activity.loc + ~Activity.moving_time + ~Activity.ndim + ~Activity.shape + ~Activity.size + ~Activity.style + ~Activity.values + + \ No newline at end of file diff --git a/docs/source/reference/api/runpandas.types.Activity.set_specs.rst b/docs/source/reference/api/runpandas.types.Activity.set_specs.rst new file mode 100644 index 0000000..c589328 --- /dev/null +++ b/docs/source/reference/api/runpandas.types.Activity.set_specs.rst @@ -0,0 +1,6 @@ +runpandas.types.Activity.set\_specs +=================================== + +.. currentmodule:: runpandas.types + +.. automethod:: Activity.set_specs \ No newline at end of file diff --git a/docs/source/reference/api/runpandas.types.Activity.to_pandas.rst b/docs/source/reference/api/runpandas.types.Activity.to_pandas.rst new file mode 100644 index 0000000..f8ca738 --- /dev/null +++ b/docs/source/reference/api/runpandas.types.Activity.to_pandas.rst @@ -0,0 +1,6 @@ +runpandas.types.Activity.to\_pandas +=================================== + +.. currentmodule:: runpandas.types + +.. automethod:: Activity.to_pandas \ No newline at end of file diff --git a/docs/source/reference/api/runpandas.types.acessors.metrics.MetricsAcessor.distance.rst b/docs/source/reference/api/runpandas.types.acessors.metrics.MetricsAcessor.distance.rst new file mode 100644 index 0000000..92c1891 --- /dev/null +++ b/docs/source/reference/api/runpandas.types.acessors.metrics.MetricsAcessor.distance.rst @@ -0,0 +1,6 @@ +runpandas.types.acessors.metrics.MetricsAcessor.distance +======================================================== + +.. currentmodule:: runpandas.types.acessors.metrics + +.. automethod:: MetricsAcessor.distance \ No newline at end of file diff --git a/docs/source/reference/api/runpandas.types.acessors.metrics.MetricsAcessor.rst b/docs/source/reference/api/runpandas.types.acessors.metrics.MetricsAcessor.rst new file mode 100644 index 0000000..eb5700b --- /dev/null +++ b/docs/source/reference/api/runpandas.types.acessors.metrics.MetricsAcessor.rst @@ -0,0 +1,24 @@ +runpandas.types.acessors.metrics.MetricsAcessor +=============================================== + +.. currentmodule:: runpandas.types.acessors.metrics + +.. autoclass:: MetricsAcessor + + + .. automethod:: __init__ + + + .. rubric:: Methods + + .. autosummary:: + + ~MetricsAcessor.__init__ + ~MetricsAcessor.distance + ~MetricsAcessor.speed + + + + + + \ No newline at end of file diff --git a/docs/source/reference/api/runpandas.types.acessors.metrics.MetricsAcessor.speed.rst b/docs/source/reference/api/runpandas.types.acessors.metrics.MetricsAcessor.speed.rst new file mode 100644 index 0000000..3e94cbb --- /dev/null +++ b/docs/source/reference/api/runpandas.types.acessors.metrics.MetricsAcessor.speed.rst @@ -0,0 +1,6 @@ +runpandas.types.acessors.metrics.MetricsAcessor.speed +===================================================== + +.. currentmodule:: runpandas.types.acessors.metrics + +.. automethod:: MetricsAcessor.speed \ No newline at end of file diff --git a/docs/source/reference/api/runpandas.types.acessors.moving._InactivityAssessor.rst b/docs/source/reference/api/runpandas.types.acessors.moving._InactivityAssessor.rst new file mode 100644 index 0000000..efc43c3 --- /dev/null +++ b/docs/source/reference/api/runpandas.types.acessors.moving._InactivityAssessor.rst @@ -0,0 +1,29 @@ +runpandas.types.acessors.moving.\_InactivityAssessor +==================================================== + +.. currentmodule:: runpandas.types.acessors.moving + +.. autoclass:: _InactivityAssessor + + + .. automethod:: __init__ + + + .. rubric:: Methods + + .. autosummary:: + + ~_InactivityAssessor.__init__ + + + + + + .. rubric:: Attributes + + .. autosummary:: + + ~_InactivityAssessor.STOPPED_THRESHOLD + ~_InactivityAssessor.required_columns + + \ No newline at end of file diff --git a/docs/source/reference/columns.rst b/docs/source/reference/columns.rst index 47b5642..7d3b643 100644 --- a/docs/source/reference/columns.rst +++ b/docs/source/reference/columns.rst @@ -17,6 +17,9 @@ provides additional methods related to the measure evaluated. .. autoclass:: Cadence :members: +.. autoclass:: DistancePerPosition + :members: + .. autoclass:: Distance :members: diff --git a/docs/source/reference/frame.rst b/docs/source/reference/frame.rst index 6154805..20f5f96 100644 --- a/docs/source/reference/frame.rst +++ b/docs/source/reference/frame.rst @@ -1,12 +1,43 @@ ===== Frame ===== -.. py:module:: runpandas.types.frame +.. currentmodule:: runpandas.types A ``Activity`` is a tabular data structure that contains a column which contains a ``MeasureSeries`` storing special measures. +Constructor +----------- +.. autosummary:: + :toctree: api/ -.. autoclass:: Activity - :members: \ No newline at end of file + Activity + +Reading and writing files +------------------------- + +.. autosummary:: + :toctree: api/ + + Activity.from_file + +Activity handling +----------------- + +.. autosummary:: + :toctree: api/ + + Activity.set_specs + Activity.to_pandas + + +Special Metrics +---------------- + +.. autosummary:: + :toctree: api/ + + Activity.ellapsed_time + Activity.moving_time + Activity.distance diff --git a/docs/source/reference/reference.rst b/docs/source/reference/reference.rst index d2a5e22..6978db5 100644 --- a/docs/source/reference/reference.rst +++ b/docs/source/reference/reference.rst @@ -10,6 +10,7 @@ Reference Activity MeasureSeries + Acessors Input/output Tools Testing \ No newline at end of file diff --git a/docs/source/user_guide/1-overview.ipynb b/docs/source/user_guide/1-overview.ipynb index c815811..dbd2e3b 100644 --- a/docs/source/user_guide/1-overview.ipynb +++ b/docs/source/user_guide/1-overview.ipynb @@ -39,12 +39,12 @@ ], "cell_type": "code", "metadata": {}, - "execution_count": 2, + "execution_count": 53, "outputs": [] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 54, "metadata": {}, "outputs": [ { @@ -62,7 +62,7 @@ "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
altdisthrlonlat
time
00:00:00178.9426270.00000062.0-79.09318735.951880
00:00:01178.9426270.00000062.0-79.09318435.951880
00:00:06178.9426271.10694762.0-79.09317235.951868
00:00:12177.50061013.00303562.0-79.09322835.951774
00:00:16177.50061022.40502760.0-79.09314135.951732
\n
" }, "metadata": {}, - "execution_count": 3 + "execution_count": 54 } ], "source": [ @@ -88,7 +88,7 @@ ], "cell_type": "code", "metadata": {}, - "execution_count": 4, + "execution_count": 55, "outputs": [ { "output_type": "stream", @@ -108,7 +108,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 56, "metadata": {}, "outputs": [ { @@ -126,7 +126,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 57, "metadata": {}, "outputs": [ { @@ -144,7 +144,151 @@ }, { "source": [ - "Let's play with the data. Let's show distance vs as an example of what and how we can create visualizations. In this example, we will use the built in, matplotlib based plot function." + "The `Activity` dataframe also contains special properties that presents some statistics from the workout such as elapsed time, the moving time and the distance of workout in meters." + ], + "cell_type": "markdown", + "metadata": {} + }, + { + "cell_type": "code", + "execution_count": 58, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "0 days 00:33:11\n4686.31103516\n" + ] + } + ], + "source": [ + "#total time elapsed for the activity\n", + "print(activity.ellapsed_time)\n", + "#distance of workout in meters\n", + "print(activity.distance)" + ] + }, + { + "source": [ + "Occasionally, some observations such as speed, distance and others must be calculated based on available data in the given activity. In runpandas there are special accessors (`runpandas.acessors`) that computes some of these metrics. We will compute the `speed` and the `distance per position` observations using the latitude and longitude for each record and calculate the haversine distance in meters and the speed in meters per second." + ], + "cell_type": "markdown", + "metadata": {} + }, + { + "cell_type": "code", + "execution_count": 59, + "metadata": {}, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "time\n", + "00:00:00 NaN\n", + "00:00:01 0.333146\n", + "00:00:06 1.678792\n", + "00:00:12 11.639901\n", + "00:00:16 9.183847\n", + "Name: distpos, dtype: float64" + ] + }, + "metadata": {}, + "execution_count": 59 + } + ], + "source": [ + "#compute the distance using haversine formula between two consecutive latitude, longitudes observations.\n", + "activity['distpos'] = activity.compute.distance()\n", + "activity['distpos'].head()" + ] + }, + { + "cell_type": "code", + "execution_count": 60, + "metadata": {}, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "time\n", + "00:00:00 NaN\n", + "00:00:01 0.333146\n", + "00:00:06 0.335758\n", + "00:00:12 1.939984\n", + "00:00:16 2.295962\n", + "Name: speed, dtype: float64" + ] + }, + "metadata": {}, + "execution_count": 60 + } + ], + "source": [ + "#compute the distance using haversine formula between two consecutive latitude, longitudes observations.\n", + "activity['speed'] = activity.compute.speed(from_distances=True)\n", + "activity['speed'].head()" + ] + }, + { + "source": [ + "Sporadically, there will be a large time difference between consecutive observations in the same workout. This can happen when device is paused by the athlete or therere proprietary algorithms controlling the operating sampling rate of the device which can auto-pause when the device detects no significant change in position. In runpandas there is an algorithm that will attempt to calculate the moving time based on the GPS locations, distances, and speed of the activity.\n", + "\n", + "To compute the moving time, there is a special acessor that detects the periods of inactivity and returns the `moving` series containing all the observations considered to be stopped." + ], + "cell_type": "markdown", + "metadata": {} + }, + { + "cell_type": "code", + "execution_count": 61, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "time\n00:00:00 False\n00:00:01 False\n00:00:06 False\n00:00:12 True\n00:00:16 True\nName: moving, dtype: bool\n" + ] + } + ], + "source": [ + "activity_only_moving = activity.only_moving()\n", + "print(activity_only_moving['moving'].head())" + ] + }, + { + "source": [ + "Now we can compute the moving time, the time of how long the user were active." + ], + "cell_type": "markdown", + "metadata": {} + }, + { + "cell_type": "code", + "execution_count": 62, + "metadata": {}, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "Timedelta('0 days 00:33:05')" + ] + }, + "metadata": {}, + "execution_count": 62 + } + ], + "source": [ + "activity_only_moving.moving_time" + ] + }, + { + "source": [ + "Now let's play with the data. Let's show distance vs as an example of what and how we can create visualizations. In this example, we will use the built in, matplotlib based plot function." ], "cell_type": "markdown", "metadata": {} diff --git a/docs/source/user_guide/sample.tcx b/docs/source/user_guide/sample.tcx new file mode 100644 index 0000000..1f6e6b6 --- /dev/null +++ b/docs/source/user_guide/sample.tcx @@ -0,0 +1,4664 @@ + + + + + 2012-12-26T21:29:53Z + Aerobics + + 608.47 + 1609.34399414 + 4.55431461334 + 94 + + 139 + + + 189 + + Active + Distance + + + + + 35.951880198 + -79.0931872185 + + 178.942626953 + 0.0 + + 62 + + + + + + 35.9518799465 + -79.0931835305 + + 178.942626953 + 0.0 + + 62 + + + + + + 35.9518683795 + -79.0931715444 + + 178.942626953 + 1.10694694519 + + 62 + + + + + + 35.9517742507 + -79.0932281222 + + 177.500610352 + 13.0030345917 + + 62 + + + + + + 35.9517316706 + -79.093140699 + + 177.500610352 + 22.4050273895 + + 60 + + + + + + 35.9516439959 + -79.0930489171 + + 177.020019531 + 35.4864768982 + + 60 + + + + + + 35.9515785333 + -79.093025364 + + 177.020019531 + 43.0341339111 + + 60 + + + + + + 35.9514944628 + -79.0930169821 + + 178.942626953 + 52.1157264709 + + 66 + + + + + + 35.9514806326 + -79.0930159763 + + 180.384521484 + 53.4306144714 + + 66 + + + + + + 35.9514193609 + -79.0930297226 + + 183.268432617 + 60.2679176331 + + 66 + + + + + + 35.9513524733 + -79.0930800978 + + 186.633178711 + 68.855758667 + + 66 + + + + + + 35.9512741864 + -79.0931214206 + + 189.516967773 + 78.272277832 + + 66 + + + + + + 35.9511984978 + -79.0931658447 + + 191.439575195 + 87.5295791626 + + 64 + + + + + + 35.9511574265 + -79.0931872185 + + 192.401123047 + 92.4439620972 + + 64 + + + + + + 35.951087689 + -79.0932442993 + + 193.362304688 + 102.020233154 + + 64 + + + + + + 35.9511046205 + -79.0933230892 + + 195.284912109 + 109.554237366 + + 64 + + + + + + 35.9512161836 + -79.093485279 + + 200.572265625 + 128.55229187 + + 66 + + + + + + 35.9512741864 + -79.0936174616 + + 204.417480469 + 142.000793457 + + 66 + + + + + + 35.9513306804 + -79.0938178729 + + 207.782104492 + 161.075332642 + + 66 + + + + + + 35.9513333626 + -79.0938478801 + + 208.262817383 + 163.790664673 + + 77 + + + + + + 35.9513348714 + -79.0938755404 + + 208.743408203 + 166.276397705 + + 88 + + + + + + 35.9513393976 + -79.0939047933 + + 209.224121094 + 168.961791992 + + 88 + + + + + + 35.9513446782 + -79.0940482914 + + 210.666015625 + 181.881225586 + + 88 + + + + + + 35.9513310995 + -79.0941887721 + + 211.627441406 + 194.676605225 + + 88 + + + + + + 35.9512767848 + -79.0943576675 + + 214.511230469 + 211.067687988 + + 88 + + + + + + 35.9512559976 + -79.0944915265 + + 215.95324707 + 223.350784302 + + 88 + + + + + + 35.9512602724 + -79.0945884213 + + 209.704833984 + 231.113525391 + + 86 + + + + + + 35.9511930496 + -79.0948230308 + + 195.765625 + 252.487915039 + + 86 + + + + + + 35.9510857612 + -79.0949874837 + + 185.191162109 + 271.481201172 + + 90 + + + + + + 35.9510190412 + -79.0950584784 + + 183.268432617 + 281.252868652 + + 92 + + + + + + 35.9508989286 + -79.0951691195 + + 180.384521484 + 297.95300293 + + 92 + + + + + + 35.950788958 + -79.0952413715 + + 178.461914062 + 311.785522461 + + 92 + + + + + + 35.9506573621 + -79.0953007992 + + 177.020019531 + 327.343292236 + + 92 + + + + + + 35.9506119322 + -79.0953134559 + + 176.539306641 + 332.497894287 + + 87 + + + + + + 35.9505901393 + -79.0953215864 + + 176.539306641 + 335.001953125 + + 87 + + + + + + 35.9504771512 + -79.095343966 + + 176.539306641 + 347.701599121 + + 85 + + + + + + 35.9503575414 + -79.095350923 + + 177.020019531 + 361.042114258 + + 84 + + + + + + 35.9502281249 + -79.0953359194 + + 177.500610352 + 375.435913086 + + 84 + + + + + + 35.9501799289 + -79.0953376796 + + 177.981201172 + 380.723388672 + + 84 + + + + + + 35.9500607383 + -79.0953411162 + + 178.942626953 + 393.895477295 + + 84 + + + + + + 35.9499874804 + -79.0953392722 + + 178.942626953 + 401.996826172 + + 84 + + + + + + 35.9499093611 + -79.0953390207 + + 179.903808594 + 410.653503418 + + 96 + + + + + + 35.9498892445 + -79.0953395236 + + 179.423217773 + 412.870513916 + + 96 + + + + + + 35.9497757535 + -79.0953451395 + + 179.903808594 + 425.468017578 + + 96 + + + + + + 35.9496734943 + -79.0953471512 + + 180.384521484 + 436.787567139 + + 96 + + + + + + 35.9495364502 + -79.0953554492 + + 180.384521484 + 452.031341553 + + 96 + + + + + + 35.9493915271 + -79.0953729674 + + 179.903808594 + 468.121765137 + + 96 + + + + + + 35.9493471868 + -79.0954813454 + + 180.384521484 + 479.736236572 + + 96 + + + + + + 35.9493471868 + -79.0955083352 + + 180.384521484 + 482.168945312 + + 94 + + + + + + 35.9493388887 + -79.0956755541 + + 178.461914062 + 497.255981445 + + 94 + + + + + + 35.94933738 + -79.0958243329 + + 177.500610352 + 510.666381836 + + 94 + + + + + + 35.9493441693 + -79.0959560964 + + 176.05859375 + 522.558044434 + + 94 + + + + + + 35.9493459295 + -79.0960941464 + + 175.577880859 + 535.015808105 + + 94 + + + + + + 35.9493447561 + -79.0962486248 + + 174.616577148 + 548.949707031 + + 94 + + + + + + 35.9493496176 + -79.0963331982 + + 174.616577148 + 556.61529541 + + 109 + + + + + + 35.9493510425 + -79.0963617805 + + 174.616577148 + 559.185852051 + + 122 + + + + + + 35.9493505396 + -79.0964164305 + + 174.135864258 + 564.108520508 + + 131 + + + + + + 35.9493510425 + -79.0964416601 + + 174.135864258 + 566.370544434 + + 138 + + + + + + 35.9493475221 + -79.0964646265 + + 173.655273438 + 568.473571777 + + 147 + + + + + + 35.9493454266 + -79.0965476912 + + 172.693969727 + 575.963867188 + + 154 + + + + + + 35.9493448399 + -79.0965768602 + + 172.693969727 + 578.567443848 + + 154 + + + + + + 35.9493434988 + -79.0968096256 + + 170.771362305 + 599.567810059 + + 158 + + + + + + 35.9493450914 + -79.0969949495 + + 170.290649414 + 616.323303223 + + 158 + + + + + + 35.9492988233 + -79.0971626714 + + 169.329467773 + 632.485046387 + + 157 + + + + + + 35.9492815565 + -79.0971812792 + + 169.810058594 + 634.976379395 + + 157 + + + + + + 35.9491758607 + -79.097170718 + + 169.329467773 + 646.964599609 + + 157 + + + + + + 35.9490874317 + -79.0971355978 + + 170.771362305 + 657.264221191 + + 157 + + + + + + 35.9489747789 + -79.0970742423 + + 171.252075195 + 670.934997559 + + 158 + + + + + + 35.948828347 + -79.09700769 + + 171.252075195 + 688.261657715 + + 160 + + + + + + 35.9488088172 + -79.0970057622 + + 171.252075195 + 690.38482666 + + 160 + + + + + + 35.9487077314 + -79.0969763417 + + 171.732666016 + 701.903137207 + + 160 + + + + + + 35.9486599546 + -79.0969626792 + + 171.732666016 + 707.352111816 + + 150 + + + + + + 35.9486345574 + -79.0969572309 + + 172.213256836 + 710.20690918 + + 150 + + + + + + 35.9484799951 + -79.0969289839 + + 172.693969727 + 727.542053223 + + 157 + + + + + + 35.9484331403 + -79.0969233681 + + 172.693969727 + 732.740234375 + + 163 + + + + + + 35.9483327251 + -79.0969283972 + + 174.135864258 + 743.838928223 + + 166 + + + + + + 35.9482047334 + -79.0969168302 + + 176.05859375 + 758.167785645 + + 167 + + + + + + 35.9481537715 + -79.0968136489 + + 176.05859375 + 769.706604004 + + 167 + + + + + + 35.9481417853 + -79.0966770239 + + 176.05859375 + 782.055541992 + + 167 + + + + + + 35.948142875 + -79.0965657961 + + 175.577880859 + 792.138183594 + + 167 + + + + + + 35.9481376782 + -79.096456999 + + 174.616577148 + 801.955383301 + + 166 + + + + + + 35.9481197409 + -79.0963219665 + + 173.655273438 + 814.302368164 + + 167 + + + + + + 35.9481203277 + -79.0961798932 + + 175.577880859 + 827.078186035 + + 168 + + + + + + 35.9481063299 + -79.0960063878 + + 176.05859375 + 842.742004395 + + 168 + + + + + + 35.9481097665 + -79.0958933998 + + 176.05859375 + 852.871276855 + + 168 + + + + + + 35.9481053241 + -79.0958036296 + + 176.05859375 + 860.969238281 + + 169 + + + + + + 35.9480941761 + -79.0956368297 + + 175.097290039 + 876.056213379 + + 171 + + + + + + 35.9480899852 + -79.0954985283 + + 175.577880859 + 888.556274414 + + 173 + + + + + + 35.9480904881 + -79.0953529347 + + 176.539306641 + 901.656311035 + + 174 + + + + + + 35.9480722994 + -79.0951691195 + + 177.020019531 + 918.237365723 + + 176 + + + + + + 35.9480577987 + -79.0950050857 + + 177.020019531 + 933.038696289 + + 176 + + + + + + 35.9480427951 + -79.0948293172 + + 177.500610352 + 948.878417969 + + 178 + + + + + + 35.9480410349 + -79.094667295 + + 177.981201172 + 963.382141113 + + 178 + + + + + + 35.9480528533 + -79.0945023391 + + 177.981201172 + 978.261047363 + + 178 + + + + + + 35.9480609 + -79.0943239722 + + 177.500610352 + 994.259155273 + + 179 + + + + + + 35.9480985347 + -79.0942087211 + + 177.981201172 + 1005.62841797 + + 179 + + + + + + 35.9481417853 + -79.0940661449 + + 178.461914062 + 1019.34686279 + + 179 + + + + + + 35.9481854551 + -79.0939437691 + + 178.461914062 + 1031.32275391 + + 179 + + + + + + 35.9482464753 + -79.0938107483 + + 178.942626953 + 1045.18029785 + + 178 + + + + + + 35.948318895 + -79.0936575271 + + 179.903808594 + 1061.24230957 + + 177 + + + + + + 35.9483959246 + -79.0935395937 + + 178.942626953 + 1074.77709961 + + 174 + + + + + + 35.9484999441 + -79.0934132785 + + 178.461914062 + 1090.98339844 + + 170 + + + + + + 35.9486128483 + -79.0933029726 + + 177.981201172 + 1106.96850586 + + 166 + + + + + + 35.9487382416 + -79.0931943431 + + 177.020019531 + 1123.97351074 + + 162 + + + + + + 35.9488563426 + -79.0930951852 + + 175.577880859 + 1139.82897949 + + 162 + + + + + + 35.9489877708 + -79.09297348 + + 175.097290039 + 1158.0847168 + + 163 + + + + + + 35.9491066262 + -79.0928597376 + + 174.135864258 + 1174.78283691 + + 162 + + + + + + 35.9492371324 + -79.0927397925 + + 173.174682617 + 1192.84204102 + + 161 + + + + + + 35.9494342748 + -79.092566371 + + 171.252075195 + 1219.74279785 + + 160 + + + + + + 35.9496190958 + -79.0923946258 + + 169.810058594 + 1245.47424316 + + 163 + + + + + + 35.9497424774 + -79.092285661 + + 169.329467773 + 1262.26904297 + + 164 + + + + + + 35.9499708842 + -79.0920699947 + + 167.406738281 + 1294.2557373 + + 166 + + + + + + 35.950034922 + -79.0920062922 + + 166.926025391 + 1303.36645508 + + 166 + + + + + + 35.950144222 + -79.0919443499 + + 166.926025391 + 1316.74584961 + + 172 + + + + + + 35.9503139555 + -79.0919084754 + + 167.406738281 + 1335.98461914 + + 176 + + + + + + 35.95034522 + -79.0919062961 + + 167.406738281 + 1339.4486084 + + 178 + + + + + + 35.950578237 + -79.091973938 + + 167.887329102 + 1366.2298584 + + 181 + + + + + + 35.9507220704 + -79.0921208728 + + 168.368041992 + 1387.17810059 + + 183 + + + + + + 35.9508233238 + -79.0923119802 + + 167.887329102 + 1407.80737305 + + 184 + + + + + + 35.9509136807 + -79.0925208572 + + 166.926025391 + 1429.13476562 + + 186 + + + + + + 35.9510327876 + -79.0928015672 + + 167.887329102 + 1457.68200684 + + 188 + + + + + + 35.9510908742 + -79.0929713845 + + 168.848754883 + 1474.29724121 + + 189 + + + + + + 35.9511841647 + -79.0932075866 + + 171.732666016 + 1497.90441895 + + 189 + + + + + + 35.9512478672 + -79.0933781583 + + 173.174682617 + 1514.77087402 + + 189 + + + + + + 35.9513118211 + -79.0935289487 + + 173.174682617 + 1530.13806152 + + 189 + + + + + + 35.9513610229 + -79.0936646517 + + 172.693969727 + 1543.49047852 + + 188 + + + + + + 35.9513883479 + -79.0938394982 + + 172.213256836 + 1559.546875 + + 185 + + + + + + 35.9514086321 + -79.0940361377 + + 171.732666016 + 1577.41662598 + + 183 + + + + + + 35.9513902757 + -79.0942632873 + + 170.290649414 + 1598.19360352 + + 181 + + + + + + 714.80 + 1609.34399414 + 3.37253928185 + 151 + + 172 + + + 188 + + Active + Distance + + + + + 35.9513659682 + -79.0943981521 + + 171.252075195 + 1610.53759766 + + 179 + + + + + + 35.9513487853 + -79.0944958851 + + 172.213256836 + 1619.52832031 + + 179 + + + + + + 35.9513130784 + -79.0946195181 + + 173.174682617 + 1631.33874512 + + 179 + + + + + + 35.951300757 + -79.0946750902 + + 173.655273438 + 1636.52868652 + + 178 + + + + + + 35.9512023535 + -79.0948203485 + + 173.174682617 + 1653.61523438 + + 177 + + + + + + 35.9511308558 + -79.0949148964 + + 173.174682617 + 1665.33032227 + + 177 + + + + + + 35.9510825761 + -79.0949673671 + + 173.174682617 + 1672.46569824 + + 177 + + + + + + 35.9509772994 + -79.0950782597 + + 173.655273438 + 1687.95727539 + + 176 + + + + + + 35.9508869424 + -79.0951492544 + + 174.616577148 + 1699.84118652 + + 175 + + + + + + 35.9507800732 + -79.0952032339 + + 174.135864258 + 1712.57897949 + + 175 + + + + + + 35.950688459 + -79.095230056 + + 173.655273438 + 1723.15649414 + + 176 + + + + + + 35.9505535942 + -79.0952688642 + + 174.135864258 + 1738.40576172 + + 176 + + + + + + 35.9504150413 + -79.0952797607 + + 175.577880859 + 1753.79406738 + + 177 + + + + + + 35.9502921626 + -79.0952718817 + + 175.577880859 + 1767.55224609 + + 178 + + + + + + 35.9501525201 + -79.0952660982 + + 175.577880859 + 1782.96362305 + + 178 + + + + + + 35.9500421304 + -79.0952647571 + + 177.020019531 + 1795.21606445 + + 178 + + + + + + 35.9500212595 + -79.095264338 + + 177.500610352 + 1797.53015137 + + 178 + + + + + + 35.9498944413 + -79.0952739771 + + 177.981201172 + 1811.71435547 + + 179 + + + + + + 35.9497948643 + -79.0952705406 + + 177.500610352 + 1822.76184082 + + 179 + + + + + + 35.9496927727 + -79.0952781681 + + 177.020019531 + 1834.11401367 + + 178 + + + + + + 35.9495775215 + -79.0952889808 + + 177.981201172 + 1846.89868164 + + 179 + + + + + + 35.9495028388 + -79.095291663 + + 178.942626953 + 1855.17578125 + + 180 + + + + + + 35.9494034294 + -79.0953681897 + + 176.539306641 + 1868.66784668 + + 180 + + + + + + 35.9493968915 + -79.0954669286 + + 175.097290039 + 1877.54431152 + + 181 + + + + + + 35.9493847378 + -79.0955998655 + + 171.252075195 + 1889.55175781 + + 182 + + + + + + 35.9493779484 + -79.0957428608 + + 169.329467773 + 1902.43127441 + + 183 + + + + + + 35.9493655432 + -79.0959244967 + + 168.368041992 + 1918.84350586 + + 180 + + + + + + 35.9493684769 + -79.0961412527 + + 165.484130859 + 1938.36108398 + + 179 + + + + + + 35.9493710753 + -79.0963396523 + + 164.042114258 + 1956.27856445 + + 176 + + + + + + 35.9493615199 + -79.0965225454 + + 162.600097656 + 1972.80688477 + + 173 + + + + + + 35.9493582509 + -79.0967002418 + + 161.158203125 + 1988.7890625 + + 173 + + + + + + 35.9493578319 + -79.0969065204 + + 159.716186523 + 2007.41296387 + + 171 + + + + + + 35.949314665 + -79.0970974602 + + 159.235473633 + 2025.47888184 + + 171 + + + + + + 35.9492963925 + -79.0971247852 + + 159.235473633 + 2028.66320801 + + 171 + + + + + + 35.9491836559 + -79.0971231926 + + 159.235473633 + 2041.80053711 + + 171 + + + + + + 35.9491406567 + -79.0971060935 + + 158.754760742 + 2046.79785156 + + 171 + + + + + + 35.9490363859 + -79.0970669501 + + 158.274169922 + 2058.90234375 + + 173 + + + + + + 35.9489162732 + -79.0970326681 + + 157.793579102 + 2072.56469727 + + 173 + + + + + + 35.9487923887 + -79.0970031638 + + 157.793579102 + 2086.55957031 + + 174 + + + + + + 35.9486932307 + -79.0969770961 + + 158.274169922 + 2097.73510742 + + 174 + + + + + + 35.9485668316 + -79.0969501901 + + 158.754760742 + 2111.92358398 + + 176 + + + + + + 35.9484157898 + -79.0969344322 + + 160.677490234 + 2128.765625 + + 178 + + + + + + 35.9482862893 + -79.0969167463 + + 162.119506836 + 2143.16967773 + + 179 + + + + + + 35.9481941722 + -79.0969067719 + + 162.119506836 + 2153.44580078 + + 179 + + + + + + 35.9481369238 + -79.0967749245 + + 162.119506836 + 2167.40429688 + + 179 + + + + + + 35.9481339902 + -79.0967493597 + + 162.119506836 + 2169.72729492 + + 179 + + + + + + 35.9481265303 + -79.0965768602 + + 163.080810547 + 2185.40258789 + + 181 + + + + + + 35.9481121972 + -79.0964399837 + + 162.119506836 + 2197.80834961 + + 182 + + + + + + 35.9481013846 + -79.096318027 + + 162.119506836 + 2208.85546875 + + 182 + + + + + + 35.9480924997 + -79.0961771272 + + 161.638916016 + 2221.62426758 + + 183 + + + + + + 35.9480942599 + -79.0960227326 + + 163.080810547 + 2235.52514648 + + 184 + + + + + + 35.948088225 + -79.0959208924 + + 163.080810547 + 2244.68847656 + + 184 + + + + + + 35.9480780829 + -79.0957606304 + + 165.003417969 + 2259.24047852 + + 186 + + + + + + 35.9480675217 + -79.0956427809 + + 165.003417969 + 2269.91064453 + + 186 + + + + + + 35.9480668511 + -79.0955092572 + + 165.96472168 + 2281.953125 + + 186 + + + + + + 35.9480609 + -79.0953520965 + + 166.926025391 + 2296.16186523 + + 175 + + + + + + 35.9480610676 + -79.0953304712 + + 166.926025391 + 2298.10058594 + + 175 + + + + + + 35.9480597265 + -79.0952618234 + + 167.406738281 + 2304.28930664 + + 180 + + + + + + 35.9480537754 + -79.0951335803 + + 168.368041992 + 2315.87670898 + + 180 + + + + + + 35.9480498359 + -79.0949988831 + + 169.329467773 + 2328.05810547 + + 180 + + + + + + 35.9480420407 + -79.094866449 + + 169.329467773 + 2339.97509766 + + 185 + + + + + + 35.948046064 + -79.0947120544 + + 169.810058594 + 2353.90893555 + + 185 + + + + + + 35.9480431303 + -79.0945778601 + + 170.290649414 + 2365.99145508 + + 186 + + + + + + 35.9480452258 + -79.0943447594 + + 170.771362305 + 2386.98779297 + + 186 + + + + + + 35.948053021 + -79.0942724235 + + 171.252075195 + 2393.57495117 + + 187 + + + + + + 35.9480971936 + -79.0941612795 + + 172.213256836 + 2404.68188477 + + 188 + + + + + + 35.9481156338 + -79.0940786339 + + 172.213256836 + 2412.4128418 + + 188 + + + + + + 35.9481749777 + -79.0939300228 + + 173.174682617 + 2427.31787109 + + 188 + + + + + + 35.9482332319 + -79.0937846806 + + 173.174682617 + 2441.84008789 + + 188 + + + + + + 35.9482879657 + -79.0936544258 + + 172.213256836 + 2455.09863281 + + 185 + + + + + + 35.9483303782 + -79.0935954172 + + 172.213256836 + 2462.16601562 + + 184 + + + + + + 35.9484131914 + -79.0934832674 + + 172.213256836 + 2475.86962891 + + 182 + + + + + + 35.9485037997 + -79.0933622327 + + 172.213256836 + 2490.67553711 + + 180 + + + + + + 35.9485971741 + -79.0932673495 + + 171.732666016 + 2504.09082031 + + 178 + + + + + + 35.9487109166 + -79.0931684431 + + 171.732666016 + 2519.5090332 + + 173 + + + + + + 35.9488136787 + -79.0930833668 + + 170.290649414 + 2533.23168945 + + 171 + + + + + + 35.9488889482 + -79.0930155572 + + 168.848754883 + 2543.55883789 + + 167 + + + + + + 35.9489738569 + -79.0929411259 + + 167.887329102 + 2555.10888672 + + 166 + + + + + + 35.9490718413 + -79.0928530321 + + 167.406738281 + 2568.57666016 + + 165 + + + + + + 35.949184997 + -79.0927500185 + + 166.4453125 + 2584.16430664 + + 163 + + + + + + 35.9493338596 + -79.0926196799 + + 165.96472168 + 2604.45947266 + + 161 + + + + + + 35.9494974744 + -79.0924744215 + + 165.003417969 + 2626.77929688 + + 161 + + + + + + 35.9495898429 + -79.0923928656 + + 165.003417969 + 2639.36669922 + + 160 + + + + + + 35.9496854804 + -79.0923113935 + + 165.003417969 + 2652.27026367 + + 162 + + + + + + 35.9497947805 + -79.0922188573 + + 164.522705078 + 2666.94848633 + + 162 + + + + + + 35.9499104507 + -79.0921191964 + + 164.522705078 + 2682.62963867 + + 161 + + + + + + 35.9500183258 + -79.0920237266 + + 162.600097656 + 2697.32470703 + + 160 + + + + + + 35.9501217585 + -79.0919507202 + + 163.080810547 + 2710.63916016 + + 157 + + + + + + 35.9502362553 + -79.0919113252 + + 163.561523438 + 2723.84472656 + + 159 + + + + + + 35.9503487404 + -79.0918953996 + + 165.003417969 + 2736.41674805 + + 160 + + + + + + 35.9504643269 + -79.0919151809 + + 165.003417969 + 2749.43188477 + + 160 + + + + + + 35.9505349863 + -79.0919446852 + + 166.926025391 + 2757.69628906 + + 160 + + + + + + 35.950656943 + -79.0920244809 + + 168.848754883 + 2773.0625 + + 163 + + + + + + 35.950750066 + -79.0921300929 + + 169.329467773 + 2787.19116211 + + 164 + + + + + + 35.9508286882 + -79.0922781173 + + 167.887329102 + 2803.16357422 + + 164 + + + + + + 35.950871855 + -79.0923816338 + + 167.887329102 + 2813.6237793 + + 163 + + + + + + 35.9509170335 + -79.0925111342 + + 167.406738281 + 2826.33496094 + + 163 + + + + + + 35.9509698395 + -79.0926337615 + + 166.926025391 + 2838.81811523 + + 162 + + + + + + 35.9510159399 + -79.0927403793 + + 166.4453125 + 2849.6940918 + + 163 + + + + + + 35.9510580171 + -79.0928256232 + + 165.484130859 + 2858.67724609 + + 165 + + + + + + 35.9511075541 + -79.0929575544 + + 163.561523438 + 2871.76977539 + + 164 + + + + + + 35.9511644673 + -79.0930750687 + + 163.080810547 + 2884.01220703 + + 164 + + + + + + 35.9512126632 + -79.0932086762 + + 163.080810547 + 2897.17431641 + + 163 + + + + + + 35.9512604401 + -79.0933410265 + + 164.042114258 + 2910.12866211 + + 161 + + + + + + 35.9513406549 + -79.0935348999 + + 164.042114258 + 2929.63964844 + + 161 + + + + + + 35.9513744339 + -79.0937063936 + + 164.522705078 + 2945.58276367 + + 161 + + + + + + 35.9513918683 + -79.0938611235 + + 164.042114258 + 2959.59912109 + + 159 + + + + + + 35.9514040221 + -79.0939976647 + + 165.003417969 + 2971.96069336 + + 159 + + + + + + 35.9513895214 + -79.0942151751 + + 165.003417969 + 2991.65527344 + + 158 + + + + + + 35.9513431694 + -79.0944247227 + + 165.96472168 + 3011.23730469 + + 158 + + + + + + 35.9512858372 + -79.0946091246 + + 166.4453125 + 3029.0168457 + + 159 + + + + + + 35.9512355458 + -79.0946873277 + + 166.4453125 + 3038.00537109 + + 160 + + + + + + 35.951152565 + -79.094796041 + + 167.406738281 + 3051.4152832 + + 161 + + + + + + 35.9510656446 + -79.0948939417 + + 167.887329102 + 3064.45385742 + + 161 + + + + + + 35.9509693366 + -79.0949904174 + + 168.368041992 + 3078.19506836 + + 162 + + + + + + 35.950876046 + -79.0950541198 + + 168.368041992 + 3089.91894531 + + 161 + + + + + + 35.9507960826 + -79.0951080993 + + 168.848754883 + 3100.04174805 + + 162 + + + + + + 35.9506886266 + -79.0951521881 + + 169.329467773 + 3112.57592773 + + 162 + + + + + + 35.9505926538 + -79.0951743163 + + 169.810058594 + 3123.39526367 + + 163 + + + + + + 35.9504928254 + -79.0951961931 + + 170.290649414 + 3134.6340332 + + 163 + + + + + + 35.9504152928 + -79.0952087659 + + 171.252075195 + 3143.30004883 + + 163 + + + + + + 35.9503252711 + -79.0952123702 + + 170.771362305 + 3153.25537109 + + 163 + + + + + + 35.9502130374 + -79.0952057485 + + 170.290649414 + 3165.74511719 + + 163 + + + + + + 35.9501433 + -79.0952068381 + + 170.290649414 + 3173.46630859 + + 163 + + + + + + 35.9500463214 + -79.0952099394 + + 169.810058594 + 3184.20532227 + + 164 + + + + + + 35.9499792662 + -79.0952187404 + + 170.771362305 + 3191.67871094 + + 165 + + + + + + 35.949883461 + -79.0952281281 + + 171.252075195 + 3202.35449219 + + 166 + + + + + + 35.9497914277 + -79.0952231828 + + 171.252075195 + 3212.58251953 + + 167 + + + + + + 669.51 + 1470.5546875 + 3.76138925552 + 134 + + 167 + + + 180 + + Active + Manual + + + + + 35.9497263841 + -79.0952385217 + + 171.252075195 + 3219.82714844 + + 167 + + + + + + 35.94969403 + -79.0952381864 + + 171.252075195 + 3223.375 + + 167 + + + + + + 35.9496505279 + -79.0952369291 + + 171.732666016 + 3228.15869141 + + 169 + + + + + + 35.949517088 + -79.0952441376 + + 173.174682617 + 3242.95068359 + + 169 + + + + + + 35.9493939579 + -79.095259225 + + 174.135864258 + 3256.69897461 + + 169 + + + + + + 35.9493590891 + -79.0953510907 + + 174.135864258 + 3266.62719727 + + 169 + + + + + + 35.9493535571 + -79.095507497 + + 172.213256836 + 3280.72900391 + + 169 + + + + + + 35.9493554849 + -79.0956227481 + + 171.252075195 + 3291.08642578 + + 170 + + + + + + 35.9493505396 + -79.0957659949 + + 169.810058594 + 3303.99682617 + + 171 + + + + + + 35.9493468516 + -79.095885437 + + 168.368041992 + 3314.7824707 + + 171 + + + + + + 35.949351294 + -79.0960224811 + + 167.406738281 + 3327.13354492 + + 170 + + + + + + 35.9493479412 + -79.0961701702 + + 165.96472168 + 3340.45996094 + + 169 + + + + + + 35.9493510425 + -79.0963577572 + + 165.484130859 + 3357.36791992 + + 167 + + + + + + 35.9493475221 + -79.096494047 + + 164.042114258 + 3369.66821289 + + 166 + + + + + + 35.9493419901 + -79.0965607669 + + 163.080810547 + 3375.69799805 + + 165 + + + + + + 35.9493426606 + -79.0967581607 + + 161.638916016 + 3393.43920898 + + 163 + + + + + + 35.9493212868 + -79.0969525371 + + 160.677490234 + 3411.15649414 + + 162 + + + + + + 35.9493075404 + -79.0970038343 + + 160.677490234 + 3416.03710938 + + 161 + + + + + + 35.9492327739 + -79.0970898326 + + 160.677490234 + 3427.77416992 + + 157 + + + + + + 35.9491297603 + -79.0970574785 + + 159.716186523 + 3439.58056641 + + 161 + + + + + + 35.9490226395 + -79.097016491 + + 159.716186523 + 3452.03442383 + + 163 + + + + + + 35.9489109926 + -79.0969769284 + + 159.235473633 + 3464.94433594 + + 164 + + + + + + 35.9488151874 + -79.0969484299 + + 159.235473633 + 3475.91235352 + + 165 + + + + + + 35.9487221483 + -79.0969324205 + + 157.793579102 + 3486.30810547 + + 168 + + + + + + 35.9485914744 + -79.0969058499 + + 157.793579102 + 3501.01220703 + + 168 + + + + + + 35.9485017881 + -79.096886823 + + 158.754760742 + 3511.1105957 + + 168 + + + + + + 35.9483996965 + -79.0968695562 + + 160.196899414 + 3522.5234375 + + 168 + + + + + + 35.9482840262 + -79.0968646947 + + 161.158203125 + 3535.36523438 + + 170 + + + + + + 35.9482650831 + -79.0968636889 + + 161.158203125 + 3537.47509766 + + 159 + + + + + + 35.948245218 + -79.0968636889 + + 161.158203125 + 3539.67504883 + + 159 + + + + + + 35.9482023865 + -79.0968583245 + + 161.158203125 + 3544.44946289 + + 164 + + + + + + 35.9480566252 + -79.096847428 + + 163.080810547 + 3560.67358398 + + 168 + + + + + + 35.9479320701 + -79.0968458354 + + 164.042114258 + 3574.50439453 + + 169 + + + + + + 35.9478093591 + -79.0968406387 + + 164.522705078 + 3588.10766602 + + 169 + + + + + + 35.9477191698 + -79.0968420636 + + 164.522705078 + 3598.09960938 + + 171 + + + + + + 35.9476528689 + -79.0968339331 + + 165.003417969 + 3605.49975586 + + 171 + + + + + + 35.9475682955 + -79.0968351904 + + 165.484130859 + 3614.86914062 + + 172 + + + + + + 35.9475230332 + -79.0968339331 + + 165.96472168 + 3619.87475586 + + 172 + + + + + + 35.9474454168 + -79.0968264733 + + 164.042114258 + 3628.47802734 + + 172 + + + + + + 35.9473838937 + -79.0968240425 + + 163.080810547 + 3635.30859375 + + 161 + + + + + + 35.9473681357 + -79.0968226176 + + 162.600097656 + 3637.04541016 + + 161 + + + + + + 35.947333267 + -79.0968181752 + + 162.119506836 + 3640.93310547 + + 166 + + + + + + 35.9472381324 + -79.0967994835 + + 160.196899414 + 3651.64379883 + + 167 + + + + + + 35.9471576661 + -79.0967957955 + + 159.716186523 + 3660.56835938 + + 157 + + + + + + 35.9471425787 + -79.0967957955 + + 159.716186523 + 3662.24584961 + + 157 + + + + + + 35.9470169339 + -79.0967922751 + + 160.677490234 + 3676.18017578 + + 160 + + + + + + 35.946929343 + -79.0967920236 + + 162.119506836 + 3685.8425293 + + 160 + + + + + + 35.9468468651 + -79.0967845637 + + 164.042114258 + 3695.1159668 + + 163 + + + + + + 35.9466944821 + -79.0967960469 + + 165.96472168 + 3712.10668945 + + 167 + + + + + + 35.9467327874 + -79.0967976395 + + 166.4453125 + 3718.09960938 + + 169 + + + + + + 35.9468449373 + -79.0967943706 + + 166.4453125 + 3730.52734375 + + 169 + + + + + + 35.9469607752 + -79.0967961308 + + 166.926025391 + 3743.35571289 + + 169 + + + + + + 35.9470927902 + -79.0968082845 + + 167.887329102 + 3757.98193359 + + 168 + + + + + + 35.947198486 + -79.0968106315 + + 168.368041992 + 3769.65209961 + + 167 + + + + + + 35.9473405592 + -79.0968220308 + + 167.406738281 + 3785.40307617 + + 166 + + + + + + 35.9474668745 + -79.0968339331 + + 168.848754883 + 3799.43261719 + + 161 + + + + + + 35.9475919325 + -79.0968365315 + + 170.290649414 + 3813.29150391 + + 159 + + + + + + 35.9477174934 + -79.0968410578 + + 169.810058594 + 3827.20629883 + + 159 + + + + + + 35.9479155578 + -79.0968498588 + + 169.329467773 + 3849.18530273 + + 156 + + + + + + 35.9480499197 + -79.0968368668 + + 168.848754883 + 3864.16723633 + + 155 + + + + + + 35.9480968583 + -79.0967905987 + + 168.848754883 + 3870.92480469 + + 154 + + + + + + 35.9480939247 + -79.0965949651 + + 168.368041992 + 3888.5612793 + + 157 + + + + + + 35.9480890632 + -79.0964709967 + + 169.329467773 + 3899.72412109 + + 158 + + + + + + 35.9480897337 + -79.0963937994 + + 169.810058594 + 3906.68505859 + + 158 + + + + + + 35.9480910748 + -79.0962836612 + + 169.810058594 + 3916.58935547 + + 161 + + + + + + 35.9480910748 + -79.0961687453 + + 169.810058594 + 3926.87451172 + + 163 + + + + + + 35.9480887279 + -79.0960826632 + + 169.329467773 + 3934.57373047 + + 163 + + + + + + 35.9480764903 + -79.0959986765 + + 169.329467773 + 3942.32788086 + + 164 + + + + + + 35.9480684437 + -79.0959024522 + + 170.290649414 + 3951.03393555 + + 168 + + + + + + 35.9480612352 + -79.0958142746 + + 171.252075195 + 3959.01855469 + + 158 + + + + + + 35.9480605647 + -79.0957982652 + + 171.252075195 + 3960.45996094 + + 158 + + + + + + 35.9480600618 + -79.0957641508 + + 171.732666016 + 3963.53735352 + + 163 + + + + + + 35.9480528533 + -79.0956970956 + + 172.213256836 + 3969.57714844 + + 166 + + + + + + 35.9480485786 + -79.0956130251 + + 172.213256836 + 3977.09741211 + + 167 + + + + + + 35.9480393585 + -79.0955495741 + + 172.693969727 + 3982.91455078 + + 167 + + + + + + 35.9480402805 + -79.0954219177 + + 173.655273438 + 3994.33325195 + + 169 + + + + + + 35.948033575 + -79.0953106899 + + 174.135864258 + 4004.25805664 + + 171 + + + + + + 35.9480318986 + -79.095211532 + + 173.655273438 + 4013.13891602 + + 173 + + + + + + 35.9480270371 + -79.095088318 + + 173.655273438 + 4024.18994141 + + 173 + + + + + + 35.94802293 + -79.0949655231 + + 174.135864258 + 4035.15039062 + + 173 + + + + + + 35.9480222594 + -79.0949426405 + + 174.135864258 + 4037.19848633 + + 173 + + + + + + 35.9480252769 + -79.0948165767 + + 173.655273438 + 4048.47045898 + + 174 + + + + + + 35.9480226785 + -79.0947927721 + + 174.135864258 + 4050.58325195 + + 174 + + + + + + 35.9480215888 + -79.0946522914 + + 175.577880859 + 4063.2890625 + + 176 + + + + + + 35.9480133746 + -79.094537124 + + 176.539306641 + 4073.55126953 + + 176 + + + + + + 35.9480255283 + -79.0943829808 + + 178.942626953 + 4087.38476562 + + 176 + + + + + + 35.9480455611 + -79.0942496248 + + 180.384521484 + 4099.33203125 + + 177 + + + + + + 35.9480781667 + -79.0941606928 + + 181.345825195 + 4108.10400391 + + 177 + + + + + + 35.9481273685 + -79.0940200444 + + 181.826416016 + 4121.66894531 + + 177 + + + + + + 35.9481645841 + -79.0938980877 + + 182.787841797 + 4133.29882812 + + 177 + + + + + + 35.9482153784 + -79.0937565174 + + 182.787841797 + 4147.1953125 + + 176 + + + + + + 35.9482849482 + -79.0936214849 + + 180.384521484 + 4161.51708984 + + 176 + + + + + + 35.9483776521 + -79.0935050603 + + 179.423217773 + 4176.08398438 + + 175 + + + + + + 35.9484720323 + -79.0933964308 + + 178.461914062 + 4190.32275391 + + 173 + + + + + + 35.9485826734 + -79.0932860412 + + 177.981201172 + 4206.04785156 + + 171 + + + + + + 35.9486524947 + -79.0932162199 + + 177.981201172 + 4215.99121094 + + 171 + + + + + + 35.9487322904 + -79.0931641683 + + 178.461914062 + 4226.00097656 + + 169 + + + + + + 35.9488512296 + -79.0930632502 + + 177.020019531 + 4241.89941406 + + 166 + + + + + + 35.9489507228 + -79.0929736476 + + 176.05859375 + 4255.53662109 + + 166 + + + + + + 35.9490424208 + -79.0928756632 + + 174.616577148 + 4268.93896484 + + 163 + + + + + + 35.9491499607 + -79.0927838814 + + 174.135864258 + 4283.42822266 + + 162 + + + + + + 35.9492448438 + -79.092701152 + + 172.693969727 + 4296.24902344 + + 162 + + + + + + 35.94935867 + -79.0926081967 + + 171.732666016 + 4311.38085938 + + 159 + + + + + + 35.9494736698 + -79.092498729 + + 171.252075195 + 4327.46191406 + + 158 + + + + + + 35.9495585784 + -79.0924287401 + + 171.252075195 + 4338.79736328 + + 160 + + + + + + 35.94963938 + -79.0923638642 + + 170.771362305 + 4349.48193359 + + 159 + + + + + + 35.9497562237 + -79.0922635328 + + 170.290649414 + 4365.25927734 + + 158 + + + + + + 35.9498409647 + -79.0921766963 + + 170.290649414 + 4377.46191406 + + 158 + + + + + + 35.9499324951 + -79.0920977388 + + 169.810058594 + 4389.71630859 + + 158 + + + + + + 35.9500122909 + -79.0920240618 + + 170.290649414 + 4400.78320312 + + 160 + + + + + + 35.9501555376 + -79.0919325314 + + 169.810058594 + 4418.74511719 + + 161 + + + + + + 35.9502807632 + -79.0918960702 + + 169.810058594 + 4433.06396484 + + 163 + + + + + + 35.9504871257 + -79.091907721 + + 169.329467773 + 4456.13867188 + + 168 + + + + + + 35.9506073222 + -79.091975363 + + 169.329467773 + 4470.85644531 + + 169 + + + + + + 35.9507328831 + -79.0921094734 + + 170.290649414 + 4489.37158203 + + 169 + + + + + + 35.9508066438 + -79.0922557376 + + 170.771362305 + 4504.96240234 + + 171 + + + + + + 35.9509137645 + -79.0924786963 + + 172.213256836 + 4528.32226562 + + 172 + + + + + + 35.9509784728 + -79.0926374495 + + 171.732666016 + 4544.34521484 + + 175 + + + + + + 35.951064555 + -79.0928365197 + + 171.252075195 + 4564.63964844 + + 177 + + + + + + 35.9511251561 + -79.0929983743 + + 171.252075195 + 4580.61523438 + + 178 + + + + + + 35.9512173571 + -79.093140699 + + 169.810058594 + 4596.91894531 + + 178 + + + + + + 35.9513414931 + -79.0932406951 + + 170.290649414 + 4613.64160156 + + 178 + + + + + + 35.9514861647 + -79.0931921639 + + 169.810058594 + 4630.37792969 + + 178 + + + + + + 35.9516711533 + -79.0930863842 + + 168.848754883 + 4652.96630859 + + 179 + + + + + + 35.9518235363 + -79.0929997992 + + 167.887329102 + 4671.57275391 + + 179 + + + + + + 35.9519544616 + -79.0930143837 + + 166.4453125 + 4686.31103516 + + 180 + + + + + + Forerunner 410 Software Version 2.20 + 3854007508 + 1250 + + 2 + 20 + 0 + 0 + + + + + \ No newline at end of file diff --git a/docs/source/whatsnew.rst b/docs/source/whatsnew.rst index aa45ef2..bced08f 100644 --- a/docs/source/whatsnew.rst +++ b/docs/source/whatsnew.rst @@ -8,4 +8,5 @@ These are new features and improvements of note in each release. For full details, see the `commit logs `_. .. include:: whatsnew/v0.1.0.txt -.. include:: whatsnew/v0.2.0.txt \ No newline at end of file +.. include:: whatsnew/v0.2.0.txt +.. include:: whatsnew/v0.3.0.txt \ No newline at end of file diff --git a/docs/source/whatsnew/v0.2.0.txt b/docs/source/whatsnew/v0.2.0.txt index c3b8329..b5de767 100644 --- a/docs/source/whatsnew/v0.2.0.txt +++ b/docs/source/whatsnew/v0.2.0.txt @@ -30,4 +30,4 @@ New features Bug Fixes ~~~~~~~~~ -- Fixed setup.py ``find_packages``method that broke the readthedocs build procedure (:issue:`30`) \ No newline at end of file +- Fixed setup.py ``find_packages`` method that broke the readthedocs build procedure (:issue:`30`) \ No newline at end of file diff --git a/docs/source/whatsnew/v0.3.0.txt b/docs/source/whatsnew/v0.3.0.txt new file mode 100644 index 0000000..b299e64 --- /dev/null +++ b/docs/source/whatsnew/v0.3.0.txt @@ -0,0 +1,32 @@ +.. _whatsnew_030: + +v0.3.0 (March 13, 2021) +---------------------------- + +This is a major release from 0.2 and includes new features and a number of bug fixes. + + +Highlights include: + + +.. contents:: What's new in v0.3.0 + :local: + :backlinks: none + +.. _whatsnew_030.enhancements: + +New features +~~~~~~~~~~~~ +- Added support to detect periods of inactivity in order to calculate the moving time (:issue:`11`) +- Added testes for inactivity estimator for the activity. (:issue:`11`) +- Added distance, elapsed_time and moving time properties for an activity and respective tests. (:issue:`12`) +- Improvements on Docs (new reference APIs and examples) (:issue:`11` and :issue:`12`) +- Updated examples on README +- Added badge Zenodo.org DOI to README + +.. _whatsnew_030.bug_fixes: + +Bug Fixes +~~~~~~~~~ + +- Fixed the timestamp parse format with fraction when reading GPX files (:issue:`34`) \ No newline at end of file diff --git a/examples/overview.ipynb b/examples/overview.ipynb index 2af1ab8..4d5e05e 100644 --- a/examples/overview.ipynb +++ b/examples/overview.ipynb @@ -15,7 +15,8 @@ "orig_nbformat": 2, "kernelspec": { "name": "python3", - "display_name": "Python 3" + "display_name": "Python 3", + "language": "python" } }, "nbformat": 4, @@ -48,12 +49,12 @@ ], "cell_type": "code", "metadata": {}, - "execution_count": 2, + "execution_count": 7, "outputs": [] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -71,7 +72,7 @@ "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
altdisthrlonlat
time
00:00:00178.9426270.00000062.0-79.09318735.951880
00:00:01178.9426270.00000062.0-79.09318435.951880
00:00:06178.9426271.10694762.0-79.09317235.951868
00:00:12177.50061013.00303562.0-79.09322835.951774
00:00:16177.50061022.40502760.0-79.09314135.951732
\n
" }, "metadata": {}, - "execution_count": 3 + "execution_count": 8 } ], "source": [ @@ -97,7 +98,7 @@ ], "cell_type": "code", "metadata": {}, - "execution_count": 4, + "execution_count": 9, "outputs": [ { "output_type": "stream", @@ -117,7 +118,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 10, "metadata": {}, "outputs": [ { @@ -135,7 +136,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -153,7 +154,151 @@ }, { "source": [ - "Let's play with the data. Let's show distance vs as an example of what and how we can create visualizations. In this example, we will use the built in, matplotlib based plot function." + "The `Activity` dataframe also contains special properties that presents some statistics from the workout such as elapsed time, the moving time and the distance of workout in meters." + ], + "cell_type": "markdown", + "metadata": {} + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "0 days 00:33:11\n4686.31103516\n" + ] + } + ], + "source": [ + "#total time elapsed for the activity\n", + "print(activity.ellapsed_time)\n", + "#distance of workout in meters\n", + "print(activity.distance)" + ] + }, + { + "source": [ + "Occasionally, some observations such as speed, distance and others must be calculated based on available data in the given activity. In runpandas there are special accessors (`runpandas.acessors`) that computes some of these metrics. We will compute the `speed` and the `distance per position` observations using the latitude and longitude for each record and calculate the haversine distance in meters and the speed in meters per second." + ], + "cell_type": "markdown", + "metadata": {} + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "time\n", + "00:00:00 NaN\n", + "00:00:01 0.333146\n", + "00:00:06 1.678792\n", + "00:00:12 11.639901\n", + "00:00:16 9.183847\n", + "Name: distpos, dtype: float64" + ] + }, + "metadata": {}, + "execution_count": 15 + } + ], + "source": [ + "#compute the distance using haversine formula between two consecutive latitude, longitudes observations.\n", + "activity['distpos'] = activity.compute.distance()\n", + "activity['distpos'].head()" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "time\n", + "00:00:00 NaN\n", + "00:00:01 0.333146\n", + "00:00:06 0.335758\n", + "00:00:12 1.939984\n", + "00:00:16 2.295962\n", + "Name: speed, dtype: float64" + ] + }, + "metadata": {}, + "execution_count": 17 + } + ], + "source": [ + "#compute the distance using haversine formula between two consecutive latitude, longitudes observations.\n", + "activity['speed'] = activity.compute.speed(from_distances=True)\n", + "activity['speed'].head()" + ] + }, + { + "source": [ + "Sporadically, there will be a large time difference between consecutive observations in the same workout. This can happen when device is paused by the athlete or therere proprietary algorithms controlling the operating sampling rate of the device which can auto-pause when the device detects no significant change in position. In runpandas there is an algorithm that will attempt to calculate the moving time based on the GPS locations, distances, and speed of the activity.\n", + "\n", + "To compute the moving time, there is a special acessor that detects the periods of inactivity and returns the `moving` series containing all the observations considered to be stopped." + ], + "cell_type": "markdown", + "metadata": {} + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "time\n00:00:00 False\n00:00:01 False\n00:00:06 False\n00:00:12 True\n00:00:16 True\nName: moving, dtype: bool\n" + ] + } + ], + "source": [ + "activity_only_moving = activity.only_moving()\n", + "print(activity_only_moving['moving'].head())" + ] + }, + { + "source": [ + "Now we can compute the moving time, the time of how long the user were active." + ], + "cell_type": "markdown", + "metadata": {} + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": {}, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "Timedelta('0 days 00:33:05')" + ] + }, + "metadata": {}, + "execution_count": 20 + } + ], + "source": [ + "activity_only_moving.moving_time" + ] + }, + { + "source": [ + "Now, let's play with the data. Let's show distance vs as an example of what and how we can create visualizations. In this example, we will use the built in, matplotlib based plot function." ], "cell_type": "markdown", "metadata": {} diff --git a/runpandas/types/acessors/metrics.py b/runpandas/types/acessors/metrics.py index 857284f..0903e8b 100644 --- a/runpandas/types/acessors/metrics.py +++ b/runpandas/types/acessors/metrics.py @@ -60,22 +60,25 @@ def __correct_distance(self, distance_series, col_alt="alt"): def distance(self, correct_distance=False, to_special_column=True, **kwargs): """ Calculates the distance in meters using haversine distance formula on an Activity frame. - ----------------------------------- + + Parameters + ---------- correct_distance: bool, optional It computes the distance corrected by the altitude. default is False. - to_special_column: convert the distance calculated (`pandas.Series`) - to special runpandas distance cummulative column - (`runpandas.types.columns.DistancePerPosition`). + to_special_column: bool, optional + It converts the distance calculated (`pandas.Series`) to special runpandas + distance cummulative column (`runpandas.types.columns.DistancePerPosition`). Default is True. - **kwargs : Keyword args to be passed to the `haversine` method + **kwargs: Keyword args to be passed to the `haversine` method Returns ------- - haversine_dist : pandas.Series or runpandas.types.columns.DistancePerPosition + haversine_dist: pandas.Series or runpandas.types.columns.DistancePerPosition A Series of floats representing the distance in meters with the same index of the accessed activity object. + """ self._activity["point"] = self._activity.apply( lambda x: (x["lat"], x["lon"]), axis=1 @@ -102,22 +105,25 @@ def distance(self, correct_distance=False, to_special_column=True, **kwargs): def speed(self, from_distances=False, to_special_column=True, **kwargs): """ Calculates the speed in meters using an Activity frame. - ----------------------------------- + + Parameters + ---------- from_distances: bool, optional - Should the speeds be calculated from the distance recordings - instead of taken from the speed recordings directly? Default is False. + Should the speeds be calculated from the distance recordings + instead of taken from the speed recordings directly? Default is False. to_special_column: convert the distance calculated (`pandas.Series`) to special runpandas distance cummulative column (`runpandas.types.columns.Speed`). Default is True. - **kwargs : Keyword args to be passed to the `haversine` method + **kwargs: Keyword args to be passed to the `haversine` method Returns ------- - speed : pandas.Series or runpandas.types.columns.Speed + speed: `pandas.Series` or `runpandas.types.columns.Speed` A Series of floats representing the speed in meters with the same index of the accessed activity object. + """ if from_distances: if "distpos" not in self._activity.columns: diff --git a/runpandas/types/acessors/moving.py b/runpandas/types/acessors/moving.py index 4e04f2c..1e1e428 100644 --- a/runpandas/types/acessors/moving.py +++ b/runpandas/types/acessors/moving.py @@ -14,9 +14,10 @@ class _InactivityAssessor(object): Parameters ---------- - remove_stopped_periods: bool default False - If True, regions of data with speed below a threshold - will be removed from the data. Default is False. + threshold: float, default 0.8 + When the speed of a record drops below the threshold speed a 'false' event + is set to the 'moving'column, and when the speed rises above the + threshold speed a 'true' event is set to the 'moving' column. Raises ------ diff --git a/runpandas/types/frame.py b/runpandas/types/frame.py index d11bb9a..bf09d2b 100644 --- a/runpandas/types/frame.py +++ b/runpandas/types/frame.py @@ -16,7 +16,7 @@ class Activity(pd.DataFrame): An Activity object is a pandas.DataFrame that provides useful methods and has specific columns with special functionalities. In addition to the standard DataFrame constructor arguments, - GeoDataFrame also accepts the following optional arguments: + Activity also accepts the following optional arguments: Parameters ---------- @@ -106,12 +106,15 @@ def from_file(cls, file_path, **kwargs): """ Alternate constructor to create a ``Activity`` from a file. + It is recommended to use :func:`runpandas.reader._read_file` instead. + Parameters ---------- - file : str + file_path : str File path or file handle to read from. Depending on which kwargs are included, the content of filename may vary. kwargs : key-word arguments + These arguments are passed to reader._read_file """ return runpandas.reader._read_file(file_path) @@ -122,8 +125,7 @@ def ellapsed_time(self): The duration of activity in `pandas.TimedeltaIndex` object. Raises: - AttributeError if dataframe index is not an instance of - TimedeltaIndex + AttributeError if dataframe index is not an instance of TimedeltaIndex """ if isinstance(self.index, pd.TimedeltaIndex): @@ -139,9 +141,9 @@ def moving_time(self): internal calculations. Raises: - AttributeError if dataframe index is not an instance of - TimedeltaIndex or the `moving` column is not found computed - from `runpandas.acessors.moving.only_moving` acessor. + AttributeError if dataframe index is not an instance of TimedeltaIndex + or the `moving` column is not found computed from + `runpandas.acessors.moving.only_moving` acessor. """ if not isinstance(self.index, pd.TimedeltaIndex): @@ -159,6 +161,10 @@ def moving_time(self): @property def distance(self): + """ + Returns: + The total distance of the activity in meters as a float number. + """ try: return self["dist"].max() except KeyError: diff --git a/setup.py b/setup.py index 138f92a..fe03670 100644 --- a/setup.py +++ b/setup.py @@ -47,6 +47,6 @@ python_requires=">=3.6", include_package_data=True, install_requires=INSTALL_REQUIRES, - packages=find_packages(exclude=['tests*']), + packages=find_packages(exclude=["tests*"]), zip_safe=False, )