Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copilot Instructions

Read `AGENTS.md` and `README.md`. Repository code, tests, and the current
working tree are authoritative for implementation state.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ jobs:

- name: Check formatting
run: uvx ruff format --check .

- name: Test
run: uv run python -m unittest discover -s tests -v
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
.DS_Store
AGENTS.md
CLAUDE.md
.github/copilot-instructions.md

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
20 changes: 20 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Project Instructions

Behavioral-only analysis code for Churchland Lab thesis work.

- Start from the actual branch, working tree, notebooks, scripts, and tests.
- Read `README.md` and `docs/MIGRATION.md` before changing the data-access or
package surface.
- Keep behavioral analysis here; electrophysiology work belongs in the
`ephys` repository.
- Maintained reusable work uses `labdata`, `labdata_plugin/`, and
`src/behavior_analyses/`. Archived `djchurchland` notebooks live under
`archive/djchurchland/`.
- Do not reintroduce `/Users/gabriel` paths or machine-local dependency paths.
- Use Notion for current priorities and decisions, not as a copy of repository
state.

Run the narrowest relevant checks, then `uvx ruff check .`,
`uvx ruff format --check .`, and
`uv run python -m unittest discover -s tests -v` when the full migration
surface is affected.
3 changes: 3 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Project Instructions

Read `AGENTS.md` and `README.md`.
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# behavior_analyses

Behavioral-only analysis code for thesis work in the Churchland Lab.

## Setup and checks

```bash
uv sync
uvx ruff check .
uvx ruff format --check .
uv run python -m unittest discover -s tests -v
```

`fit-psychometric` is vendored under `third_party/fit_psychometric` (no sibling
checkout or machine-local path required). Optional Chipmunk plugin fallback:

```bash
export CHIPMUNK_PLUGIN_PATH=/path/to/labdata/plugins/chipmunk
```

## Layout

- `src/behavior_analyses/` — reusable analysis modules
- `scripts/analyses/` — maintained scripts and migration entry points
- `labdata_plugin/` — local analysis-schema plugin under development
- `tests/` — migration-focused tests
- `docs/MIGRATION.md` — inventory, portability notes, live-validation gates
- `behavioral_metrics/`, `psychometric_curves/`,
`psychophysical_kernels/` — maintained labdata notebooks + helpers
- `archive/djchurchland/` — preserved pre-migration notebooks
- `archive/labdata_migration/` — preserved superseded migration smoke notebooks
- `notebooks/` — ingestion and exploratory work
- `oft/` — open-field analyses (archived notebooks relocated)

## Data access

Maintained analysis paths use `labdata` and the local plugin in
`labdata_plugin/`. Prefer `from chipmunk import Chipmunk` for trial-level
Chipmunk data. Archived `djchurchland` notebooks are under
`archive/djchurchland/` and are not active entry points.

## Migration CLIs

```bash
uv run python scripts/analyses/seed_behavior_analysis_set.py --help
uv run python scripts/analyses/migrate_behavior_analysis_schema.py --help
uv run python scripts/analyses/populate_behavior_tables.py --help
uv run python scripts/analyses/plot_psychometrics.py --help
```

Use `--dry-run` on seed/populate before any database writes.
23 changes: 23 additions & 0 deletions archive/djchurchland/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Archived djchurchland notebooks

These notebooks are preserved as provenance for the pre-labdata analysis workflows.
They are **not** maintained entry points.

| Path | Classification |
| --- | --- |
| `psychometric_curves/` | archived |
| `behavioral_metrics/` | archived |
| `psychophysical_kernels/` | archived |
| `root/sess.ipynb` | archived |
| `oft/` | archived (absolute desktop paths; not part of the Chipmunk LabData migration) |

Maintained replacements:

- `src/behavior_analyses/` — reusable analysis functions
- `labdata_plugin/analysisschema.py` — DataJoint computed/manual tables
- `scripts/analyses/` — seed, populate, and plot CLIs
- `psychometric_curves/utils.py` — labdata-backed plotting helpers
- `psychometric_curves/plot_psychometric_fits.ipynb`
- `behavioral_metrics/plot_learning_curves.ipynb`
- `psychophysical_kernels/plot_kernels.ipynb`
- `sess.ipynb`
File renamed without changes.
File renamed without changes.
512 changes: 512 additions & 0 deletions archive/djchurchland/psychometric_curves/plot_psychometric_fits.ipynb

