ethoscopy 2.2.1__tar.gz → 2.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. ethoscopy-2.4.0/.claude/settings.local.json +48 -0
  2. ethoscopy-2.4.0/.gitignore +24 -0
  3. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/Docker/Dockerfile +34 -8
  4. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/Docker/README.md +35 -0
  5. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/Docker/docker-compose.yml +1 -1
  6. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/PKG-INFO +4 -1
  7. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/README.md +2 -0
  8. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/pyproject.toml +5 -1
  9. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/src/ethoscopy/__init__.py +6 -0
  10. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/src/ethoscopy/behavpy_core.py +271 -39
  11. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/src/ethoscopy/behavpy_draw.py +83 -0
  12. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/src/ethoscopy/behavpy_plotly.py +267 -0
  13. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/src/ethoscopy/behavpy_seaborn.py +267 -0
  14. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/src/ethoscopy/load.py +615 -39
  15. ethoscopy-2.4.0/src/ethoscopy/survival.py +335 -0
  16. ethoscopy-2.4.0/tasks/todo.md +369 -0
  17. ethoscopy-2.4.0/tests/test_load_diagnostics.py +200 -0
  18. ethoscopy-2.4.0/tests/test_load_light.py +420 -0
  19. ethoscopy-2.4.0/tests/test_survival.py +530 -0
  20. ethoscopy-2.4.0/uv.lock +1922 -0
  21. ethoscopy-2.2.1/.gitignore +0 -11
  22. ethoscopy-2.2.1/Docker/.env.keycloak +0 -39
  23. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/.codecov.yml +0 -0
  24. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/.github/workflows/ci.yml +0 -0
  25. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/.github/workflows/release.yml +0 -0
  26. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/.pre-commit-config.yaml +0 -0
  27. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/CLAUDE.md +0 -0
  28. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/Docker/.env.dummy.example +0 -0
  29. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/Docker/.env.github.example +0 -0
  30. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/Docker/.env.gitlab.example +0 -0
  31. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/Docker/.env.google.example +0 -0
  32. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/Docker/.env.keycloak.example +0 -0
  33. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/Docker/README_AUTH.md +0 -0
  34. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/Docker/config/jupyterhub_config.py +0 -0
  35. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/Docker/config/users.py +0 -0
  36. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/Docker/install_r_packages.r +0 -0
  37. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/Docker/jupyterhub_data/jupyterhub_config.py +0 -0
  38. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/LICENSE +0 -0
  39. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/TESTING.md +0 -0
  40. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/_config.yml +0 -0
  41. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/pytest.ini +0 -0
  42. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/run_tests.py +0 -0
  43. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/scripts/README.md +0 -0
  44. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/scripts/convert_databases.sh +0 -0
  45. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/scripts/convert_wal_to_delete.py +0 -0
  46. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/scripts/publish_tutorials.py +0 -0
  47. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/setup.py +0 -0
  48. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/src/ethoscopy/analyse.py +0 -0
  49. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/src/ethoscopy/behavpy.py +0 -0
  50. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/src/ethoscopy/behavpy_HMM_class.py +0 -0
  51. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/src/ethoscopy/behavpy_class.py +0 -0
  52. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/src/ethoscopy/behavpy_periodogram_class.py +0 -0
  53. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/src/ethoscopy/metadata_db.py +0 -0
  54. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/src/ethoscopy/misc/__init__.py +0 -0
  55. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/src/ethoscopy/misc/circadian_bars.py +0 -0
  56. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/src/ethoscopy/misc/general_functions.py +0 -0
  57. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/src/ethoscopy/misc/get_HMM.py +0 -0
  58. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/src/ethoscopy/misc/get_tutorials.py +0 -0
  59. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/src/ethoscopy/misc/hmm_functions.py +0 -0
  60. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/src/ethoscopy/misc/periodogram_functions.py +0 -0
  61. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/src/ethoscopy/misc/validate_datetime.py +0 -0
  62. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/tests/__init__.py +0 -0
  63. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/tests/conftest.py +0 -0
  64. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/tests/data/README.md +0 -0
  65. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/tests/data/test_ethoscope.db +0 -0
  66. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/tests/test_analyse.py +0 -0
  67. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/tests/test_baseline_enhancements.py +0 -0
  68. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/tests/test_behavpy.py +0 -0
  69. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/tests/test_behavpy_core_simple.py +0 -0
  70. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/tests/test_compatibility_classes.py +0 -0
  71. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/tests/test_general_functions.py +0 -0
  72. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/tests/test_get_tutorials.py +0 -0
  73. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/tests/test_load.py +0 -0
  74. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/tests/test_load_comprehensive.py +0 -0
  75. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/tests/test_load_metadata_fixes.py +0 -0
  76. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/tests/test_load_optimizations.py +0 -0
  77. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/tests/test_load_wal.py +0 -0
  78. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/tutorial_notebook/1_Overview_tutorial.ipynb +0 -0
  79. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/tutorial_notebook/2_HMM_tutorial.ipynb +0 -0
  80. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/tutorial_notebook/3_Circadian_tutorial.ipynb +0 -0
  81. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/tutorial_notebook/4_Navigating_db_tutorial.ipynb +0 -0
  82. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/tutorial_notebook/5_Ethoscopy_catch22_tutorial.ipynb +0 -0
  83. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/tutorial_notebook/6_Ethoscopy_to_hctsa_tutorial.ipynb +0 -0
  84. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/tutorial_notebook/ethoscope_db.csv +0 -0
  85. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/tutorial_notebook/jones_et_al_metadata.csv +0 -0
  86. {ethoscopy-2.2.1 → ethoscopy-2.4.0}/tutorial_notebook/notebook_paper.ipynb +0 -0
