ethoscopy 2.0__tar.gz → 2.0.1__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 (50) hide show
  1. ethoscopy-2.0.1/.claude/settings.local.json +16 -0
  2. ethoscopy-2.0.1/.gitignore +10 -0
  3. ethoscopy-2.0.1/CLAUDE.md +111 -0
  4. ethoscopy-2.0.1/Docker/Dockerfile +108 -0
  5. ethoscopy-2.0.1/Docker/README.md +87 -0
  6. ethoscopy-2.0.1/Docker/docker-compose.yml +25 -0
  7. ethoscopy-2.0.1/Docker/install_r_packages.r +75 -0
  8. ethoscopy-2.0.1/Docker/jupyterhub_data/jupyterhub_config.py +54 -0
  9. {ethoscopy-2.0 → ethoscopy-2.0.1}/PKG-INFO +25 -24
  10. {ethoscopy-2.0 → ethoscopy-2.0.1}/README.md +9 -1
  11. ethoscopy-2.0.1/_config.yml +1 -0
  12. ethoscopy-2.0.1/pyproject.toml +38 -0
  13. ethoscopy-2.0.1/setup.py +39 -0
  14. {ethoscopy-2.0 → ethoscopy-2.0.1}/src/ethoscopy/load.py +121 -54
  15. ethoscopy-2.0.1/tutorial_notebook/1_Overview_tutorial.ipynb +1837 -0
  16. ethoscopy-2.0.1/tutorial_notebook/2_HMM_tutorial.ipynb +827 -0
  17. ethoscopy-2.0.1/tutorial_notebook/3_Circadian_tutorial.ipynb +1766 -0
  18. ethoscopy-2.0.1/tutorial_notebook/4_Navigating_db_tutorial.ipynb +415 -0
  19. ethoscopy-2.0.1/tutorial_notebook/5_Ethoscopy_catch22_tutorial.ipynb +1149 -0
  20. ethoscopy-2.0.1/tutorial_notebook/6_Ethoscopy_to_hctsa_tutorial.ipynb +468 -0
  21. ethoscopy-2.0.1/tutorial_notebook/ethoscope_db.csv +16801 -0
  22. ethoscopy-2.0.1/tutorial_notebook/jones_et_al_metadata.csv +8721 -0
  23. ethoscopy-2.0.1/tutorial_notebook/notebook_paper.ipynb +206 -0
  24. ethoscopy-2.0/pyproject.toml +0 -28
  25. ethoscopy-2.0/src/ethoscopy/misc/tutorial_data/4_states_F_WT.pkl +0 -0
  26. ethoscopy-2.0/src/ethoscopy/misc/tutorial_data/4_states_M_WT.pkl +0 -0
  27. ethoscopy-2.0/src/ethoscopy/misc/tutorial_data/circadian_data.pkl +0 -0
  28. ethoscopy-2.0/src/ethoscopy/misc/tutorial_data/circadian_meta.pkl +0 -0
  29. ethoscopy-2.0/src/ethoscopy/misc/tutorial_data/overview_data.pkl +0 -0
  30. ethoscopy-2.0/src/ethoscopy/misc/tutorial_data/overview_meta.pkl +0 -0
  31. {ethoscopy-2.0 → ethoscopy-2.0.1}/LICENSE +0 -0
  32. {ethoscopy-2.0 → ethoscopy-2.0.1}/src/ethoscopy/__init__.py +0 -0
  33. {ethoscopy-2.0 → ethoscopy-2.0.1}/src/ethoscopy/analyse.py +0 -0
  34. {ethoscopy-2.0 → ethoscopy-2.0.1}/src/ethoscopy/behavpy.py +0 -0
  35. {ethoscopy-2.0 → ethoscopy-2.0.1}/src/ethoscopy/behavpy_HMM_class.py +0 -0
  36. {ethoscopy-2.0 → ethoscopy-2.0.1}/src/ethoscopy/behavpy_class.py +0 -0
  37. {ethoscopy-2.0 → ethoscopy-2.0.1}/src/ethoscopy/behavpy_core.py +0 -0
  38. {ethoscopy-2.0 → ethoscopy-2.0.1}/src/ethoscopy/behavpy_draw.py +0 -0
  39. {ethoscopy-2.0 → ethoscopy-2.0.1}/src/ethoscopy/behavpy_periodogram_class.py +0 -0
  40. {ethoscopy-2.0 → ethoscopy-2.0.1}/src/ethoscopy/behavpy_plotly.py +0 -0
  41. {ethoscopy-2.0 → ethoscopy-2.0.1}/src/ethoscopy/behavpy_seaborn.py +0 -0
  42. {ethoscopy-2.0 → ethoscopy-2.0.1}/src/ethoscopy/metadata_db.py +0 -0
  43. {ethoscopy-2.0 → ethoscopy-2.0.1}/src/ethoscopy/misc/__init__.py +0 -0
  44. {ethoscopy-2.0 → ethoscopy-2.0.1}/src/ethoscopy/misc/circadian_bars.py +0 -0
  45. {ethoscopy-2.0 → ethoscopy-2.0.1}/src/ethoscopy/misc/general_functions.py +0 -0
  46. {ethoscopy-2.0 → ethoscopy-2.0.1}/src/ethoscopy/misc/get_HMM.py +0 -0
  47. {ethoscopy-2.0 → ethoscopy-2.0.1}/src/ethoscopy/misc/get_tutorials.py +0 -0
  48. {ethoscopy-2.0 → ethoscopy-2.0.1}/src/ethoscopy/misc/hmm_functions.py +0 -0
  49. {ethoscopy-2.0 → ethoscopy-2.0.1}/src/ethoscopy/misc/periodogram_functions.py +0 -0
  50. {ethoscopy-2.0 → ethoscopy-2.0.1}/src/ethoscopy/misc/validate_datetime.py +0 -0