Large diffs are not rendered by default.

230 changes: 230 additions & 0 deletions archive/djchurchland/root/sess.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"id": "9ad1f58e",
"metadata": {},
"outputs": [],
"source": [
"from djchurchland.schema import Chipmunk\n",
"\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib as mpl\n",
"\n",
"new_rc_params = {\"text.usetex\": False, \"svg.fonttype\": \"none\"}\n",
"mpl.rcParams.update(new_rc_params)\n",
"plt.rcParams[\"font.sans-serif\"] = [\"Arial\"]\n",
"plt.rcParams[\"font.size\"] = 12\n",
"\n",
"%matplotlib widget\n",
"%load_ext autoreload\n",
"%autoreload 2"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "fd46321d",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.microsoft.datawrangler.viewer.v0+json": {
"columns": [
{
"name": "index",
"rawType": "int64",
"type": "integer"
},
{
"name": "subject_name",
"rawType": "object",
"type": "string"
},
{
"name": "session_datetime",
"rawType": "datetime64[ns]",
"type": "datetime"
},
{
"name": "session_num",
"rawType": "int64",
"type": "integer"
},
{
"name": "starttime",
"rawType": "datetime64[ns]",
"type": "datetime"
},
{
"name": "duration",
"rawType": "float64",
"type": "float"
},
{
"name": "setting_task_type",
"rawType": "object",
"type": "string"
},
{
"name": "setting_modalities",
"rawType": "object",
"type": "unknown"
},
{
"name": "setting_left_reward_volume",
"rawType": "float64",
"type": "float"
},
{
"name": "setting_right_reward_volume",
"rawType": "float64",
"type": "float"
},
{
"name": "setting_prob_audio",
"rawType": "float64",
"type": "float"
},
{
"name": "setting_prob_vision",
"rawType": "float64",
"type": "float"
},
{
"name": "setting_high_rate_side",
"rawType": "object",
"type": "string"
}
],
"ref": "1b2f4d73-bb0b-4b29-965e-418b3a1bcce8",
"rows": [
[
"0",
"GRB006",
"2024-08-26 11:33:07",
"211",
"2024-08-26 11:34:07",
"3256.48",
"discrimination",
"['auditory']",
"3.0",
"3.0",
"1.0",
"0.0",
"right"
]
],
"shape": {
"columns": 12,
"rows": 1
}
},
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>subject_name</th>\n",
" <th>session_datetime</th>\n",
" <th>session_num</th>\n",
" <th>starttime</th>\n",
" <th>duration</th>\n",
" <th>setting_task_type</th>\n",
" <th>setting_modalities</th>\n",
" <th>setting_left_reward_volume</th>\n",
" <th>setting_right_reward_volume</th>\n",
" <th>setting_prob_audio</th>\n",
" <th>setting_prob_vision</th>\n",
" <th>setting_high_rate_side</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>GRB006</td>\n",
" <td>2024-08-26 11:33:07</td>\n",
" <td>211</td>\n",
" <td>2024-08-26 11:34:07</td>\n",
" <td>3256.48</td>\n",
" <td>discrimination</td>\n",
" <td>[auditory]</td>\n",
" <td>3.0</td>\n",
" <td>3.0</td>\n",
" <td>1.0</td>\n",
" <td>0.0</td>\n",
" <td>right</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" subject_name session_datetime ... setting_prob_vision setting_high_rate_side\n",
"0 GRB006 2024-08-26 11:33:07 ... 0.0 right\n",
"\n",
"[1 rows x 12 columns]"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pd.DataFrame(\n",
" Chipmunk() & 'subject_name = \"GRB006\"' & 'session_datetime LIKE \"2024-08-26%\"'\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "01b67aa5",
"metadata": {},
"outputs": [],
"source": [
"visual = [\"20240819_110829\", \"20240820_115126\", \"20240821_121447\"]\n",
"auditory = [\"20240826_113307\", \"20240827_130938\", \"20240828_115206\"]\n",
"mixed = [\"20241016_153658\", \"20241018_141859\", \"20241021_172639\"]"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "base",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading
Loading