@@ -0,0 +1,48 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(wc:*)",
5
+ "Bash(paplay:*)",
6
+ "Bash(ETHOSCOPE_DATA_PATH=/mnt/ethoscope_data docker compose:*)",
7
+ "Bash(docker ps:*)",
8
+ "Bash(docker logs:*)",
9
+ "Bash(docker compose:*)",
10
+ "Bash(curl:*)",
11
+ "Bash(docker exec:*)",
12
+ "Bash(mkdir -p /tmp/ethoscopy_wheel_inspect)",
13
+ "Read(//tmp/**)",
14
+ "Bash(pip download *)",
15
+ "Bash(unzip -l ethoscopy-2.0.4-py3-none-any.whl)",
16
+ "Bash(git check-ignore *)",
17
+ "Bash(/home/gg/Code/ethoscope_project/ethoscopy/.venv/bin/pip install *)",
18
+ "Bash(.venv/bin/python -m pytest tests/test_get_tutorials.py -v)",
19
+ "Bash(.venv/bin/python *)",
20
+ "Bash(.venv/bin/pip install *)",
21
+ "Bash(gh auth *)",
22
+ "Bash(gh repo *)",
23
+ "Bash(docker info *)",
24
+ "mcp__bookstack__bookstack_search",
25
+ "Bash(.venv/bin/ruff check *)",
26
+ "Bash(.venv/bin/black --check src/ tests/)",
27
+ "Bash(.venv/bin/black src/ethoscopy/misc/get_tutorials.py tests/test_get_tutorials.py)",
28
+ "mcp__bookstack__bookstack_pages_read",
29
+ "mcp__bookstack__bookstack_pages_update",
30
+ "Bash(gh issue create --repo gilestrolab/ethoscopy --title 'Tutorial data pickles missing from PyPI wheel \\(2.0.0 – 2.0.4\\)' --body ' *)",
31
+ "Bash(git add *)",
32
+ "Bash(git commit *)",
33
+ "Bash(git push *)",
34
+ "Bash(git tag *)",
35
+ "Bash(gh release create v2.0.5 --repo gilestrolab/ethoscopy --title 'v2.0.5 — package tutorial data separately' --notes ' *)",
36
+ "Bash(gh run *)",
37
+ "Bash(gh issue *)",
38
+ "Bash(.venv/bin/twine check *)",
39
+ "Bash(.venv/bin/twine upload *)",
40
+ "Bash(.venv/bin/pip index *)",
41
+ "Bash(ETHOSCOPE_LAB_TAG=1.2 docker compose build)",
42
+ "Bash(gh release *)",
43
+ "Bash(ETHOSCOPE_LAB_TAG=1.2 docker compose build --no-cache --progress=plain)",
44
+ "Bash(grep -E --line-buffered '^#[0-9]+ \\(ERROR|CANCELED\\)|^#[0-9]+ DONE [0-9.]+s$|^ERROR|^failed to solve|Execution halted|^Error: Required R packages|non-zero code|^naming to|^ *=> .* done *$')",
45
+ "Bash(grep -E --line-buffered '^#[0-9]+ \\(ERROR|CANCELED\\)$|^#[0-9]+ DONE [0-9.]+s$|^failed to solve|Execution halted|^Error: Required R packages|Successfully built|naming to docker\\\\.io')"
46
+ ]
47
+ }
48
+ }
@@ -0,0 +1,24 @@
1
+ *.txt
2
+ *.pyc
3
+ *venv
4
+ dist/
5
+ *vscode
6
+ __pycache__/
7
+ ethoscopy.egg-info/
8
+ .gitignore
9
+ *.pkl
10
+ .python-version
11
+ tmp
12
+
13
+ # JupyterHub runtime state, generated when the Docker stack first runs.
14
+ # jupyterhub_cookie_secret signs session cookies and jupyterhub.sqlite holds
15
+ # user records and API tokens; neither belongs in the repo. Committing the
16
+ # secret would be the same failure as the tracked .env.keycloak removed in
17
+ # 6cbcbbe. jupyterhub_config.py stays tracked - it is configuration, not state.
18
+ Docker/jupyterhub_data/jupyterhub_cookie_secret
19
+ Docker/jupyterhub_data/jupyterhub.sqlite
20
+
21
+ # Coverage output
22
+ .coverage
23
+ htmlcov/
24
+ coverage.xml
@@ -105,19 +105,13 @@ RUN pip3 install \
105
105
  openpyxl \