@@ -0,0 +1,16 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(paplay:*)",
5
+ "Bash(rg:*)",
6
+ "Bash(sqlite3:*)",
7
+ "Bash(python test:*)",
8
+ "Bash(source:*)",
9
+ "Bash(python:*)",
10
+ "Bash(rm:*)",
11
+ "Bash(git add:*)",
12
+ "Bash(git push:*)"
13
+ ],
14
+ "deny": []
15
+ }
16
+ }
@@ -0,0 +1,10 @@
1
+ *.txt
2
+ *.pyc
3
+ *venv
4
+ dist/
5
+ *vscode
6
+ __pycache__/
7
+ ethoscopy.egg-info/
8
+ .gitignore
9
+ *.pkl
10
+ .python-version
@@ -0,0 +1,111 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ Ethoscopy is a Python data analysis toolbox for behavioral time series data from Ethoscope (Drosophila monitoring system). It's built as a specialized pandas DataFrame subclass that maintains linked metadata and provides analysis/visualization tools for circadian rhythms, sleep patterns, and behavioral states using HMM.
8
+
9
+ ## Development Environment
10
+
11
+ ### Python Environment
12
+ - **Use Python 3.10+** (project requires >=3.10,<4.0)
13
+ - **Always use virtual environment** (`venv_linux` as mentioned in user's global instructions)
14
+ - **Install in development mode**: `pip install -e .`
15
+
16
+ ### Package Management
17
+ - Uses **pyproject.toml** for modern Python packaging (not setup.py for production)
18
+ - **Hatchling** as build backend
19
+ - **Rye** for dependency management (managed = true in pyproject.toml)
20
+
21
+ ### Key Dependencies
22
+ - Core: pandas >=2.2.2, numpy >=2.0.0
23
+ - Visualization: plotly >=5.22.0, seaborn >=0.13.2
24
+ - Analysis: hmmlearn >=0.3.2, astropy >=6.1, pywavelets >=1.6.0
25
+ - Dev: ipykernel for Jupyter notebook support
26
+
27
+ ## Build and Development Commands
28
+
29
+ ### Installation
30
+ ```bash
31
+ # Install in development mode
32
+ pip install -e .
33
+
34
+ # For Jupyter notebook development
35
+ pip install -e ".[dev]"
36
+ ```
37
+
38
+ ### Testing
39
+ - **No formal test suite found** - project relies on Jupyter notebooks for validation
40
+ - Use the tutorial notebooks in `tutorial_notebook/` for testing functionality
41
+ - Run notebooks: `jupyter notebook tutorial_notebook/`
42
+
43
+ ### Docker Environment
44
+ - **Docker available** for JupyterHub deployment
45
+ - Build: `JUPYTER_HUB_TAG=5.3.0 ETHOSCOPE_LAB_TAG=1.0 docker compose build`
46
+ - Run: `docker compose up -d` (from Docker/ directory)
47
+
48
+ ## Architecture and Code Structure
49
+
50
+ ### Core Architecture
51
+ - **behavpy_core**: Base DataFrame subclass with core functionality (xmv, curate, summary)
52
+ - **behavpy**: Main user-facing class for backward compatibility
53
+ - **Canvas System**: Supports both 'plotly' and 'seaborn' for visualization backends
54
+
55
+ ### Key Components
56
+ 1. **Data Loading** (`load.py`): FTP download, ethoscope database loading, metadata linking
57
+ 2. **Analysis** (`analyse.py`): Sleep annotation, velocity detection, stimulus response
58
+ 3. **Visualization**: Split between plotly (`behavpy_plotly.py`) and seaborn (`behavpy_seaborn.py`)
59
+ 4. **Specialized Classes**:
60
+ - `behavpy_HMM_class.py`: Hidden Markov Model analysis
61
+ - `behavpy_periodogram_class.py`: Circadian rhythm analysis
62
+ 5. **Utilities** (`misc/`): General functions, validation, tutorial data
63
+
64
+ ### Data Structure
65
+ - **Dual DataFrame design**: Main data + linked metadata via shared 'id' column
66
+ - **Metadata cleaning**: Automatically removes columns like 'path', 'file_name', 'file_size', 'machine_id'
67
+ - **Index requirement**: Data must have 'id' as index name
68
+
69
+ ### Import Pattern
70
+ ```python
71
+ import ethoscopy as etho
72
+ df = etho.behavpy(data, metadata, check=True, canvas='plotly', palette='Set2')
73
+ ```
74
+
75
+ ## Key Design Patterns
76
+
77
+ ### Version 2.0 Migration
78
+ - **Backward compatible** with pre-2.0 pickled data
79
+ - **Unified class structure**: All analysis under single `behavpy()` class
80
+ - **Canvas selection**: Choose between plotly/seaborn at initialization
81
+ - **New concat function**: Use `etho.concat()` instead of `behavpy_object.concat()`
82
+
83
+ ### Plotting Architecture
84
+ - **Dual backend support**: Plotly (interactive) vs Seaborn (static)
85
+ - **Built-in statistical processing**: Z-score normalization, bootstrapping for plotly
86
+ - **Seaborn backend**: Uses seaborn's internal statistics
87
+ - **Performance consideration**: Plotly can create large notebook files
88
+
89
+ ### Analysis Capabilities
90
+ - **Sleep detection**: Movement-based sleep annotation
91
+ - **Circadian analysis**: Periodograms (Lomb-Scargle, Fourier, Wavelet)
92
+ - **HMM behavioral states**: Using hmmlearn with visualization tools
93
+ - **Data curation**: Dead specimen removal, interpolation, filtering
94
+
95
+ ## Development Guidelines
96
+
97
+ ### Code Organization
98
+ - **src/ethoscopy/**: Main package code
99
+ - **tutorial_notebook/**: Jupyter notebooks for testing and examples
100
+ - **Docker/**: JupyterHub deployment configuration
101
+ - **Keep files under 500 lines** (per user's global instructions)
102
+
103
+ ### Testing Approach
104
+ - **Use Jupyter notebooks** for validation and testing
105
+ - **Tutorial notebooks serve as integration tests**
106
+ - **Always test with both canvas options** (plotly/seaborn)
107
+
108
+ ### Documentation
109
+ - **Docstrings**: Google style required for all functions
110
+ - **Tutorial notebooks**: Primary documentation method
111
+ - **README.md**: Keep updated with installation and basic usage
@@ -0,0 +1,108 @@
1
+ # Dockerfile for jupyter-rethomics
2
+ ARG JUPYTER_HUB_TAG=5.3.0
3
+ FROM jupyterhub/jupyterhub:${JUPYTER_HUB_TAG}
4
+
5
+ # ============================================================================
6
+ # SYSTEM DEPENDENCIES AND TOOLS
7
+ # ============================================================================
8
+
9
+ # Install system prerequisites and build tools
10
+ RUN apt-get update && \
11
+ apt-get install -y --no-install-recommends \
12
+ fonts-dejavu \
13
+ apt-utils \
14
+ nano \
15
+ jq \
16
+ git \
17
+ gfortran \
18
+ file \
19
+ gcc \
20
+ cmake \
21
+ libcurl4-openssl-dev \
22
+ libfontconfig1-dev \
23
+ libharfbuzz-dev \
24
+ libfribidi-dev \
25
+ libtiff-dev \
26
+ libxml2-dev \
27
+ libpam0g-dev \
28
+ wget \
29
+ lsb-release \
30
+ software-properties-common \
31
+ dirmngr \
32
+ jupyter && \
33
+ apt-get clean && \
34
+ rm -rf /var/lib/apt/lists/*
35
+
36
+ # ============================================================================
37
+ # R INSTALLATION AND SETUP
38
+ # ============================================================================
39
+
40
+ # Add CRAN repository for latest R version
41
+ RUN wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc && \
42
+ add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/" -y
43
+
44
+ # Install R from CRAN repository
45
+ RUN apt-get update && \
46
+ apt-get install -y r-base r-base-dev && \
47
+ apt-get clean && \
48
+ rm -rf /var/lib/apt/lists/*
49
+
50
+ # Install R packages and rethomics
51
+ COPY install_r_packages.r /root/install_r_packages.r
52
+ RUN ln -s /bin/tar /bin/gtar && \
53
+ Rscript /root/install_r_packages.r
54
+
55
+ # ============================================================================
56
+ # JUPYTER INSTALLATION AND CONFIGURATION
57
+ # ============================================================================
58
+
59
+ # Install JupyterLab (version 3.6.4)
60
+ RUN pip3 install jupyterlab --ignore-installed
61
+
62
+ # To upgrade to version 4.0.2 (commented out)
63
+ # RUN pip3 install jupyterlab --upgrade
64
+
65
+ # Install Jupyter extensions (compatible with 3.x only)
66
+ RUN pip3 install jupyterlab-spreadsheet-editor
67
+
68
+ # ============================================================================
69
+ # PYTHON PACKAGES AND ETHOSCOPE SETUP
70
+ # ============================================================================
71
+
72
+ # Install Python data science packages
73
+ RUN pip3 install \
74
+ pandas \
75
+ seaborn \
76
+ bokeh \
77
+ lifelines \
78
+ opencv-python \
79
+ mysql-connector \
80
+ ethoscopy
81
+ # pycatch22
82
+
83
+ # Install Ethoscope from source
84
+ RUN git clone https://github.com/gilestrolab/ethoscope.git /opt/ethoscope && \
85
+ cd /opt/ethoscope/ && git checkout dev && \
86
+ cd /opt/ethoscope/src/ethoscope && pip install .
87
+
88
+ # ============================================================================
89
+ # USER SETUP
90
+ # ============================================================================
91
+
92
+ # Add default user ethoscopelab with password ethoscopelab
93
+ RUN useradd -m ethoscopelab && \
94
+ echo 'ethoscopelab:ethoscope' | chpasswd
95
+
96
+ # ============================================================================
97
+ # FINAL CONFIGURATION
98
+ # ============================================================================
99
+
100
+ WORKDIR /srv/jupyterhub/
101
+ # JupyterHub config will be mounted via docker-compose
102
+
103
+ EXPOSE 8000
104
+
105
+ LABEL maintainer="Giorgio Gilestro <giorgio@gilest.ro>" \
106
+ org.jupyter.service="ethoscope-lab"
107
+
108
+ CMD ["jupyterhub"]
@@ -0,0 +1,87 @@
1
+ # Ethoscopelab docker instance
2
+
3
+ Note: Most users will **not** need to recreate this image. These instructions are just provided as reference.
4
+ The ethoscopelab docker instance lives on dockerhub at the following address: [https://hub.docker.com/r/ggilestro/ethoscope-lab](https://hub.docker.com/r/ggilestro/ethoscope-lab) and this is what regular users should download and run. Follow instructions there and on the [ethoscopy manual](https://bookstack.lab.gilest.ro/books/ethoscopy/page/getting-started).
5
+
6
+
7
+ ## Docker files that were used to create the ethoscope-lab docker instance
8
+
9
+ The files in this folder can be used to recreate the image as uploaded on dockerhub.
10
+
11
+ The command to use to recreate that image is `JUPYTER_HUB_TAG=5.3.0 ETHOSCOPE_LAB_TAG=1.0 docker compose build`. This creates the image with the specified tag. For Docker Hub deployment, push the image: `docker push ggilestro/ethoscope-lab:1.0`. To also create a latest tag: `docker tag ggilestro/ethoscope-lab:1.0 ggilestro/ethoscope-lab:latest && docker push ggilestro/ethoscope-lab:latest`. You can verify your local images with `docker images | grep ethoscope-lab`.
12
+
13
+ After creation, the image can be run using the enclosed `docker-compose.yml` file, replacing values as fit.
14
+
15
+ ## Add new users to the JupyterHub
16
+
17
+ To add new users to the JupyterHub instance:
18
+
19
+ ### 1. Modify the jupyterhub_config.py file
20
+
21
+ Edit the `allowed_users` set on lines 14-19 to include your new usernames:
22
+
23
+ ```python
24
+ c.Authenticator.allowed_users = {
25
+ 'amadabhushi', 'ggilestro', 'mjoyce', 'lguo',
26
+ 'labguest1', 'labguest2', 'labguest3', 'labguest4',
27
+ 'labguest5', 'labguest6', 'labguest7', 'labguest8',
28
+ 'ethoscopelab', 'newuser1', 'newuser2' # Add your new users here
29
+ }
30
+ ```
31
+
32
+ To make a user an admin, add them to the `admin_users` set on line 22:
33
+
34
+ ```python
35
+ c.Authenticator.admin_users = {'ggilestro', 'newadmin'}
36
+ ```
37
+
38
+ ### 2. Restart the Docker container
39
+
40
+ After modifying the config file:
41
+
42
+ ```bash
43
+ docker compose down
44
+ docker compose up -d
45
+ ```
46
+
47
+ **Notes:**
48
+ - All users share the same password: `ethoscope` (line 11)
49
+ - The system uses DummyAuthenticator for simple shared-password authentication
50
+ - Each user gets their own home directory at `/home/{username}`
51
+ - Home directories are created automatically when users first log in
52
+
53
+ ## Mounting Home Directories as Volumes
54
+
55
+ To persist user data and notebooks across container restarts, you should mount user home directories as Docker volumes. This is done by modifying the `docker-compose.yml` file.
56
+
57
+ ### Benefits of mounting home directories:
58
+
59
+ 1. **Data Persistence**: User notebooks, data files, and configurations survive container restarts and updates
60
+ 2. **Backup and Recovery**: Easy to backup user data by copying the mounted directories
61
+ 3. **Performance**: Direct access to host filesystem, avoiding container storage overhead
62
+ 4. **Sharing**: Users can access their files from the host system if needed
63
+
64
+ ### Example volume configuration:
65
+
66
+ Add volumes to your `docker-compose.yml`:
67
+
68
+ ```yaml
69
+ services:
70
+ jupyterhub:
71
+ volumes:
72
+ - ./user_data:/home # Maps host ./user_data to container /home
73
+ - ./jupyterhub_config.py:/srv/jupyterhub/jupyterhub_config.py
74
+ ```
75
+
76
+ Or for individual user directories:
77
+
78
+ ```yaml
79
+ volumes:
80
+ - ./users/ggilestro:/home/ggilestro
81
+ - ./users/amadabhushi:/home/amadabhushi
82
+ - ./users/shared:/home/shared # Shared directory for all users
83
+ ```
84
+
85
+ This ensures all user work is preserved even when containers are recreated or updated.
86
+
87
+
@@ -0,0 +1,25 @@
1
+ ---
2
+ services:
3
+ ethoscope-lab:
4
+ build:
5
+ context: .
6
+ dockerfile: Dockerfile
7
+ args:
8
+ JUPYTER_HUB_TAG: ${JUPYTER_HUB_TAG:-5.3.0}
9
+ image: ggilestro/ethoscope-lab:${ETHOSCOPE_LAB_TAG:-1.0}
10
+ container_name: ethoscope-lab
11
+ ports:
12
+ - 8082:8000
13
+ volumes:
14
+ - /mnt/ethoscope_data/results:/mnt/ethoscope_results:ro
15
+ - /mnt/ethoscope_data/ethoscope_metadata:/opt/ethoscope_metadata
16
+ - /mnt/ethoscopy/homes:/home
17
+ - /mnt/ethoscopy/cache:/home/cache
18
+ - ./jupyterhub_data:/srv/jupyterhub/
19
+ user: "${UID:-1000}:${GID:-1000}" # Adjust to your own user. Make sure this matches the permissions of your /mnt/{homes,cache} folder
20
+ restart: always
21
+ deploy:
22
+ resources:
23
+ reservations:
24
+ devices:
25
+ - capabilities: ["gpu"]
@@ -0,0 +1,75 @@
1
+ #!/bin/Rscript
2
+
3
+ install.packages(
4
+ c(
5
+ 'BiocManager',
6
+ 'caTools',
7
+ 'callr',
8
+ 'caret',
9
+ 'cowplot',
10
+ 'crayon',
11
+ 'curl',
12
+ 'DescTools',
13
+ 'devtools',
14
+ 'digest',
15
+ 'dplyr',
16
+ 'EnvStats',
17
+ 'forecast',
18
+ 'formatR',
19
+ 'ggplot2',
20
+ 'ggpubr',
21
+ 'ggtern',
22
+ 'ggthemes',
23
+ 'ggrepel',
24
+ 'ggseas',
25
+ 'gh',
26
+ 'git2r',
27
+ 'httr',
28
+ 'Hmisc',
29
+ 'IRkernel',
30
+ 'nycflights13',
31
+ 'openssl',
32
+ 'plotly',
33
+ 'r-plyr',
34
+ 'randomforest',
35
+ 'rcurl',
36
+ 'remotes',
37
+ 'reshape2',
38
+ 'rlang',
39
+ 'rmarkdown',
40
+ 'rsqlite',
41
+ 'Rtsne',
42
+ 'selectr',
43
+ 'shiny',
44
+ 'svglite',
45
+ 'stringi',
46
+ 'stringr',
47
+ 'survminer',
48
+ 'tictoc',
49
+ 'tidyr',
50
+ 'tidyverse',
51
+ 'usethis',
52
+ 'uuid',
53
+ 'wesanderson',
54
+ 'xgboost'
55
+ ),
56
+ repos='http://cran.uk.r-project.org'
57
+ )
58
+
59
+ # Install rethomics
60
+ install.packages(
61
+ c('behavr',
62
+ 'ggetho',
63
+ 'damr',
64
+ # 'scopr',
65
+ 'sleepr',
66
+ 'zeitgebr'
67
+ ),
68
+ repos= 'http://cran.uk.r-project.org'
69
+ )
70
+
71
+ #As of Jan 2024 scopr does not seem to be on CRAN for whatever reason so we need to install from github
72
+ library(devtools)
73
+ devtools::install_github("rethomics/scopr")
74
+
75
+ IRkernel::installspec(user = FALSE)
@@ -0,0 +1,54 @@
1
+ # Some spawners allow shell-style expansion here, allowing you to use
2
+ # environment variables. Most, including the default, do not. Consult the
3
+ # documentation for your spawner to verify!
4
+ # Default: ['jupyterhub-singleuser']
5
+
6
+ #c.Spawner.cmd = ['jupyterhub-singleuser'] #Default would be single user
7
+ c.Spawner.cmd = ['jupyter-labhub', '--allow-root']
8
+
9
+ # Simple authentication with shared password
10
+ c.JupyterHub.authenticator_class = 'jupyterhub.auth.DummyAuthenticator'
11
+ c.DummyAuthenticator.password = 'ethoscope'
12
+
13
+ # Allowed users - add as many users as you need, they will all share the same password
14
+ c.Authenticator.allowed_users = {
15
+ 'amadabhushi', 'ggilestro', 'mjoyce', 'lguo',
16
+ 'labguest1', 'labguest2', 'labguest3', 'labguest4',
17
+ 'labguest5', 'labguest6', 'labguest7', 'labguest8',
18
+ 'ethoscopelab'
19
+ }
20
+
21
+ # Admin users
22
+ c.Authenticator.admin_users = {'ggilestro'}
23
+
24
+ # Custom spawner that doesn't require system users
25
+ from jupyterhub.spawner import LocalProcessSpawner
26
+ import os
27
+
28
+ class ConfigUserSpawner(LocalProcessSpawner):
29
+ def make_preexec_fn(self, name):
30
+ """Don't try to switch users - run everything as current user"""
31
+ return None
32
+
33
+ def user_env(self, env):
34
+ """Set user environment without system user lookup"""
35
+ env = env.copy()
36
+ home_dir = f'/home/{self.user.name}'
37
+
38
+ # Ensure home directory exists with proper permissions
39
+ os.makedirs(home_dir, mode=0o755, exist_ok=True)
40
+
41
+ # Set environment variables
42
+ env['USER'] = self.user.name
43
+ env['HOME'] = home_dir
44
+ env['SHELL'] = '/bin/bash'
45
+ env['LOGNAME'] = self.user.name
46
+
47
+ return env
48
+
49
+ c.JupyterHub.spawner_class = ConfigUserSpawner
50
+ c.Spawner.notebook_dir = '/home/{username}'
51
+
52
+ # Timeouts
53
+ c.Spawner.http_timeout = 60
54
+ c.Spawner.start_timeout = 60
@@ -1,27 +1,20 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: ethoscopy
3
- Version: 2.0
3
+ Version: 2.0.1
4
4
  Summary: "A python based toolkit to download and anlyse data from the Ethoscope hardware system."
5
- License: "GNU GPLv3"
6
- Author: Lblackhurst29
7
- Author-email: l.blackhurst19@imperial.ac.uk
8
- Requires-Python: >=3.10,<4.0
9
- Classifier: License :: Other/Proprietary License
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.10
12
- Classifier: Programming Language :: Python :: 3.11
13
- Classifier: Programming Language :: Python :: 3.12
14
- Classifier: Programming Language :: Python :: 3.13
15
- Requires-Dist: astropy (>=6.1,<7.0)
16
- Requires-Dist: colour (>=0.1.5,<0.2.0)
17
- Requires-Dist: hmmlearn (>=0.3.2,<0.4.0)
18
- Requires-Dist: nbformat (>=5.10.4,<6.0.0)
19
- Requires-Dist: numpy (>=2.0.0,<3.0.0)
20
- Requires-Dist: pandas (>=2.2.2,<3.0.0)
21
- Requires-Dist: plotly (>=5.22.0,<6.0.0)
22
- Requires-Dist: pywavelets (>=1.6.0,<2.0.0)
23
- Requires-Dist: seaborn (>=0.13.2,<0.14.0)
24
- Requires-Dist: tabulate (>=0.9.0,<0.10.0)
5
+ Author-email: Lblackhurst29 <lblackhurst29@gmail.com>
6
+ License-File: LICENSE
7
+ Requires-Python: <4.0,>=3.10
8
+ Requires-Dist: astropy<7.0,>=6.1
9
+ Requires-Dist: colour<0.2.0,>=0.1.5
10
+ Requires-Dist: hmmlearn<0.4.0,>=0.3.2
11
+ Requires-Dist: nbformat<6.0.0,>=5.10.4
12
+ Requires-Dist: numpy<3.0.0,>=2.0.0
13
+ Requires-Dist: pandas<3.0.0,>=2.2.2
14
+ Requires-Dist: plotly<6.0.0,>=5.22.0
15
+ Requires-Dist: pywavelets<2.0.0,>=1.6.0
16
+ Requires-Dist: seaborn<0.14.0,>=0.13.2
17
+ Requires-Dist: tabulate<0.10.0,>=0.9.0
25
18
  Description-Content-Type: text/markdown
26
19
 
27
20
  # ethoscopy
@@ -43,7 +36,7 @@ Ethoscopy contains methods to perform common analytical techniques per specimen
43
36
 
44
37
  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.
45
38
 
46
- The latest update is backwards compatible with all previously saved behavpy dataframes. However, post loading they should be re-initiated as the new behavpy class.
39
+ The latest update is backwards compatible with all previously saved behavpy dataframes. However, post loading they should be re-initiated as the new behavpy class. See in the getting started a demonstration of what to do.
47
40
 
48
41
  Addtionally, the concat method ( behavpy_object.concat() ) for combining dataframes has been shifted to a function that is imported automatically. Call etho.concat(df1, df2) or etho.concat(*[df1, df2]) instead. There are other minor changes to method and argument names, which are reflected in their docstrings and in the tutorial.
49
42
 
@@ -77,6 +70,14 @@ df = etho.behavpy(data, metadata, check = True, canvas = 'plotly', palette = 'Se
77
70
  filtered_df = df.xmv('experimental_column', 'group_2')
78
71
  ```
79
72
 
73
+ Loading and re-initialising old data (saved pre 2.0)
74
+ ```bash
75
+ import ethoscopy as etho
76
+ import pandas as pd
77
+
78
+ df = pd.read_pickle('path/to/your/file.pkl')
79
+ df = etho.behavpy(df, df.meta, check = True, canvas = 'plotly', palette = 'Set2')
80
+ ```
80
81
  ## License
81
82
 
82
- This project is licensed under the [GNU-3 license](LICENSE)
83
+ This project is licensed under the [GNU-3 license](LICENSE)
@@ -17,7 +17,7 @@ Ethoscopy contains methods to perform common analytical techniques per specimen
17
17
 
18
18
  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.
19
19
 
20
- The latest update is backwards compatible with all previously saved behavpy dataframes. However, post loading they should be re-initiated as the new behavpy class.
20
+ The latest update is backwards compatible with all previously saved behavpy dataframes. However, post loading they should be re-initiated as the new behavpy class. See in the getting started a demonstration of what to do.
21
21
 
22
22
  Addtionally, the concat method ( behavpy_object.concat() ) for combining dataframes has been shifted to a function that is imported automatically. Call etho.concat(df1, df2) or etho.concat(*[df1, df2]) instead. There are other minor changes to method and argument names, which are reflected in their docstrings and in the tutorial.
23
23
 
@@ -51,6 +51,14 @@ df = etho.behavpy(data, metadata, check = True, canvas = 'plotly', palette = 'Se
51
51
  filtered_df = df.xmv('experimental_column', 'group_2')
52
52
  ```
53
53
 
54
+ Loading and re-initialising old data (saved pre 2.0)
55
+ ```bash
56
+ import ethoscopy as etho
57
+ import pandas as pd
58
+
59
+ df = pd.read_pickle('path/to/your/file.pkl')
60
+ df = etho.behavpy(df, df.meta, check = True, canvas = 'plotly', palette = 'Set2')
61
+ ```
54
62
  ## License
55
63
 
56
64
  This project is licensed under the [GNU-3 license](LICENSE)
@@ -0,0 +1 @@
1
+ theme: jekyll-theme-minimal
@@ -0,0 +1,38 @@
1
+ [project]
2
+ name = "ethoscopy"
3
+ version = "2.0.1"
4
+ description = "\"A python based toolkit to download and anlyse data from the Ethoscope hardware system.\""
5
+ authors = [{name = "Lblackhurst29",email = "lblackhurst29@gmail.com"}]
6
+ readme = "README.md"
7
+ dependencies = [
8
+ "numpy>=2.0.0,<3.0.0",
9
+ "pandas>=2.2.2,<3.0.0",
10
+ "plotly>=5.22.0,<6.0.0",
11
+ "seaborn>=0.13.2,<0.14.0",
12
+ "tabulate>=0.9.0,<0.10.0",
13
+ "colour>=0.1.5,<0.2.0",
14
+ "hmmlearn>=0.3.2,<0.4.0",
15
+ "pywavelets>=1.6.0,<2.0.0",
16
+ "astropy>=6.1,<7.0",
17
+ "nbformat>=5.10.4,<6.0.0",
18
+ ]
19
+ requires-python = ">=3.10,<4.0"
20
+
21
+ [tool]
22
+ [tool.rye]
23
+ managed = true
24
+ virtual = false
25
+ dev-dependencies = [
26
+ "ipykernel>=6.29.5,<7.0.0",
27
+ ]
28
+
29
+ [tool.hatch]
30
+ [tool.hatch.metadata]
31
+ allow-direct-references = true
32
+
33
+ [tool.hatch.build.targets.wheel]
34
+ packages = ["src/ethoscopy"]
35
+
36
+ [build-system]
37
+ requires = ["hatchling"]
38
+ build-backend = "hatchling.build"
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env python
2
+
3
+ import sys
4
+ from setuptools import setup, find_packages
5
+
6
+ if sys.version_info >= (3, 8):
7
+ from importlib import metadata
8
+ else:
9
+ from importlib_metadata import metadata
10
+
11
+ # This is the setup.py for a developmental version. The Officially tagged versions will have an overwritten
12
+ # setup.py as generated by poetry https://pypi.org/project/poetry/
13
+ VERSION = 'dev'
14
+ DESCRIPTION = 'A python based toolkit to download and analyse data from the Ethoscope hardware system.'
15
+
16
+ with open("README.md", "r", encoding="utf-8") as fh:
17
+ LONG_DESCRIPTION = fh.read()
18
+
19
+ setup(
20
+ name = "ethoscopy",
21
+ version = VERSION,
22
+ author = "Laurence Blackhurst",
23
+ author_email = "l.blackhurst19@imperial.ac.uk",
24
+ description = DESCRIPTION,
25
+ long_description = LONG_DESCRIPTION,
26
+ packages = find_packages('src'),
27
+ package_dir = {'' : 'src'},
28
+ install_requires=['pandas >= 1.4', 'numpy >= 1.22',],
29
+ keywords=['python', 'ethomics', 'ethoscope', 'sleep'],
30
+ classifiers= [
31
+ "Development Status :: 3 - Alpha",
32
+ "Intended Audience :: Education",
33
+ "Programming Language :: Python :: 3",
34
+ "Operating System :: Microsoft :: Windows",
35
+ "Operating System :: POSIX",
36
+ "Operating System :: MacOS :: MacOS X"
37
+ ],
38
+ python_requires = ">=3.8"
39
+ )