PyATCLI 2026.10.10__py3-none-any.whl
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.
- PyATCLI/__init__.py +196 -0
- PyATCLI/__main__.py +7 -0
- PyATCLI/_version.py +47 -0
- PyATCLI/analyses.py +640 -0
- PyATCLI/analysis/__init__.py +81 -0
- PyATCLI/analysis/auc.py +79 -0
- PyATCLI/analysis/curve_fit.py +88 -0
- PyATCLI/analysis/event_peth.py +263 -0
- PyATCLI/analysis/fft.py +99 -0
- PyATCLI/analysis/group/__init__.py +318 -0
- PyATCLI/analysis/group/rebuild.py +59 -0
- PyATCLI/analysis/group/report.py +281 -0
- PyATCLI/analysis/group/run.py +164 -0
- PyATCLI/analysis/group/scan.py +92 -0
- PyATCLI/analysis/group/stats.py +451 -0
- PyATCLI/analysis/group/trials.py +188 -0
- PyATCLI/analysis/intervals.py +59 -0
- PyATCLI/analysis/peak_finder.py +155 -0
- PyATCLI/analysis/shared.py +100 -0
- PyATCLI/analysis/zscore_peth.py +107 -0
- PyATCLI/cli/__init__.py +105 -0
- PyATCLI/cli/commands.py +395 -0
- PyATCLI/cli/docs.py +246 -0
- PyATCLI/cli/parser.py +286 -0
- PyATCLI/cli/render.py +130 -0
- PyATCLI/engine/__init__.py +0 -0
- PyATCLI/engine/contract.py +124 -0
- PyATCLI/engine/server.py +169 -0
- PyATCLI/engine/session.py +40 -0
- PyATCLI/engine/store.py +222 -0
- PyATCLI/engine/wire.py +103 -0
- PyATCLI/fieldstudy/__init__.py +1 -0
- PyATCLI/fieldstudy/study.py +440 -0
- PyATCLI/fieldstudy/validation.py +443 -0
- PyATCLI/markers.py +71 -0
- PyATCLI/models.py +102 -0
- PyATCLI/numeric.py +35 -0
- PyATCLI/ops/__init__.py +274 -0
- PyATCLI/ops/analysis.py +136 -0
- PyATCLI/ops/common.py +93 -0
- PyATCLI/ops/compute.py +94 -0
- PyATCLI/ops/fieldstudy.py +52 -0
- PyATCLI/ops/files.py +42 -0
- PyATCLI/ops/group.py +144 -0
- PyATCLI/ops/recording.py +90 -0
- PyATCLI/ops/records.py +63 -0
- PyATCLI/ops/results.py +27 -0
- PyATCLI/ops/saved.py +98 -0
- PyATCLI/ops/system.py +31 -0
- PyATCLI/outputs.py +165 -0
- PyATCLI/progress.py +227 -0
- PyATCLI/provenance.py +336 -0
- PyATCLI/recording.py +602 -0
- PyATCLI/reproduce.py +278 -0
- PyATCLI/results.py +106 -0
- PyATCLI/saved_state.py +275 -0
- PyATCLI/sources/__init__.py +1 -0
- PyATCLI/sources/dataset.py +110 -0
- PyATCLI/sources/load.py +169 -0
- PyATCLI/sources/processing_TDT.py +810 -0
- PyATCLI/sources/processing_oxysoft.py +259 -0
- PyATCLI/sources/pt2.py +46 -0
- PyATCLI/sources/tables.py +306 -0
- PyATCLI/splice.py +196 -0
- PyATCLI/viewplan.py +181 -0
- pyatcli-2026.10.10.dist-info/METADATA +296 -0
- pyatcli-2026.10.10.dist-info/RECORD +71 -0
- pyatcli-2026.10.10.dist-info/WHEEL +5 -0
- pyatcli-2026.10.10.dist-info/entry_points.txt +2 -0
- pyatcli-2026.10.10.dist-info/licenses/LICENSE +661 -0
- pyatcli-2026.10.10.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: PyATCLI
|
|
3
|
+
Version: 2026.10.10
|
|
4
|
+
Summary: The analysis library, engine and command line behind PyAT: TDT fibre photometry, Oxysoft NIRS, Terranova EFNMR and text-field studies, with provenance records (formerly PhysicsLibrary)
|
|
5
|
+
Author: zakgm2
|
|
6
|
+
License-Expression: AGPL-3.0-only
|
|
7
|
+
Project-URL: Homepage, https://github.com/zakgm2/PyATCLI
|
|
8
|
+
Project-URL: Repository, https://github.com/zakgm2/PyATCLI
|
|
9
|
+
Project-URL: Changelog, https://github.com/zakgm2/PyATCLI/blob/main/CHANGELOG.md
|
|
10
|
+
Keywords: pyat,physics,neuroscience,fibre-photometry,NIRS,TDT,EFNMR,signal-processing,text-analysis,nlp,reproducibility
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Intended Audience :: Science/Research
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: numpy>=2.0
|
|
23
|
+
Requires-Dist: scipy
|
|
24
|
+
Requires-Dist: tdt
|
|
25
|
+
Requires-Dist: pandas
|
|
26
|
+
Requires-Dist: openpyxl
|
|
27
|
+
Requires-Dist: sentence-transformers
|
|
28
|
+
Requires-Dist: statsmodels
|
|
29
|
+
Requires-Dist: scikit-learn
|
|
30
|
+
Requires-Dist: tqdm
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# PyATCLI
|
|
34
|
+
|
|
35
|
+
The analysis library, engine and command line behind [PyAT (Python Analysis Tool)](https://github.com/zakgm2/PyAT) — file parsing, signal processing, curve fitting, group statistics, saved state and provenance records, with no GUI and no plotting code of its own: it computes and writes numbers, and PyAT draws them. Any interface (a script, a notebook, `python -m PyATCLI`) can sit on top of it.
|
|
36
|
+
|
|
37
|
+
> **Coming from PhysicsLibrary?** This is the same project under a new name, from version 2026.10.10 (PyPI: `ZaksPhysicsLibrary` → `PyATCLI`). Change `import PhysicsLibrary` to `import PyATCLI`, `python -m PhysicsLibrary` to `python -m PyATCLI` and the `physicslib` command to `pyatcli`; nothing else about the top-level names changed. [CHANGELOG.md](CHANGELOG.md) has the list, including the modules that moved into folders.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## What it does
|
|
42
|
+
|
|
43
|
+
- **Loads lab data** from three instrument formats plus generic tabular files:
|
|
44
|
+
- **TDT** (Tucker-Davis Technologies) fibre photometry tanks
|
|
45
|
+
- **Oxysoft / Artinis** (Oxymon, OctaMon, PortaMon …) NIRS `.txt` exports
|
|
46
|
+
- **Terranova Prospa** `.pt2` EFNMR/MRI 2D images
|
|
47
|
+
- Generic **Excel / CSV / TSV / plain text**, with automatic sub-table detection for side-by-side data layouts on one sheet
|
|
48
|
+
- **Processes signals** — RANSAC-robust motion correction, bleach correction, denoising, Z-score PETH slicing, FFT with peak annotation, slope/segment analysis
|
|
49
|
+
- **Fits curves** — linear, single/double exponential, exponential rise, Gaussian, sinusoidal, and a photon-entanglement visibility model, all via `scipy.optimize.curve_fit`
|
|
50
|
+
- **Analyses text field studies** — one JSON file per subject with several free-text fields; pick any pair of fields to compare directly (e.g. does the answer to one question track another for the same subject). Word counts, data-quality flagging, sentence-transformers embeddings, an optional delta-vector magnitude between two fields, and an optional paired-similarity metric per pair with a permutation test and a word-count confound check. Domain-agnostic — field names and which pairs to compare are supplied by the caller, nothing is hardcoded to one study
|
|
51
|
+
- **Validates the similarity metric statistically** — Benjamini-Hochberg FDR-corrected permutation-test p-values, Cohen's d effect size, a word-count-controlled OLS regression (statsmodels), a bootstrap confidence interval on the mean, and a leave-one-out sensitivity check, one row per field pair, with docstrings explaining what each statistic means
|
|
52
|
+
- **Opens a recording the way PyAT does, without the GUI** — a TDT block processed to dF/F with its saved splices replayed and its saved markers on top (`load_tdt_recording`), splicing that re-fits the dF/F on what is left, events grouped by name, and the whole group analysis (`run_group_analysis`) repeatable from the settings file it saves. A script gets the numbers the app shows
|
|
53
|
+
- **Runs every analysis by name, and reproduces any result** — `run_analysis("event_peth", cache, {...})` returns tables whose columns match PyAT's CSV exports. Every export PyAT writes comes with a `.provenance.json` beside it (software versions, a fingerprint of the recording, its splices and signal names, the pipeline's own settings, the parameters; never recording data), and `python -m PyATCLI reproduce <record>` runs the analysis again without the app and checks the numbers against the export. `run`, `batch` and `group` do the same from a shell, so any figure from the GUI can be regenerated by a script
|
|
54
|
+
- **Works in float64, always** — TDT hands its streams over as float32, and numpy is not safe on single-precision data of a realistic length (`np.polyfit` silently loses the slope past ~3 minutes at 1 kHz). Every file load returns float64 and every public function that takes a signal widens its input, so nothing depends on a caller remembering to
|
|
55
|
+
- **Reports progress on anything slow** — loaders, the TDT pipeline, PETH and peak searches and the text-study pipelines take `progress=True` (a [tqdm](https://tqdm.github.io) bar on the console) or a callback receiving `(fraction, message)`, which is how PyAT shows a live percentage; silent by default
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Structure
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
PyATCLI/
|
|
63
|
+
__init__.py Public API — see below
|
|
64
|
+
numeric.py The float64 rule: every load, and every public function that takes a signal, works in float64
|
|
65
|
+
models.py Parametric model functions and the curve-fit registry (CURVE_FIT_MODELS)
|
|
66
|
+
progress.py tqdm-based progress reporting shared by the slow functions (Plan, track)
|
|
67
|
+
_version.py Which library version is running (a source checkout reports its own)
|
|
68
|
+
sources/ Reading a recording from disk
|
|
69
|
+
load.py load_dataset(), load_dataset_file(): detect the format, read it, return a Dataset (load_tdt, load_oxysoft ...)
|
|
70
|
+
dataset.py Dataset struct, DataFormat enum, format detection
|
|
71
|
+
processing_TDT.py TDT tank reading, motion + bleach correction, dF/F, denoising, event markers
|
|
72
|
+
processing_oxysoft.py Oxysoft .txt reading: the Legend-block parser, folder and single-file readers
|
|
73
|
+
tables.py Generic Excel/CSV/TSV/text parser with sub-table detection (load_any_file)
|
|
74
|
+
pt2.py .pt2 EFNMR/MRI image parser
|
|
75
|
+
recording.py A recording as PyAT holds it: saved state, building / splicing / loading it headlessly
|
|
76
|
+
splice.py Non-destructive trim / cut-and-stitch of signals and markers
|
|
77
|
+
markers.py How event markers are named and grouped by name
|
|
78
|
+
saved_state.py Writing the saved state (markers, splices, signal names, highlights, text) — what Save Changes writes
|
|
79
|
+
outputs.py Where results go under an Output folder: <type>/<recording> (Analysis)/, never overwriting
|
|
80
|
+
analysis/ One file per tool, each a pure function of arrays
|
|
81
|
+
shared.py zscore_peth.py event_peth.py auc.py fft.py peak_finder.py curve_fit.py intervals.py
|
|
82
|
+
group/ group analysis: the spec (__init__.py), the trials, the mixed models, the report,
|
|
83
|
+
the scan of what each recording holds, and the headless run with its settings file
|
|
84
|
+
trials.py stats.py report.py scan.py run.py
|
|
85
|
+
analyses.py Every analysis by name: run_analysis(kind, cache, parameters) -> tables that mirror PyAT's CSV exports
|
|
86
|
+
provenance.py How a result was produced, as data: software, the recording's fingerprint and state, pipeline settings, parameters
|
|
87
|
+
reproduce.py Run an analysis again from its provenance record and compare it with an export
|
|
88
|
+
results.py, viewplan.py Reading a finished analysis back from its files (open_results), and what the main plot shows of a recording, as data (plan_view)
|
|
89
|
+
cli/, __main__.py The command line: python -m PyATCLI (and the pyatcli command); docs.py writes its reference and man page
|
|
90
|
+
ops/ The operations the command line and the engine share: JSON in, JSON out
|
|
91
|
+
engine/ `serve`: the operations over a pipe, with recordings kept open (wire.py, store.py, session.py, server.py), and contract.py: what its callers can count on (ENGINE_CONTRACT.json)
|
|
92
|
+
fieldstudy/ The text-field study
|
|
93
|
+
study.py Grouped-text-field study pipeline (embeddings, delta vector, paired similarity)
|
|
94
|
+
validation.py Statistical validation for the paired-similarity metric (permutation test, Cohen's d, regression, bootstrap CI, leave-one-out)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
The layers: `sources/` reads a format and computes (`processing_*`), and `sources/load.py` is the only place that ties format detection to the right reader and wraps its result into a `Dataset`; `recording.py` and `analysis/` work on plain arrays and dicts — the same functions PyAT calls, which is why a script reproduces what the app shows. There is no GUI and no plotting code in the library: it computes and writes numbers, and PyAT draws them (its `figures` package), so the library needs no matplotlib.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Installation
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
pip install PyATCLI
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
That also installs the `pyatcli` command (`python -m PyATCLI` is the same thing). For the development version:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
pip install git+https://github.com/zakgm2/PyATCLI.git
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
As a dependency of another project: `PyATCLI>=2026.10.10` in its `requirements.txt` or `pyproject.toml`.
|
|
114
|
+
|
|
115
|
+
### Requirements
|
|
116
|
+
|
|
117
|
+
- Python 3.10+
|
|
118
|
+
- `numpy`, `scipy`, `tdt`, `pandas`, `sentence-transformers`, `statsmodels`, `scikit-learn`, `tqdm` (installed automatically)
|
|
119
|
+
- `sentence-transformers` pulls in `torch`/`transformers` as transitive dependencies — a genuinely heavy install (hundreds of MB) if you only need the signal-processing side; only actually loaded when you call `embed_text_fields`/`run_field_study_pipeline`
|
|
120
|
+
- `openpyxl` — only needed for `.xlsx`/`.xls` files; imported lazily with a clear error if missing when you actually try to load Excel
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Usage
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
import PyATCLI as pl
|
|
128
|
+
|
|
129
|
+
# Detect + load a TDT tank or Oxysoft export folder
|
|
130
|
+
fmt = pl.detect_format(folder_path)
|
|
131
|
+
dataset = pl.load_dataset(folder_path, fmt)
|
|
132
|
+
|
|
133
|
+
# Or load a single Oxysoft .txt file directly
|
|
134
|
+
dataset = pl.load_dataset_file(file_path)
|
|
135
|
+
|
|
136
|
+
# Every loader returns the same universal Dataset struct
|
|
137
|
+
dataset.source_format # "TDT" | "Oxysoft"
|
|
138
|
+
dataset.sample_rate # Hz
|
|
139
|
+
dataset.signals # (num_channels, num_samples)
|
|
140
|
+
dataset.channel_names # list[str]
|
|
141
|
+
dataset.events # [{'label': str, 'sample': int}, ...]
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
# Anything slow takes progress=: True draws a tqdm bar, a callable gets (fraction 0-1, message)
|
|
146
|
+
result = pl.process_tdt_folder(folder_path, progress=True)
|
|
147
|
+
result = pl.process_tdt_folder(folder_path, progress=lambda fraction, message: print(f"{fraction:4.0%} {message}"))
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
```python
|
|
151
|
+
# Generic tabular data (Excel/CSV/TSV/text) — returns one GenericTable per
|
|
152
|
+
# detected sub-table, since a single sheet can contain several side-by-side
|
|
153
|
+
tables = pl.load_any_file(path)
|
|
154
|
+
table = tables[0]
|
|
155
|
+
table.headers # list[str]
|
|
156
|
+
table.data # (n_rows, n_cols) float64, NaN for missing
|
|
157
|
+
|
|
158
|
+
# Terranova .pt2 EFNMR/MRI image — returns a raw 2D array, not a Dataset
|
|
159
|
+
img = pl.load_pt2(path) # (n, n) float64 (stored as float32 in the file)
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
```python
|
|
163
|
+
# A recording as PyAT holds it: processed to dF/F, its saved splices replayed, its saved markers on top
|
|
164
|
+
loaded = pl.load_tdt_recording(folder_path, regression_method="ols")
|
|
165
|
+
cache = loaded["cache"] # the same dict the app keeps in ctx.cache
|
|
166
|
+
events = pl.group_markers_by_name(cache) # {"L1P¹": [12.3, 45.6, ...], "Clap": [20.0], ...}
|
|
167
|
+
|
|
168
|
+
# Splice it — a TDT splice re-fits the dF/F on what is left, exactly as the app does
|
|
169
|
+
cut, applied = pl.apply_splices(cache, [{"mode": "cut_out", "start": 100.0, "end": 130.0}])
|
|
170
|
+
|
|
171
|
+
# A saved group analysis, run again from its settings file
|
|
172
|
+
spec, _ = pl.read_group_settings(group_folder)
|
|
173
|
+
results = pl.run_group_analysis(spec, out_dir=new_folder)
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
# Any analysis PyAT offers, by name — the tables have the columns of PyAT's CSV exports
|
|
178
|
+
cache = pl.load_recording(folder_path)["cache"] # TDT folder, Oxysoft .txt, or a table file
|
|
179
|
+
result = pl.run_analysis("event_peth", cache, {"event": "L1P¹", "pre_s": 10, "post_s": 20})
|
|
180
|
+
result.tables["mean_sem"] # time_from_event_s, mean, sem
|
|
181
|
+
result.parameters # as run: defaults filled in, the event's times written out
|
|
182
|
+
pl.describe_kinds() # every analysis and every parameter
|
|
183
|
+
|
|
184
|
+
# Run one again from the record PyAT wrote beside an export, and check the numbers
|
|
185
|
+
rep = pl.reproduce_record("Event PETH_L1P_103522.provenance.json", compare=["Event PETH_L1P_103522.csv"])
|
|
186
|
+
rep.ok, rep.warnings
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
python -m PyATCLI run event_peth "D:/rats/Rat7-250101" --param event="L1P¹" --param pre_s=10 --out out
|
|
191
|
+
python -m PyATCLI reproduce "out/Rat7_event_peth.provenance.json" --compare "out/Event PETH.csv"
|
|
192
|
+
python -m PyATCLI batch jobs.json --out batch-out # many analyses over many recordings
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
`run_cli.py` in the repository folder starts the same command line without remembering the module name. Run it with nothing (or double-click it) and it opens Git Bash in that folder, shows the commands and leaves the prompt open, as right-click > "Git Bash Here" would; run it with arguments (`python run_cli.py info`) and it is the command line itself in the terminal you are in (`--terminal` and `--inline` choose; see the file's own docstring).
|
|
196
|
+
|
|
197
|
+
```python
|
|
198
|
+
opened = pl.open_results("out/Rec_event_peth.provenance.json") # a finished analysis read back from its files: a record, a folder, a group's folder, a .csv
|
|
199
|
+
opened.kind, opened.parameters, opened.tables["trials"] # what made it, what it was asked, and its tables (the library draws nothing; PyAT does)
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
python -m PyATCLI run event_peth "D:/rats/Rat7-250101" --param event="L1P¹" --out out
|
|
204
|
+
python -m PyATCLI run event_peth "D:/rats/Rat7-250101" --param event="L1P¹" --output-folder Output # into Output/TDT/Rat7-250101 (Analysis)/, as PyAT's exports
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
What the app saves with Save Changes — markers, splices, signal names, highlights, text — a script can save too, as the same files:
|
|
208
|
+
|
|
209
|
+
```python
|
|
210
|
+
pl.saved_state.add_marker("D:/rats/Rat7-250101", 312.5, label="Lever")
|
|
211
|
+
pl.saved_state.add_splice("D:/rats/Rat7-250101", "cut_out", 40.0, 55.0) # stacks on the saved ones; replayed on every open
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
python -m PyATCLI saved marker "D:/rats/Rat7-250101" --time 312.5 --label Lever
|
|
216
|
+
python -m PyATCLI saved show "D:/rats/Rat7-250101"
|
|
217
|
+
python -m PyATCLI group setup "D:/cohort" --name Sucrose # lists the markers the recordings share, as the wizard does
|
|
218
|
+
python -m PyATCLI group setup "D:/cohort" --name Sucrose --marker "L1P¹" --marker "L2P¹" --output-folder Output --run
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Every command takes `--json` (one document on standard output, so `... --json | jq` always works), `--plain` (tab-separated rows), `-q`, `-v`, `--no-input` and `--events` (progress as JSON lines on standard error); standard output is only ever the result and errors go to standard error with an exit status. `python -m PyATCLI` with no arguments lists the commands, and each command's `--help` has examples. [CLI_REFERENCE.md](CLI_REFERENCE.md) and the man page [man/pyatcli.1](man/pyatcli.1) are generated from the program (`python -m PyATCLI docs --format markdown|man`) and kept in step by a test. `python -m PyATCLI serve` runs the same operations as a long-lived engine speaking JSON lines on standard input and output, with recordings kept open between requests: it is what PyAT's window talks to, so none of the numerical work runs in the window's process ([the engine](API_REFERENCE.md#the-engine)).
|
|
222
|
+
|
|
223
|
+
See [API_REFERENCE.md](API_REFERENCE.md#running-analyses-by-name) for the analyses, the provenance record's layout and every command, and [Drawing results](API_REFERENCE.md#drawing-results) for where the figures went. The command line itself computes and writes files and never draws or opens a window: drawing is PyAT's.
|
|
224
|
+
|
|
225
|
+
```python
|
|
226
|
+
# Analysis
|
|
227
|
+
x_seg, z = pl.get_zscore_slice(time_array, signal, center_t, window=30)
|
|
228
|
+
freqs, power, seg_x, seg_y = pl.compute_fft_slice(time_array, signal, center_t, fs)
|
|
229
|
+
peaks = pl.find_fft_peaks(freqs, power) # [{"freq_hz", "power", "bpm"}, ...] — drawing them is up to you
|
|
230
|
+
|
|
231
|
+
# Curve fitting
|
|
232
|
+
result = pl.fit_model_to_segment(x_seg, y_seg, pl.single_exponential_model, p0_fn)
|
|
233
|
+
result["popt"], result["r2"], result["y_fit"]
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
```python
|
|
237
|
+
# Text field study — one JSON file per subject, e.g. P-0001.json. Pick
|
|
238
|
+
# pairs of fields to compare directly; no grouping concept needed.
|
|
239
|
+
fields = pl.peek_fields(folder_path) # see what fields exist before picking pairs
|
|
240
|
+
df = pl.run_field_study_pipeline(
|
|
241
|
+
folder_path,
|
|
242
|
+
text_fields=["q1", "q2", "q3", "q4"],
|
|
243
|
+
delta_pair=("q1", "q2"), # optional: how much did q2 change from q1
|
|
244
|
+
paired_fields=[("q1", "q3", "pair1")], # optional: does q1 track q3
|
|
245
|
+
)
|
|
246
|
+
# df has one row per subject: wordcount_<field>, low_quality_<field>, delta_magnitude,
|
|
247
|
+
# sim_<pair>, pvalue_<pair>, effect_size_<pair>, wc_confound_r_<pair>, ...
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
```python
|
|
251
|
+
# Statistical validation of the paired-similarity metric — one row per pair
|
|
252
|
+
summary = pl.run_validation_pipeline(
|
|
253
|
+
folder_path,
|
|
254
|
+
text_fields=["q1", "q3"],
|
|
255
|
+
paired_fields=[("q1", "q3", "pair1")],
|
|
256
|
+
)
|
|
257
|
+
# summary: p_value, p_value_fdr, cohens_d, wc_coef_a/b + wc_pvalue_a/b,
|
|
258
|
+
# regression_r_squared, ci_lower/ci_upper, n_flagged_loo, flagged_participant_ids
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
See [FIELD_STUDY_METHODOLOGY.md](FIELD_STUDY_METHODOLOGY.md) for why each statistic in the
|
|
262
|
+
validation step is a sound, standard technique — useful if anyone asks.
|
|
263
|
+
|
|
264
|
+
See [CHANGELOG.md](CHANGELOG.md) for the version history.
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## Public API
|
|
269
|
+
|
|
270
|
+
Everything importable from `PyATCLI` directly:
|
|
271
|
+
|
|
272
|
+
| Category | Names |
|
|
273
|
+
|----------|-------|
|
|
274
|
+
| Format detection | `detect_format`, `detect_format_file`, `DataFormat`, `Dataset` |
|
|
275
|
+
| Loading | `load_dataset`, `load_dataset_file`, `load_any_file`, `load_pt2` |
|
|
276
|
+
| TDT processing | `process_tdt_folder`, `compute_dff`, `validate_tdt_folder`, `get_tdt_struct`, `scan_tdt_markers`, `get_plot_data`, `correct_bleaching`, `denoise_signal`, `get_event_markers`, `debounce_events` |
|
|
277
|
+
| Oxysoft processing | `process_oxysoft_folder`, `process_oxysoft_file` |
|
|
278
|
+
| Saved state, written | the module `PyATCLI.saved_state`: `write_saved_markers`, `write_saved_splices`, `write_saved_signal_labels`, `write_saved_annotations`, `clear_saved_state`, `saved_state_summary`, `add_marker`, `remove_markers`, `add_splice`, `remove_splice`, `rename_signals`, `add_highlight`, `add_text` |
|
|
279
|
+
| Output folders | the module `PyATCLI.outputs`: `recording_dir`, `group_dir`, `unique_path`, `unique_stem`, `safe_folder_name` |
|
|
280
|
+
| Recordings and saved state | `load_recording`, `load_tdt_recording`, `find_tdt_recordings`, `make_tdt_cache`, `make_oxysoft_cache`, `make_generic_cache`, `build_signal_options`, `normalized_signal`, `read_saved_splices`, `read_saved_markers`, `read_saved_annotations`, `saved_state_dir`, `marker_sidecar_path`, `splice_sidecar_path`, `annotation_sidecar_path`, `legacy_marker_sidecar_path`, `signal_labels_path`, `read_saved_signal_labels`, `apply_signal_labels`, `current_signal_labels` |
|
|
281
|
+
| Running analyses | `run_analysis`, `kinds`, `describe_kinds`, `normalize_parameters`, `AnalysisResult`, `ParameterError`, `AnalysisError` |
|
|
282
|
+
| Reading results and views | `open_results`, `OpenedResults`, `NoResults`, `run_view`, `VIEW_KIND`; the modules `PyATCLI.results` and `PyATCLI.viewplan` (the library draws nothing: figures are PyAT's) |
|
|
283
|
+
| Provenance and reproducing | `build_record`, `write_record`, `read_record`, `recording_state`, `file_fingerprint`, `pipeline_parameters`, `software_versions`, `library_version`, `check_environment`, `markers_summary`, `output_entry`, `sidecar_path_for`, `PROVENANCE_SCHEMA_VERSION`, `PROVENANCE_SUFFIX`, `reproduce_record`, `compare_table`, `Reproduction`, `ReproduceError` (the module `PyATCLI.reproduce` holds the rest) |
|
|
284
|
+
| Splicing | `apply_splice`, `apply_splices`, `spliced_store_name`, `splice_keep_inside`, `splice_cut_out`, `replay_splices`, `MODE_CUT_OUT`, `MODE_KEEP_INSIDE` |
|
|
285
|
+
| Markers | `marker_display_label`, `store_display_name`, `group_markers_by_name`, `compute_marker_intervals` |
|
|
286
|
+
| Analysis | `get_zscore_slice`, `smooth_signal`, `bin_for_heatmap`, `compute_event_zscore_peth`, `compute_fft_slice`, `find_fft_peaks`, `compute_slope_segment`, `fit_model_to_segment`, `find_significant_peaks`, `find_peak_near_events`, `compute_auc_window`, `compute_auc_from_trace`, `compute_auc_matrix`, `compute_peri_event_from_trace`, `compute_peri_event_matrix`, `compute_group_stats`, `estimate_sample_rate`, `mean_channels` |
|
|
287
|
+
| Group analysis | `GroupSpec`, `scan_recording`, `scan_recordings`, `default_subject_names`, `load_group_recording`, `run_group_analysis`, `write_group_settings`, `read_group_settings`, `GROUP_SETTINGS_FILENAME`, `marker_index`, `common_markers`, `design_summary`, `extract_group_trials`, `fit_group_models`, `GroupResults`, `write_group_results`, `group_report_text` |
|
|
288
|
+
| Curve fit models | `CURVE_FIT_MODELS`, `linear_model`, `single_exponential_model`, `exponential_rise_model`, `double_exponential_model`, `gaussian_model`, `sinusoidal_model`, `visibility_model` |
|
|
289
|
+
| Text field study | `run_field_study_pipeline`, `load_field_study_folder`, `peek_fields`, `flag_low_quality`, `embed_text_fields`, `compute_delta_vector`, `compute_paired_similarity`, `permutation_test_similarity`, `wordcount_confound_check` |
|
|
290
|
+
| Field study validation | `run_validation_pipeline`, `build_validation_summary`, `cohens_d`, `benjamini_hochberg`, `wordcount_controlled_regression`, `bootstrap_mean_ci`, `leave_one_out_sensitivity` |
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## License
|
|
295
|
+
|
|
296
|
+
AGPL-3.0 — see [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
PyATCLI/__init__.py,sha256=cXwcT-gGlo-AhM5spqckkWeblh9mr1cGgEFzXQa7coc,4923
|
|
2
|
+
PyATCLI/__main__.py,sha256=TA-tVOiPm0RmCx2m-RXe3l-q5SjY8FsbebaUeXOIFbM,114
|
|
3
|
+
PyATCLI/_version.py,sha256=nV18o-f6b0YiinuBG_NHjqFD5kJqIW6aSBdqfK-x7m0,1809
|
|
4
|
+
PyATCLI/analyses.py,sha256=jY_KlcHuZMe_CxzXsVhuNMt815DPb3AMoNovVbktWCM,35324
|
|
5
|
+
PyATCLI/markers.py,sha256=i8-4tj5kIGc4M37_AFABgZvyywQe9TUF73VHCDjhlA0,3323
|
|
6
|
+
PyATCLI/models.py,sha256=ORbpauGs7s6mwlm9MsrPF5O1ZIicPMKRDvlzPJBsH8k,3282
|
|
7
|
+
PyATCLI/numeric.py,sha256=pRgrkpWylL73Ecp8EhHmBKOuIBRKmr7zGBdFPct01-U,1907
|
|
8
|
+
PyATCLI/outputs.py,sha256=STWNn097doiu8Zgdoig7Lts-BWBTrKyv_WoqBoI2mFs,8051
|
|
9
|
+
PyATCLI/progress.py,sha256=8Ti2ApvR3i5VoyRfr18eQUOlBjuKQ3HdXq4ylZs_lh0,8792
|
|
10
|
+
PyATCLI/provenance.py,sha256=i7O2tKUGSeeq01dSlb-JKCwUIFLaNqu4_KU9wMa0QX0,15474
|
|
11
|
+
PyATCLI/recording.py,sha256=bhYimRyzXfO5HKEhMuN2dpFNqgGy5kK3oDQTZ05k1Oc,30734
|
|
12
|
+
PyATCLI/reproduce.py,sha256=mJC3draBmTMc-I3Yqg2WBK3-sQqkxT2u6Lb5RYhLFhE,14398
|
|
13
|
+
PyATCLI/results.py,sha256=9v3DrEtG47nXfgcKtN9Ct6HqYWUpMA2NpYTcVQOomIs,5608
|
|
14
|
+
PyATCLI/saved_state.py,sha256=7x0TbGQRtKYWneBI2qfe-Wwpuajj0AzjUGmHu-Wzg2M,14660
|
|
15
|
+
PyATCLI/splice.py,sha256=wsBiORt017Lh_JH1IIH8MD9g91nrSFsX-tHu4qT2yFE,8302
|
|
16
|
+
PyATCLI/viewplan.py,sha256=0a9xQB7omfOOP0JEdFe01y9FmTrETACKxYJdeikKt1A,10305
|
|
17
|
+
PyATCLI/analysis/__init__.py,sha256=i0rgBktGg5icLDH2daQpvmI_3nh5cQ4Vvhie51i_WgQ,3348
|
|
18
|
+
PyATCLI/analysis/auc.py,sha256=UK_K0_4_SeEP9qcHYI_7--uqwZtrYQKSfpg5w120MX0,2672
|
|
19
|
+
PyATCLI/analysis/curve_fit.py,sha256=Hzx39rttb5D324rfnf5qlVlGy1o7uwKoYnI8z78flgw,2545
|
|
20
|
+
PyATCLI/analysis/event_peth.py,sha256=EdSBcihdBI3mg5YXyG02L1g9A2oUALxGCyUyGHFOgr0,10416
|
|
21
|
+
PyATCLI/analysis/fft.py,sha256=EaP5dkvv_XVkr5G6A2N2si4iQS18lSl-SWDitGiDUU8,3024
|
|
22
|
+
PyATCLI/analysis/intervals.py,sha256=bFZorb1zWpXr_ilDrSYaqvS81atu-A-tEUDXr6rqZGA,2204
|
|
23
|
+
PyATCLI/analysis/peak_finder.py,sha256=gGNLEC2zoegpiGsfqrRdWQL79_IRuldhtY8QIFdSklw,6528
|
|
24
|
+
PyATCLI/analysis/shared.py,sha256=hrnlk7KhDYiOpWTJ0PmSkVC8DCi50jT5lTPiybZ0frg,3361
|
|
25
|
+
PyATCLI/analysis/zscore_peth.py,sha256=th1ABqnzd9Mdd3Q5tvS-3vv5cY1S0Jp313UDjKiJekE,4122
|
|
26
|
+
PyATCLI/analysis/group/__init__.py,sha256=MUKgGuEGkPnMYmZmIiuHmQO6S6q4Jpsd5sJu7RDSQk8,15651
|
|
27
|
+
PyATCLI/analysis/group/rebuild.py,sha256=XHwIXf2FaBJIvhVZGaAHg4Z_aRdqRc35LRxxmUYKHr0,3009
|
|
28
|
+
PyATCLI/analysis/group/report.py,sha256=LjwadyJnHnRCA9MG9znF3m7Idp-C6dMzApNrWI3wKes,15764
|
|
29
|
+
PyATCLI/analysis/group/run.py,sha256=TusnX-uU4XDz-V31elYTZeduMG6M-eICtFkhLvY7AvM,8211
|
|
30
|
+
PyATCLI/analysis/group/scan.py,sha256=08cnuHvu-dMCSEOFdqwBpj1nqTQU8XpVi33PLTVPz2E,4284
|
|
31
|
+
PyATCLI/analysis/group/stats.py,sha256=SfrIwTePKpHMPIBKazRzKjLyRaxiNzgOVMs4P_FSjwE,24689
|
|
32
|
+
PyATCLI/analysis/group/trials.py,sha256=HPPR8Cs7yk8vqq1oJxbapq-RvtQD0CkRsQc4YF7Ept4,8226
|
|
33
|
+
PyATCLI/cli/__init__.py,sha256=vYgUkr5ciFJ_5d8gNTrsDK_Rq3__8oZpR28soBv0-rs,4891
|
|
34
|
+
PyATCLI/cli/commands.py,sha256=bEuLzH3R-WXd2ilhxE2CkXtVeUot4t_27eZLEoO7Izk,17261
|
|
35
|
+
PyATCLI/cli/docs.py,sha256=VIEO8A9ZqMpDpYOvvl8LuDuuKLmfEQxI8g6RQogSK-U,11558
|
|
36
|
+
PyATCLI/cli/parser.py,sha256=dpIytA2AeBbndsr5fheJebg6MS9IniXEZQsOZ_lYQBM,20469
|
|
37
|
+
PyATCLI/cli/render.py,sha256=v5Vvw-gtVJFnttWdDZK9FhqzJ7uGM4QMfeolIA2qpAE,5749
|
|
38
|
+
PyATCLI/engine/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
39
|
+
PyATCLI/engine/contract.py,sha256=-mhEnS9nQHuIm_750uHjb5yUOJZcX3zEmhQ_G4Mqb18,7306
|
|
40
|
+
PyATCLI/engine/server.py,sha256=KhImaE2zmpNGXtv99eTQSyCpzsu1dtzNuX8ef2uI1ak,7888
|
|
41
|
+
PyATCLI/engine/session.py,sha256=K1szWnRAy0DdapkWSqV3agyqMDY23iCpkSUCZ38nZPI,1892
|
|
42
|
+
PyATCLI/engine/store.py,sha256=OBPtMr7KcpvwF4hdZ28cq62ZIrzJ-xTvYZHgqslXb-0,11643
|
|
43
|
+
PyATCLI/engine/wire.py,sha256=o7_5RfavPfDfWwaUndlc9HaYMnrwgqLUJFzhtOIijLs,4929
|
|
44
|
+
PyATCLI/fieldstudy/__init__.py,sha256=nTTb8Y6U0_ykeRnbnAWWbBpZrb0WJoda4TCP8frJqLE,132
|
|
45
|
+
PyATCLI/fieldstudy/study.py,sha256=QJ0GrO7vGkCUm745sQHGCJdb0uJ0YpsEEtDPGfUB7ak,17516
|
|
46
|
+
PyATCLI/fieldstudy/validation.py,sha256=3IvElgoiRh5tT9UUix74Uc96IVipRpP_AoWVQmiuF7k,18403
|
|
47
|
+
PyATCLI/ops/__init__.py,sha256=0J3pcWi71YQBNYv-Tl8KIgPdD2xLoHzPh0T2wMO7GBQ,13180
|
|
48
|
+
PyATCLI/ops/analysis.py,sha256=OqOsLA8Ad9lm8Zr0MetgTytZ14xA3tw6rLDOzxwOILA,8282
|
|
49
|
+
PyATCLI/ops/common.py,sha256=6fZuHaqpMNNsVTp0i1NwoQZstCz6hlskHVOyGqO0BGs,4012
|
|
50
|
+
PyATCLI/ops/compute.py,sha256=ONorWdPi4DiIF_40nyGTv1J6A-86Wec6Oq84-K9wHOU,5414
|
|
51
|
+
PyATCLI/ops/fieldstudy.py,sha256=YsWQhLA3JJsSgKAF_gAX-N9JFmOldAldhR3ErlxO0nA,3352
|
|
52
|
+
PyATCLI/ops/files.py,sha256=k37svWxXYApqYedjr5GLpa7DZPyvZKDWNWupG6MVOs0,2340
|
|
53
|
+
PyATCLI/ops/group.py,sha256=_IfgVog00ulZi3BPPDJNruOWR3ECV0LWZbd3mmG_s5Y,8599
|
|
54
|
+
PyATCLI/ops/recording.py,sha256=vLTzXvt6L80ua8e26D5TktwxY4IUxab3Y3JRwD_j-Co,4661
|
|
55
|
+
PyATCLI/ops/records.py,sha256=6J956wsvAKhE81GpCELtlO3oTpyofqhXcSWKzZWTDcA,3459
|
|
56
|
+
PyATCLI/ops/results.py,sha256=BPv16u0H8Tw8rizMaM6TOZVSuTL-UeLN8kQaRaAh9mY,1539
|
|
57
|
+
PyATCLI/ops/saved.py,sha256=QQB7mLHT1XYYF_EkSLy0WGjcD8DjiWHFnIJ0Lz8EOvo,4759
|
|
58
|
+
PyATCLI/ops/system.py,sha256=i4spSDPE4XbZK3R_Ii-v_p6kyjLPU-8_JSwqfXA5E9k,1422
|
|
59
|
+
PyATCLI/sources/__init__.py,sha256=w-kmTaYyfS5NpwilHGHglCRussrujkICIgid7k9MwRs,150
|
|
60
|
+
PyATCLI/sources/dataset.py,sha256=Rw-A6ILeNGaoDYSTZP8FIjzdni9QMlZePWqUkHLxkgQ,3457
|
|
61
|
+
PyATCLI/sources/load.py,sha256=j8drLol1r95WHrC0N5EMCfhuGR15V-C_ztKrUg21hzE,6459
|
|
62
|
+
PyATCLI/sources/processing_TDT.py,sha256=8MtV6mNLVhmKoiLv8Zwy6bsp0OTSohzkP2c8SEwXWiM,33692
|
|
63
|
+
PyATCLI/sources/processing_oxysoft.py,sha256=E3XNo3UJa1ZLmCJU7yarOcK6OoBnnizD02UIX4CCedo,9831
|
|
64
|
+
PyATCLI/sources/pt2.py,sha256=fDFL5xNk28SbDDC4oQnk_lXMY89zCa7KLPaF_NeWLaU,1231
|
|
65
|
+
PyATCLI/sources/tables.py,sha256=NdJOTb62zSZJNYeaKigZN4-CQBqfs_r5vCf_xUQESIQ,11400
|
|
66
|
+
pyatcli-2026.10.10.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
|
|
67
|
+
pyatcli-2026.10.10.dist-info/METADATA,sha256=zi_rygnzminWdf1SHOONIVDQm_SOy_Ro4Zkc-z_H0P4,22480
|
|
68
|
+
pyatcli-2026.10.10.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
69
|
+
pyatcli-2026.10.10.dist-info/entry_points.txt,sha256=pVxg-b8Y09tGNf8I63TC64C1FTSgHZDOMg7Tx53DyMk,45
|
|
70
|
+
pyatcli-2026.10.10.dist-info/top_level.txt,sha256=H-1QkupLz_7umWkF_2UoyJwt3wy4jbC7NnfAlFZMu-U,8
|
|
71
|
+
pyatcli-2026.10.10.dist-info/RECORD,,
|