106
106
  pyarrow \
107
107
  tqdm \
108
- jupyterlab-git \
109
- ethoscopy==2.2.0
108
+ jupyterlab-git
110
109
  # pycatch22
111
110
 
112
- # Pre-populate tutorial datasets inside the installed package so non-root
113
- # JupyterHub users don't have to download them on first notebook run. The
114
- # pickles (~36 MB total) live in the ethoscopy repo, not the PyPI wheel.
115
- RUN python3 -c "from ethoscopy.misc.get_tutorials import download_tutorial_data, package_tutorial_data_dir; download_tutorial_data(dest_dir=package_tutorial_data_dir(), verbose=True)"
116
-
117
111
  # Install Ethoscope from source
118
112
  RUN git clone https://github.com/gilestrolab/ethoscope.git /opt/ethoscope && \
119
113
  cd /opt/ethoscope/ && git checkout dev && \
120
- cd /opt/ethoscope/src/ethoscope && pip install .
114
+ cd /opt/ethoscope/src/ethoscope && pip install .
121
115
 
122
116
  # ============================================================================
123
117
  # USER SETUP
@@ -127,6 +121,38 @@ RUN git clone https://github.com/gilestrolab/ethoscope.git /opt/ethoscope && \
127
121
  RUN useradd -m ethoscopelab && \
128
122
  echo 'ethoscopelab:ethoscope' | chpasswd
129
123
 
