actinet


Nameactinet JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/OxWearables/actinet
SummaryActivity detection algorithm compatible with the UK Biobank Accelerometer Dataset
upload_time2024-03-13 16:35:18
maintainerShing Chan
docs_urlNone
authorShing Chan, Aidan Acquah, Charilaos Zisou, Aiden Doherty
requires_python>=3.8, <4
licenseSee LICENSE file.
keywords example setuptools versioneer
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # actinet

A tool to extract meaningful health information from large accelerometer datasets.
The software generates time-series and summary metrics useful for answering key questions such as how much time is spent in sleep, sedentary behaviour, or doing physical activity.
The backbone of this repository is a self-supervised Resnet18 model.

## Install

*Minimum requirements*: Python>=3.9, Java 8 (1.8)

The following instructions make use of Anaconda to meet the minimum requirements:

1. Download & install [Miniconda](https://docs.conda.io/en/latest/miniconda.html) (light-weight version of Anaconda).
1. (Windows) Once installed, launch the **Anaconda Prompt**.
1. Create a virtual environment:

    ```console
    conda create -n actinet python=3.9 openjdk pip
    ```

    This creates a virtual environment called `actinet` with Python version 3.9, OpenJDK, and Pip.
1. Activate the environment:

    ```console
    conda activate actinet
    ```

    You should now see `(actinet)` written in front of your prompt.
1. Install `actinet`:

    ```console
    pip install actinet
    ```

You are all set! The next time that you want to use `actinet`, open the Anaconda Prompt and activate the environment (step 4). If you see `(actinet)` in front of your prompt, you are ready to go!

## Usage

```bash
# Process an AX3 file
$ actinet sample.cwa

# Or an ActiGraph file
$ actinet sample.gt3x

# Or a GENEActiv file
$ actinet sample.bin

# Or a CSV file (see data format below)
$ actinet sample.csv
```

### Troubleshooting

Some systems may face issues with Java when running the script. If this is your case, try fixing OpenJDK to version 8:

```console
conda create -n actinet openjdk=8
```

### Offline usage

To use this package offline, one must first download and install the relevant classifier file and model modules.
This repository offers two ways of doing this.

Run the following code when you have internet access:
```console
actinet --cache-classifier
```
 
Following this, the actinet classifier can be used as standard without internet access, without needing to specify the flags relating to the model repository.
 
Alternatively, you can download or git clone the ssl modules from the [ssl-wearables repository](https://github.com/OxWearables/ssl-wearables).

In addition, you can donwload/prepare a custom classifier file.

Once this is downloaded to an appopriate location, you can run the actinet model using:
 
```console
actinet sample.cwa -c /path/to/classifier.joblib.lzma -m /path/to/ssl-wearables
```

### Output files

By default, output files will be stored in a folder named after the input file, `outputs/{filename}/`, created in the current working directory. You can change the output path with the `-o` flag:

```console
$ actinet sample.cwa -o /path/to/some/folder/

<Output summary written to: /path/to/some/folder/sample-outputSummary.json>
<Time series output written to: /path/to/some/folder/sample-timeSeries.csv.gz>
```

The following output files are created:

- *Info.json* Summary info, as shown above.
- *timeSeries.csv* Raw time-series of activity levels

See [Data Dictionary](https://biobankaccanalysis.readthedocs.io/en/latest/datadict.html) for the list of output variables.

### Plotting activity profiles

To plot the activity profiles, you can use the -p flag:

```console
$ actinet sample.cwa -p
<Output plot written to: data/sample-timeSeries-plot.png>
```

### Crude vs. Adjusted Estimates

Adjusted estimates are provided that account for missing data.
Missing values in the time-series are imputed with the mean of the same timepoint of other available days.
For adjusted totals and daily statistics, 24h multiples are needed and will be imputed if necessary.
Estimates will be NaN where data is still missing after imputation.

### Processing CSV files

If a CSV file is provided, it must have the following header: `time`, `x`, `y`, `z`.

Example:

```console
time,x,y,z
2013-10-21 10:00:08.000,-0.078923,0.396706,0.917759
2013-10-21 10:00:08.010,-0.094370,0.381479,0.933580
2013-10-21 10:00:08.020,-0.094370,0.366252,0.901938
2013-10-21 10:00:08.030,-0.078923,0.411933,0.901938
...
```

### Processing multiple files

#### Windows

To process multiple files you can create a text file in Notepad which includes one line for each file you wish to process, as shown below for *file1.cwa*, *file2.cwa*, and *file2.cwa*.

Example text file *commands.txt*:

```console
actinet file1.cwa &
actinet file2.cwa &
actinet file3.cwa 
:END
````

Once this file is created, run `cmd < commands.txt` from the terminal.

#### Linux

Create a file *command.sh* with:

```console
actinet file1.cwa
actinet file2.cwa
actinet file3.cwa
```

Then, run `bash command.sh` from the terminal.

### Collating outputs

A utility script is provided to collate outputs from multiple runs:

```console
actinet-collate-outputs outputs/
```

This will collate all *-Info.json files found in outputs/ and generate a CSV file.

## Citing our work

When using this tool, please consider citing the works listed in [CITATION.md](https://github.com/OxWearables/actinet/blob/master/CITATION.md).

## Licence

See [LICENSE.md](https://github.com/OxWearables/actinet/blob/master/LICENSE.md).

## Acknowledgements

We would like to thank all our code contributors, manuscript co-authors, and research participants for their help in making this work possible.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/OxWearables/actinet",
    "name": "actinet",
    "maintainer": "Shing Chan",
    "docs_url": null,
    "requires_python": ">=3.8, <4",
    "maintainer_email": "shing.chan@ndph.ox.ac.uk",
    "keywords": "example,setuptools,versioneer",
    "author": "Shing Chan, Aidan Acquah, Charilaos Zisou, Aiden Doherty",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/fc/35/0f48638ad3e4272bff291f67992281c71acbe6843476ea6d339ea779503e/actinet-0.1.1.tar.gz",
    "platform": null,
    "description": "# actinet\n\nA tool to extract meaningful health information from large accelerometer datasets.\nThe software generates time-series and summary metrics useful for answering key questions such as how much time is spent in sleep, sedentary behaviour, or doing physical activity.\nThe backbone of this repository is a self-supervised Resnet18 model.\n\n## Install\n\n*Minimum requirements*: Python>=3.9, Java 8 (1.8)\n\nThe following instructions make use of Anaconda to meet the minimum requirements:\n\n1. Download & install [Miniconda](https://docs.conda.io/en/latest/miniconda.html) (light-weight version of Anaconda).\n1. (Windows) Once installed, launch the **Anaconda Prompt**.\n1. Create a virtual environment:\n\n    ```console\n    conda create -n actinet python=3.9 openjdk pip\n    ```\n\n    This creates a virtual environment called `actinet` with Python version 3.9, OpenJDK, and Pip.\n1. Activate the environment:\n\n    ```console\n    conda activate actinet\n    ```\n\n    You should now see `(actinet)` written in front of your prompt.\n1. Install `actinet`:\n\n    ```console\n    pip install actinet\n    ```\n\nYou are all set! The next time that you want to use `actinet`, open the Anaconda Prompt and activate the environment (step 4). If you see `(actinet)` in front of your prompt, you are ready to go!\n\n## Usage\n\n```bash\n# Process an AX3 file\n$ actinet sample.cwa\n\n# Or an ActiGraph file\n$ actinet sample.gt3x\n\n# Or a GENEActiv file\n$ actinet sample.bin\n\n# Or a CSV file (see data format below)\n$ actinet sample.csv\n```\n\n### Troubleshooting\n\nSome systems may face issues with Java when running the script. If this is your case, try fixing OpenJDK to version 8:\n\n```console\nconda create -n actinet openjdk=8\n```\n\n### Offline usage\n\nTo use this package offline, one must first download and install the relevant classifier file and model modules.\nThis repository offers two ways of doing this.\n\nRun the following code when you have internet access:\n```console\nactinet --cache-classifier\n```\n \nFollowing this, the actinet classifier can be used as standard without internet access, without needing to specify the flags relating to the model repository.\n \nAlternatively, you can download or git clone the ssl modules from the [ssl-wearables repository](https://github.com/OxWearables/ssl-wearables).\n\nIn addition, you can donwload/prepare a custom classifier file.\n\nOnce this is downloaded to an appopriate location, you can run the actinet model using:\n \n```console\nactinet sample.cwa -c /path/to/classifier.joblib.lzma -m /path/to/ssl-wearables\n```\n\n### Output files\n\nBy default, output files will be stored in a folder named after the input file, `outputs/{filename}/`, created in the current working directory. You can change the output path with the `-o` flag:\n\n```console\n$ actinet sample.cwa -o /path/to/some/folder/\n\n<Output summary written to: /path/to/some/folder/sample-outputSummary.json>\n<Time series output written to: /path/to/some/folder/sample-timeSeries.csv.gz>\n```\n\nThe following output files are created:\n\n- *Info.json* Summary info, as shown above.\n- *timeSeries.csv* Raw time-series of activity levels\n\nSee [Data Dictionary](https://biobankaccanalysis.readthedocs.io/en/latest/datadict.html) for the list of output variables.\n\n### Plotting activity profiles\n\nTo plot the activity profiles, you can use the -p flag:\n\n```console\n$ actinet sample.cwa -p\n<Output plot written to: data/sample-timeSeries-plot.png>\n```\n\n### Crude vs. Adjusted Estimates\n\nAdjusted estimates are provided that account for missing data.\nMissing values in the time-series are imputed with the mean of the same timepoint of other available days.\nFor adjusted totals and daily statistics, 24h multiples are needed and will be imputed if necessary.\nEstimates will be NaN where data is still missing after imputation.\n\n### Processing CSV files\n\nIf a CSV file is provided, it must have the following header: `time`, `x`, `y`, `z`.\n\nExample:\n\n```console\ntime,x,y,z\n2013-10-21 10:00:08.000,-0.078923,0.396706,0.917759\n2013-10-21 10:00:08.010,-0.094370,0.381479,0.933580\n2013-10-21 10:00:08.020,-0.094370,0.366252,0.901938\n2013-10-21 10:00:08.030,-0.078923,0.411933,0.901938\n...\n```\n\n### Processing multiple files\n\n#### Windows\n\nTo process multiple files you can create a text file in Notepad which includes one line for each file you wish to process, as shown below for *file1.cwa*, *file2.cwa*, and *file2.cwa*.\n\nExample text file *commands.txt*:\n\n```console\nactinet file1.cwa &\nactinet file2.cwa &\nactinet file3.cwa \n:END\n````\n\nOnce this file is created, run `cmd < commands.txt` from the terminal.\n\n#### Linux\n\nCreate a file *command.sh* with:\n\n```console\nactinet file1.cwa\nactinet file2.cwa\nactinet file3.cwa\n```\n\nThen, run `bash command.sh` from the terminal.\n\n### Collating outputs\n\nA utility script is provided to collate outputs from multiple runs:\n\n```console\nactinet-collate-outputs outputs/\n```\n\nThis will collate all *-Info.json files found in outputs/ and generate a CSV file.\n\n## Citing our work\n\nWhen using this tool, please consider citing the works listed in [CITATION.md](https://github.com/OxWearables/actinet/blob/master/CITATION.md).\n\n## Licence\n\nSee [LICENSE.md](https://github.com/OxWearables/actinet/blob/master/LICENSE.md).\n\n## Acknowledgements\n\nWe would like to thank all our code contributors, manuscript co-authors, and research participants for their help in making this work possible.\n",
    "bugtrack_url": null,
    "license": "See LICENSE file.",
    "summary": "Activity detection algorithm compatible with the UK Biobank Accelerometer Dataset",
    "version": "0.1.1",
    "project_urls": {
        "Download": "https://github.com/OxWearables/actinet",
        "Homepage": "https://github.com/OxWearables/actinet"
    },
    "split_keywords": [
        "example",
        "setuptools",
        "versioneer"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e57bd74b21d4c58d7d24f374e41703e69b8ef7b16b6c330e150353d6682e6dfd",
                "md5": "01a257d0df8495072e40637223261be1",
                "sha256": "8bf121e8a38022768c21b2ec5433f617d6af8dce3c807fbd292423d2560dde7d"
            },
            "downloads": -1,
            "filename": "actinet-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "01a257d0df8495072e40637223261be1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8, <4",
            "size": 37701,
            "upload_time": "2024-03-13T16:35:16",
            "upload_time_iso_8601": "2024-03-13T16:35:16.912107Z",
            "url": "https://files.pythonhosted.org/packages/e5/7b/d74b21d4c58d7d24f374e41703e69b8ef7b16b6c330e150353d6682e6dfd/actinet-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fc350f48638ad3e4272bff291f67992281c71acbe6843476ea6d339ea779503e",
                "md5": "24187ddd88714fcdc2713d652089c289",
                "sha256": "d9822a1644f197c2840addae52aeceb785cfa6c63bc11aaf6f29f26cfb6b91b4"
            },
            "downloads": -1,
            "filename": "actinet-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "24187ddd88714fcdc2713d652089c289",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8, <4",
            "size": 55977,
            "upload_time": "2024-03-13T16:35:18",
            "upload_time_iso_8601": "2024-03-13T16:35:18.558462Z",
            "url": "https://files.pythonhosted.org/packages/fc/35/0f48638ad3e4272bff291f67992281c71acbe6843476ea6d339ea779503e/actinet-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-13 16:35:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "OxWearables",
    "github_project": "actinet",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "actinet"
}
        
Elapsed time: 0.24108s