Sit2StandPy

Sit2StandPy: An Open-Source Python Package for Detecting and Quantifying Sit-to-Stand Transitions Using an Accelerometer on the Lower Back - Published in JOSS (2020)

https://github.com/pfizer-opensource/sit2standpy

Science Score: 49.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 6 DOI reference(s) in README
  • Academic publication links
    Links to: joss.theoj.org, zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.9%) to scientific vocabulary

Scientific Fields

Mathematics Computer Science - 84% confidence
Last synced: 7 months ago · JSON representation

Repository

Python based module framework for detecting sit-to-stand transitions

Basic Info
  • Host: GitHub
  • Owner: pfizer-opensource
  • License: mit
  • Language: Python
  • Default Branch: master
  • Size: 2.82 MB
Statistics
  • Stars: 8
  • Watchers: 7
  • Forks: 8
  • Open Issues: 2
  • Releases: 6
Created almost 7 years ago · Last pushed almost 5 years ago
Metadata Files
Readme Contributing License

README.md

Sit2StandPy

DOI DOI

Sit2StandPy is an open source Python package that uses novel algorithms to first detect Sit-to-Stand transitions from lumbar-mounted accelerometer data, and then provide quantitative metrics assessing the performance of the transitions. A modular framework is employed that would allow for easy modification of parts of the algorithm to suit other specific requirements, while still keeping core elements of the algorithm intact. As gyroscopes impose a significant detriment to battery life due to power consumption, Sit2StandPy's use of acceleration only allows for a single sensor to collect days worth of analyzable data.

Documentation

Full documentation is available, containing API references, installation instructions, and usage examples.

Requirements

  • Python >= 3.7
  • Numpy
  • pandas
  • Scipy
  • pywavelets
  • udatetime

To run the tests, additionally the following are needed

  • pytest
  • h5py

Installation

Run in the command line/terminal:

shell script pip install sit2standpy

pip will automatically collect and install the required packages by default. If you do not want this behavior, run

shell script pip install sit2standpy --no-deps

Testing

Automated tests can be run with pytest through the terminal:

shell script pytest --pyargs sit2standpy.tests -v

To run the v2 interface tests: shell script pytest --pyargs sit2standpy.v2.tests -v

V2 Interface

Starting with version 1.1.0 a new "v2" interface is available alongside the old interface. Following a sequential pipeline layout, a basic usage example is:

```python import sit2standpy as s2s

transform the data into the appropriate format for H5 or dictionary

note that "datatransformfunction" is your own function to achieve the appropriate format

if you are looking for a quick example data loader function, you can use the one at

https://gist.github.com/LukasAdamowicz/b8481ef32e4beeb77c80f29f34c8045e

data = (acceleration_data)

sequence = s2s.v2.Sequential() sequence.add(s2s.v2.WindowDays(hours=[8, 20])) # window the data into days using only the hours from 8:00 to 20:00 sequence.add(s2s.v2.AccelerationFilter()) # Do the initial filtering and processing required sequence.add(s2s.v2.Detector(stillness_constraint=True)) # Detect the transitions using the stillness constraint

sequence.predict(data) # predict and save the results into data

s2s.v2.tabulateresults(data, pathtocsvoutput, method='stillness') # tabulate the results to a csv for easy reading ```

Old Usage

Basic use is accomplished through the Sit2Stand object:

```python import sit2standpy as s2s import numpy as np # importing sample data from sys import versioninfo if versioninfo < (3, 7): from pkgresources import resourcefilename else: from importlib import resources

locate the sample data and load it (depending on python version)

if versioninfo < (3, 7): filepath = resourcefilename('sit2standpy', 'data/sample.csv') data = np.loadtxt(filepath, delimiter=',') else: with resources.path('sit2standpy.data', 'sample.csv') as filepath: data = np.loadtxt(filepath, delimiter=',')

separate the stored sample data

time = data[:, 0] accel = data[:, 1:]

initialize the framework for detection

ths = {'stand displacement': 0.125, 'transition velocity': 0.3, 'accel moving avg': 0.15, 'accel moving std': 0.1, 'jerk moving avg': 2.5, 'jerk moving std': 3} sts = s2s.Sit2Stand(method='stillness', gravity=9.84, thresholds=ths, longstill=0.3, stillwindow=0.3, durationfactor=4, displacementfactor=0.6, lminkwargs={'height': -9.5}, powerband=[0, 0.5], powerpeakkwargs={'distance': 128}, powerstdevheight=True)

run the sit-to-stand detection

SiSt = sts.apply(accel, time, time_units='us')

print the list of Transition objects, stored as a dictionary with the time they occurred

print(SiSt) ```

sit_to_stands is then a dictionary of Transition objects containing information about each of the transitions detected

Contributing

Contributions are welcome. Please see the contributions document for more information

Owner

  • Name: Pfizer Open Source
  • Login: pfizer-opensource
  • Kind: organization

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Committers

Last synced: 8 months ago

All Time
  • Total Commits: 418
  • Total Committers: 1
  • Avg Commits per committer: 418.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Lukas Adamowicz l****z@p****m 418
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 0
  • Total pull requests: 23
  • Average time to close issues: N/A
  • Average time to close pull requests: less than a minute
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 23
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • LukasAdamowicz (23)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

docs/requirements.txt pypi
  • h5py *
  • numpy *
  • numpydoc *
  • pandas *
  • pywavelets *
  • scipy *
setup.py pypi
  • numpy *
  • pandas *
  • pywavelets *
  • scipy *
  • udatetime *