124
+ # ============================================================================
125
+ # ETHOSCOPY (kept last on purpose)
126
+ # ============================================================================
127
+ # Reason: ethoscopy is the fastest-moving pin in this image and the one most
128
+ # often bumped for a bugfix. Everything above — the ~1 h R-package compile, the
129
+ # scientific pip stack, ethoscope-from-source — is stable, so installing
130
+ # ethoscopy in its own late layer means a version bump rebuilds only these two
131
+ # steps (seconds) instead of invalidating the whole pip block. Keep this the
132
+ # last software install; put nothing slow after it. Bumping the pin below is the
133
+ # only change needed to ship a new ethoscopy into the image.
134
+ RUN pip3 install ethoscopy==2.3.0
135
+
136
+ # Pre-populate tutorial datasets inside the installed package so non-root
137
+ # JupyterHub users don't have to download them on first notebook run. The
138
+ # pickles (~36 MB total) live in the ethoscopy repo, not the PyPI wheel.
139
+ #
140
+ # This is best-effort. urlretrieve() has no timeout, so a stalled connection to
141
+ # GitHub would hang the build forever (observed: a 36 MB / ~8 s download stuck
142
+ # >25 min); cap each connection with socket.setdefaulttimeout and retry, using
143
+ # overwrite so a socket killed mid-write cannot leave a partial file the next
144
+ # attempt skips as "already present". If it still cannot reach GitHub (e.g. a
145
+ # build host whose Docker bridge network is firewalled off from GitHub while the
146
+ # container's runtime network is not), warn and continue rather than failing the
147
+ # whole image: ethoscopy fetches the tutorial data on demand at first use, so a
148
+ # missing prefetch only costs a one-time download inside the user's session.
149
+ RUN for attempt in 1 2 3; do \
150
+ python3 -c "import socket; socket.setdefaulttimeout(60); from ethoscopy.misc.get_tutorials import download_tutorial_data, package_tutorial_data_dir; download_tutorial_data(dest_dir=package_tutorial_data_dir(), overwrite=True, verbose=True)" && exit 0; \
151
+ echo "tutorial download attempt $attempt failed; retrying in 5s..."; \
152
+ sleep 5; \
153
+ done; \
154
+ echo "WARNING: could not pre-populate tutorial data at build time; it will download on first use at runtime." >&2
155
+
130
156
  # ============================================================================
131
157
  # FINAL CONFIGURATION
132
158
  # ============================================================================
