|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "id": "f8d26bb2-a1e6-4bd5-99dd-20e8e88b7d73", |
| 6 | + "metadata": {}, |
| 7 | + "source": [ |
| 8 | + "# Quick setup\n", |
| 9 | + "\n", |
| 10 | + "Welcome to `circStudio`, a Python package for reproducible preprocessing, modeling, and analysis of actigraphy time series in biological rhythm research workflows.\n", |
| 11 | + "\n", |
| 12 | + "## Requirements\n", |
| 13 | + "- Python ≥ 3.12.\n", |
| 14 | + "\n", |
| 15 | + "You can check your Python version with:" |
| 16 | + ] |
| 17 | + }, |
| 18 | + { |
| 19 | + "cell_type": "markdown", |
| 20 | + "id": "c393f203-efd4-47a5-a216-25e0062140dd", |
| 21 | + "metadata": {}, |
| 22 | + "source": [ |
| 23 | + "```bash\n", |
| 24 | + "python --version\n", |
| 25 | + "```" |
| 26 | + ] |
| 27 | + }, |
| 28 | + { |
| 29 | + "cell_type": "markdown", |
| 30 | + "id": "a7427185-e4f4-49fd-a811-ae6bb37646f0", |
| 31 | + "metadata": {}, |
| 32 | + "source": [ |
| 33 | + "## Installation\n", |
| 34 | + "Install the latest stable version from PyPI:" |
| 35 | + ] |
| 36 | + }, |
| 37 | + { |
| 38 | + "cell_type": "markdown", |
| 39 | + "id": "initial_id", |
| 40 | + "metadata": { |
| 41 | + "ExecuteTime": { |
| 42 | + "end_time": "2026-02-18T16:25:05.970483Z", |
| 43 | + "start_time": "2026-02-18T16:25:05.967638Z" |
| 44 | + } |
| 45 | + }, |
| 46 | + "source": [ |
| 47 | + "```bash\n", |
| 48 | + "pip install circStudio\n", |
| 49 | + "```" |
| 50 | + ] |
| 51 | + }, |
| 52 | + { |
| 53 | + "cell_type": "markdown", |
| 54 | + "id": "d33bc2ef-477a-43b3-8f9b-25157b4338d1", |
| 55 | + "metadata": {}, |
| 56 | + "source": [ |
| 57 | + "## (Optional) Installation in an Isolated Environment\n", |
| 58 | + "To avoid dependency conflicts and ensure a clean, reproducible setup, install `circStudio` in a dedicated Python environment.\n", |
| 59 | + "\n", |
| 60 | + "### Using Conda/Miniconda:\n", |
| 61 | + "\n", |
| 62 | + "```bash\n", |
| 63 | + "conda create -n csenv python=3.12 # Create environment (v. 3.12 or 3.13)\n", |
| 64 | + "conda activate csenv # Activate environment\n", |
| 65 | + "python -m pip install circStudio # Install circStudio\n", |
| 66 | + "conda deactivate # Deactivate environment\n", |
| 67 | + "```\n", |
| 68 | + "\n", |
| 69 | + "### Using venv\n", |
| 70 | + "```bash\n", |
| 71 | + "# MacOS / Linux\n", |
| 72 | + "python3 -m venv csenv/ # Create environment\n", |
| 73 | + "source csenv/bin/activate # Activate the environment\n", |
| 74 | + "python -m pip install circStudio # Install circStudio\n", |
| 75 | + "deactivate # Deactivate environment\n", |
| 76 | + "\n", |
| 77 | + "# Windows (PowerShell)\n", |
| 78 | + "PS> py -m venv csenv\\ # Create environment\n", |
| 79 | + "PS> csenv\\Scripts\\activate # Activate environment\n", |
| 80 | + "PS> python -m pip install circStudio # Install circStudio\n", |
| 81 | + "PS> deactivate # Deactivate environment\n", |
| 82 | + "```\n", |
| 83 | + "\n", |
| 84 | + "## Verify installation\n", |
| 85 | + "After installation, confirm that `circStudio` can be imported:\n", |
| 86 | + "\n", |
| 87 | + "```bash\n", |
| 88 | + "python -c \"import circstudio; print('circstudio imports')\"\n", |
| 89 | + "```\n", |
| 90 | + "\n", |
| 91 | + "## Sample usage\n", |
| 92 | + "The example below illustrates a minimal workflow for loading actigraphy data and computing a basic metric:" |
| 93 | + ] |
| 94 | + }, |
| 95 | + { |
| 96 | + "cell_type": "code", |
| 97 | + "execution_count": 10, |
| 98 | + "id": "7d40abc1-b24f-4b2e-862c-c2fbc7ca0c0f", |
| 99 | + "metadata": {}, |
| 100 | + "outputs": [ |
| 101 | + { |
| 102 | + "name": "stdout", |
| 103 | + "output_type": "stream", |
| 104 | + "text": [ |
| 105 | + "Intradaily variability: 0.56\n" |
| 106 | + ] |
| 107 | + } |
| 108 | + ], |
| 109 | + "source": [ |
| 110 | + "import pandas as pd\n", |
| 111 | + "import circstudio as cs\n", |
| 112 | + "import os\n", |
| 113 | + "\n", |
| 114 | + "# Load sample actigraphy time series\n", |
| 115 | + "data_dir = os.path.join(os.path.dirname(cs.__file__), \"data\")\n", |
| 116 | + "raw = cs.io.read_atr(os.path.join(data_dir, 'test_sample_atr.txt'))\n", |
| 117 | + "\n", |
| 118 | + "# Alternative: load a generic actigraphy file using pandas\n", |
| 119 | + "# Expected columns: timestamp, activity (and optionally temperature, light)\n", |
| 120 | + "#raw = pd.read_csv(\"example_actigraphy.csv\", parse_dates=[\"timestamp\"])\n", |
| 121 | + "\n", |
| 122 | + "# Compute intradaily variability (IV)\n", |
| 123 | + "iv = cs.analysis.IV(data=raw.activity)\n", |
| 124 | + "\n", |
| 125 | + "print(f\"Intradaily variability: {iv:.2f}\")" |
| 126 | + ] |
| 127 | + }, |
| 128 | + { |
| 129 | + "cell_type": "markdown", |
| 130 | + "id": "a48f5b2c-6a9d-4a1d-8675-81a60ba00dca", |
| 131 | + "metadata": {}, |
| 132 | + "source": [ |
| 133 | + "## Next steps" |
| 134 | + ] |
| 135 | + }, |
| 136 | + { |
| 137 | + "cell_type": "markdown", |
| 138 | + "id": "a031c2d9-9de4-4b00-9332-51261969aecb", |
| 139 | + "metadata": {}, |
| 140 | + "source": [ |
| 141 | + "In the following tutorials, you will learn how to:\n", |
| 142 | + "- Use adaptor classes to load common actigraphy file formats.\n", |
| 143 | + "- Work directly with the `Raw` class to import and preprocess custom actigraphy data.\n", |
| 144 | + "- Compute widely used actigraphy-derived metrics.\n", |
| 145 | + "- Perform automatic rest/sleep detection.\n", |
| 146 | + "- Apply mathematical models to characterize circadian rhythms and extract mechanistic insights from behavioral time series." |
| 147 | + ] |
| 148 | + } |
| 149 | + ], |
| 150 | + "metadata": { |
| 151 | + "kernelspec": { |
| 152 | + "display_name": "Python 3 (ipykernel)", |
| 153 | + "language": "python", |
| 154 | + "name": "python3" |
| 155 | + }, |
| 156 | + "language_info": { |
| 157 | + "codemirror_mode": { |
| 158 | + "name": "ipython", |
| 159 | + "version": 3 |
| 160 | + }, |
| 161 | + "file_extension": ".py", |
| 162 | + "mimetype": "text/x-python", |
| 163 | + "name": "python", |
| 164 | + "nbconvert_exporter": "python", |
| 165 | + "pygments_lexer": "ipython3", |
| 166 | + "version": "3.13.7" |
| 167 | + } |
| 168 | + }, |
| 169 | + "nbformat": 4, |
| 170 | + "nbformat_minor": 5 |
| 171 | +} |
0 commit comments