Skip to main content

The Parkinson`s Disease Data Science Toolkit

Project description

https://circleci.com/gh/pdkit/pdkit.svg?style=shield https://readthedocs.org/projects/pdkit/badge/ https://zenodo.org/badge/124572011.svg

PDKIT

INSTALL INSTRUCTIONS

Regular install

$ pip install pdkit

or

$ pip install git+git://github.com/pdkit/pdkit.git

For “editable” install

$ pip install -e git://github.com/pdkit/pdkit.git#egg=pdkit

For development install

$ git clone https://github.com/pdkit/pdkit.git
$ pip install -r requirements.txt
$ pip install .

TREMOR PROCESSOR

Example how to use pdkit to calculate tremor amplitude and frequency:

>>> import pdkit
>>> tp = pdkit.TremorProcessor()
>>> ts = pdkit.TremorTimeSeries().load(filename)
>>> amplitude, frequency = tp.amplitude(ts)

where, filename is the data path to load, by default in the cloudUPDRS format.

Pdkit can also read data in the MPower format, just like:

>>> ts = pdkit.TremorTimeSeries().load(filename, 'mpower')

where, filename is the data path to load in MPower format.

To calculate Welch, as a robust alternative to using Fast Fourier Transform, use like:

>>> amplitude, frequency = tp.amplitude(ts, 'welch')

This class also provides a method named extract_features to extract all the features available in Tremor Processor.

>>> tp.extract_features(ts)

BRADYKINESIA

>>> import pdkit
>>> ts = pdkit.TremorTimeSeries().load(filename)
>>> tp = pdkit.TremorProcessor(lower_frequency=0.0, upper_frequency=4.0)
>>> amplitude, frequency = tp.bradykinesia(ts)

GAIT

Example how to use pdkit to calculate various Gait features:

>>> import pdkit
>>> ts = pdkit.GaitTimeSeries().load(filename)
>>> gp = pdkit.GaitProcessor()
>>> freeze_times, freeze_indexes, locomotion_freezes = gp.freeze_of_gait(ts)
>>> frequency_of_peaks = gp.frequency_of_peaks(ts)
>>> speed_of_gait = gp.speed_of_gait(ts)
>>> step_regularity, stride_regularity, walk_symmetry = gp.walk_regularity_symmetry(ts)

where, filename is the data path to load, by default in the CloudUPDRS format.

FINGER TAPPING

Example how to use pdkit to calculate the mean alternate distance of the finger tapping tests:

>>> import pdkit
>>> ts = pdkit.FingerTappingTimeSeries().load(filename)
>>> ftp = pdkit.FingerTappingProcessor()
>>> ftp.mean_alnt_target_distance(ts)

kinesia scores (the number of key taps)

>>> ftp.kinesia_scores(ts)

TEST RESULT SET

Pdkit can be used to extract all the features for different measurements (i.e. tremor, finger tapping) placed in a single folder. The result is a data frame where the measurements are rows and the columns are the features extracted.

>>> import pdkit
>>> testResultSet = pdkit.TestResultSet(folderpath)
>>> testResultSet.process()

where folderpath is the relative folder with the different measurements. For CloudUPDRS there are measurements in the following folder ./tests/data. The resulting dataframe with all the features processed is saved in testResultSet.features

We can also write the data frame to a output file like:

>>> testResultSet.write_output(dataframe, name)

UPDRS

Pdkit can calculate the UPDRS score for a given testResultSet.

>>> import pdkit
>>> updrs = pdkit.UPDRS(data_frame)

The UPDRS scores can be written to a file. You can pass the name of a filename and the output_format

>>> updrs.write_model(filename='scores', output_format='csv')

To score a new measurement against the trained knn clusters.

>>> updrs.score(measurement)

To read the testResultSet data from a file. See TestResultSet class for more details.

>>> updrs = pdkit.UPDRS(data_frame_file_path=file_path_to_testResultSet_file)

Clinical UPDRS

Pdkit uses the clinical data to calculates classifiers implementing the k-nearest neighbors vote.

>>> import pdkit
>>> clinical_UPDRS = pdkit.Clinical_UPDRS(labels_file_path, data_frame)

where the labels_file_path is the path to the clinical data file, data_frame is the result of the testResultSet.

To score a new measurement against the trained knn clusters.

>>> clinical_UPDRS.predict(measurement)

To read the testResultSet data from a file. See TestResultSet class for more details.

>>> clinical_UPDRS = pdkit.Clinical_UPDRS(labels_file_path, data_frame_file_path=file_path_to_testResultSet_file)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdkit-1.3.2.tar.gz (47.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pdkit-1.3.2-py2.py3-none-any.whl (58.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pdkit-1.3.2.tar.gz.

File metadata

  • Download URL: pdkit-1.3.2.tar.gz
  • Upload date:
  • Size: 47.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.21.0 setuptools/45.1.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.6

File hashes

Hashes for pdkit-1.3.2.tar.gz
Algorithm Hash digest
SHA256 9d40ab50366ce0c5b178a9835e33123487b5a8ab6f7c9ad96998625b34f85d05
MD5 338b6cb98040bf8ab164c5daf91145e1
BLAKE2b-256 0f32e195919c540d4d6426ec8d5a118dcde9a6b2b555a27a3bfc923b7ac089ff

See more details on using hashes here.

File details

Details for the file pdkit-1.3.2-py2.py3-none-any.whl.

File metadata

  • Download URL: pdkit-1.3.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 58.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.21.0 setuptools/45.1.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.6

File hashes

Hashes for pdkit-1.3.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ae0069abdcab58e5df74f58d5d7b9d7ee4c01eb60b539fc0085b44029b717365
MD5 4e339b341b7bb57896bfc9d5465ac8bb
BLAKE2b-256 5518a69d0f780ee01ed5a7df54da8106e6a8e28a69c6993c654dd92ef8496818

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page