@@ -12,6 +12,41 @@ The command to use to recreate that image is `JUPYTER_HUB_TAG=5.3.0 ETHOSCOPE_LA
12
12
 
13
13
  After creation, the image can be run using the enclosed `docker-compose.yml` file, replacing values as fit.
14
14
 
15
+ ### The GPU does not speed up the build (it is a *runtime* resource)
16
+
17
+ A recurring confusion: **`docker compose build` cannot use the GPU, no matter what.**
18
+ The host does have an NVIDIA GPU (e.g. an RTX A4000) and the *running* container is
19
+ given access to it via the `deploy.resources.reservations.devices: capabilities: ["gpu"]`
20
+ block in `docker-compose.yml` — that is what GPU-aware analysis inside the notebook uses.
21
+ But building the image is an entirely separate phase that runs on CPU: BuildKit has no
22
+ GPU path, and every slow step here is CPU/IO-bound anyway.
23
+
24
+ What actually makes the build slow (~1–1.5 h from cold) is, in order:
25
+
26
+ 1. **Compiling the 8 R packages** from source (`Rscript install_r_packages.r`) — by far
27
+ the biggest cost, and pure CPU.
28
+ 2. `pip install` of the JupyterLab / notebook-intelligence / scientific stack.
29
+ 3. `apt-get` and the `git clone` of ethoscope.
30
+
31
+ None of these is GPU-accelerable. If a rebuild is taking the full hour+ it is almost
32
+ always because the **build cache was lost**, forcing the R compile to re-run. To avoid
33
+ re-paying it:
34
+
35
+ - **Do not kill a build mid-layer.** BuildKit only commits a layer's cache when that
36
+ layer *finishes*; a build killed during the R step discards it and the next build
37
+ recompiles from scratch.
38
+ - **Bumping `ethoscopy==X.Y.Z` only invalidates the pip layer and below.** The R compile
39
+ sits earlier in the `Dockerfile`, so a version-pin bump should reuse the cached R layer
40
+ and finish in minutes — *provided the cache still exists*. Old cache is eventually
41
+ evicted (`docker buildx du` shows what is reclaimable), which is the usual reason an
42
+ "only changed the pin" rebuild still takes an hour.
43
+ - **Prefer pulling over building.** Regular deployments should `docker pull
44
+ ggilestro/ethoscope-lab:<tag>` rather than rebuild; only rebuild when the recipe itself
45
+ changes, then push the result so nobody else has to.
46
+
47
+ Rule of thumb: reach for the GPU to make *analysis* faster, never to make the *image build*
48
+ faster — there is nothing to accelerate there.
49
+
15
50
  ## Authentication and User Management
16
51
 
17
52
  This JupyterHub instance supports multiple authentication methods including:
@@ -6,7 +6,7 @@ services:
6
6
  dockerfile: Dockerfile
7
7
  args:
8
8
  JUPYTER_HUB_TAG: ${JUPYTER_HUB_TAG:-5.4.0}
9
- image: ggilestro/ethoscope-lab:${ETHOSCOPE_LAB_TAG:-1.3}
9
+ image: ggilestro/ethoscope-lab:${ETHOSCOPE_LAB_TAG:-1.4}
10
10
  container_name: ethoscope-lab
11
11
  ports:
12
12
  - 8082:8000
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: ethoscopy
3
- Version: 2.2.1
3
+ Version: 2.4.0
4
4
  Summary: "A python based toolkit to download and anlyse data from the Ethoscope hardware system."
5
5
  Author-email: Lblackhurst29 <lblackhurst29@gmail.com>
6
6
  License-File: LICENSE
@@ -19,6 +19,7 @@ Requires-Dist: hmmlearn<0.4.0,>=0.3.2
19
19
  Requires-Dist: nbformat<6.0.0,>=5.10.4
20
20
  Requires-Dist: numpy<3.0.0,>=2.0.0
21
21
  Requires-Dist: pandas<3.0.0,>=2.2.2
22
+ Requires-Dist: pillow<13.0,>=10.0
22
23
  Requires-Dist: plotly<6.0.0,>=5.22.0
23
24
  Requires-Dist: pywavelets<2.0.0,>=1.6.0
24
25
  Requires-Dist: seaborn<0.14.0,>=0.13.2
@@ -55,6 +56,8 @@ At its core ethoscopy is a subclass of the data manipulation tool Pandas. The da
55
56
 
56
57
  Ethoscopy contains methods to perform common analytical techniques per specimen in the data table, such as removing dead specimens, interpolating missing values, or calculating sleep from movement. Addtionally, specialist anlysing tools have been implemented for analysing circadian rhythm, such as periodograms, and for generating hidden Markov models (HMM) to understand latent behavioural states. HMMs are trained utilising hmmlearn in the background and come accompanied with a range of visualisation tools to understand the generated model.
57
58
 
59
+ For lifespan experiments, `survival_table()` and `km_survival_plot()` estimate Kaplan-Meier survival curves with Greenwood confidence bands. Death is detected from sustained immobility using the same rule as `curate_dead_animals()`, and specimens still moving when their recording ends are censored rather than counted as deaths. Pass `subject_cols` when one animal was recorded across several sessions so its recordings are treated as one individual.
60
+
58
61
  ### -- Update to 2.0 --
59
62
 
60
63
  This new update sees a whole refactoring of the code base to make everything more streamline and keep the package up to date with the new versions of pandas and numpy. Gone are seperate classes for periodograms and HMM based analysis, all are under one class behavpy(). Addtioanlly, now the user can choose between plotter packages, Seaborn and Plotly, and choose a desired colour pallete. The previous used package Plotly can balloon the size of jupyter notebooks, putting a strain on storage, despite being great for data exploration. If you just want static plots, use Seaborn. But be wary of comparison, the backend for Plotly plots is all calculated in ethoscopy applying z-score and bootstrapping to quantification plots, whereas Seaborn based plots will use the Seaborn internal tools for errors and averaging.
@@ -17,6 +17,8 @@ At its core ethoscopy is a subclass of the data manipulation tool Pandas. The da
17
17
 
18
18
  Ethoscopy contains methods to perform common analytical techniques per specimen in the data table, such as removing dead specimens, interpolating missing values, or calculating sleep from movement. Addtionally, specialist anlysing tools have been implemented for analysing circadian rhythm, such as periodograms, and for generating hidden Markov models (HMM) to understand latent behavioural states. HMMs are trained utilising hmmlearn in the background and come accompanied with a range of visualisation tools to understand the generated model.
19
19
 
20
+ For lifespan experiments, `survival_table()` and `km_survival_plot()` estimate Kaplan-Meier survival curves with Greenwood confidence bands. Death is detected from sustained immobility using the same rule as `curate_dead_animals()`, and specimens still moving when their recording ends are censored rather than counted as deaths. Pass `subject_cols` when one animal was recorded across several sessions so its recordings are treated as one individual.
21
+
20
22
  ### -- Update to 2.0 --
21
23
 
22
24
  This new update sees a whole refactoring of the code base to make everything more streamline and keep the package up to date with the new versions of pandas and numpy. Gone are seperate classes for periodograms and HMM based analysis, all are under one class behavpy(). Addtioanlly, now the user can choose between plotter packages, Seaborn and Plotly, and choose a desired colour pallete. The previous used package Plotly can balloon the size of jupyter notebooks, putting a strain on storage, despite being great for data exploration. If you just want static plots, use Seaborn. But be wary of comparison, the backend for Plotly plots is all calculated in ethoscopy applying z-score and bootstrapping to quantification plots, whereas Seaborn based plots will use the Seaborn internal tools for errors and averaging.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ethoscopy"
3
- version = "2.2.1"
3
+ version = "2.4.0"
4
4
  description = "\"A python based toolkit to download and anlyse data from the Ethoscope hardware system.\""
5
5
  authors = [{name = "Lblackhurst29",email = "lblackhurst29@gmail.com"}]
6
6
  readme = "README.md"
@@ -16,6 +16,10 @@ dependencies = [
16
16
  "astropy>=7.0,<8.0",
17
17
  "nbformat>=5.10.4,<6.0.0",
18
18
  "tqdm>=4.66,<5.0",
19
+ # estimate_light_cycle() decodes the stored IMG_SNAPSHOTS JPEGs. Pillow
20
+ # already arrived transitively through seaborn -> matplotlib; this makes the
21
+ # direct dependency explicit.
22
+ "pillow>=10.0,<13.0",
19
23
  ]
20
24
  requires-python = ">=3.12,<4.0"
21
25
  classifiers = [
@@ -15,8 +15,11 @@ from ethoscopy.analyse import (
15
15
  from ethoscopy.behavpy import behavpy
16
16
  from ethoscopy.load import (
17
17
  download_from_remote_dir,
18
+ estimate_light_cycle,
18
19
  link_meta_index,
19
20
  load_ethoscope,
21
+ load_ethoscope_diagnostics,
22
+ load_ethoscope_light_schedule,
20
23
  load_ethoscope_metadata,
21
24
  )
22
25
  from ethoscopy.misc.general_functions import concat
@@ -28,9 +31,12 @@ __all__ = [
28
31
  "behavpy",
29
32
  "download_from_remote_dir",
30
33
  "download_tutorial_data",
34
+ "estimate_light_cycle",
31
35
  "get_tutorial",
32
36
  "link_meta_index",
33
37
  "load_ethoscope",
38
+ "load_ethoscope_diagnostics",
39
+ "load_ethoscope_light_schedule",
34
40
  "load_ethoscope_metadata",
35
41
  "max_velocity_detector",
36
42
  "sleep_annotation",