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.
Files changed (71) hide show
  1. PyATCLI/__init__.py +196 -0
  2. PyATCLI/__main__.py +7 -0
  3. PyATCLI/_version.py +47 -0
  4. PyATCLI/analyses.py +640 -0
  5. PyATCLI/analysis/__init__.py +81 -0
  6. PyATCLI/analysis/auc.py +79 -0
  7. PyATCLI/analysis/curve_fit.py +88 -0
  8. PyATCLI/analysis/event_peth.py +263 -0
  9. PyATCLI/analysis/fft.py +99 -0
  10. PyATCLI/analysis/group/__init__.py +318 -0
  11. PyATCLI/analysis/group/rebuild.py +59 -0
  12. PyATCLI/analysis/group/report.py +281 -0
  13. PyATCLI/analysis/group/run.py +164 -0
  14. PyATCLI/analysis/group/scan.py +92 -0
  15. PyATCLI/analysis/group/stats.py +451 -0
  16. PyATCLI/analysis/group/trials.py +188 -0
  17. PyATCLI/analysis/intervals.py +59 -0
  18. PyATCLI/analysis/peak_finder.py +155 -0
  19. PyATCLI/analysis/shared.py +100 -0
  20. PyATCLI/analysis/zscore_peth.py +107 -0
  21. PyATCLI/cli/__init__.py +105 -0
  22. PyATCLI/cli/commands.py +395 -0
  23. PyATCLI/cli/docs.py +246 -0
  24. PyATCLI/cli/parser.py +286 -0
  25. PyATCLI/cli/render.py +130 -0
  26. PyATCLI/engine/__init__.py +0 -0
  27. PyATCLI/engine/contract.py +124 -0
  28. PyATCLI/engine/server.py +169 -0
  29. PyATCLI/engine/session.py +40 -0
  30. PyATCLI/engine/store.py +222 -0
  31. PyATCLI/engine/wire.py +103 -0
  32. PyATCLI/fieldstudy/__init__.py +1 -0
  33. PyATCLI/fieldstudy/study.py +440 -0
  34. PyATCLI/fieldstudy/validation.py +443 -0
  35. PyATCLI/markers.py +71 -0
  36. PyATCLI/models.py +102 -0
  37. PyATCLI/numeric.py +35 -0
  38. PyATCLI/ops/__init__.py +274 -0
  39. PyATCLI/ops/analysis.py +136 -0
  40. PyATCLI/ops/common.py +93 -0
  41. PyATCLI/ops/compute.py +94 -0
  42. PyATCLI/ops/fieldstudy.py +52 -0
  43. PyATCLI/ops/files.py +42 -0
  44. PyATCLI/ops/group.py +144 -0
  45. PyATCLI/ops/recording.py +90 -0
  46. PyATCLI/ops/records.py +63 -0
  47. PyATCLI/ops/results.py +27 -0
  48. PyATCLI/ops/saved.py +98 -0
  49. PyATCLI/ops/system.py +31 -0
  50. PyATCLI/outputs.py +165 -0
  51. PyATCLI/progress.py +227 -0
  52. PyATCLI/provenance.py +336 -0
  53. PyATCLI/recording.py +602 -0
  54. PyATCLI/reproduce.py +278 -0
  55. PyATCLI/results.py +106 -0
  56. PyATCLI/saved_state.py +275 -0
  57. PyATCLI/sources/__init__.py +1 -0
  58. PyATCLI/sources/dataset.py +110 -0
  59. PyATCLI/sources/load.py +169 -0
  60. PyATCLI/sources/processing_TDT.py +810 -0
  61. PyATCLI/sources/processing_oxysoft.py +259 -0
  62. PyATCLI/sources/pt2.py +46 -0
  63. PyATCLI/sources/tables.py +306 -0
  64. PyATCLI/splice.py +196 -0
  65. PyATCLI/viewplan.py +181 -0
  66. pyatcli-2026.10.10.dist-info/METADATA +296 -0
  67. pyatcli-2026.10.10.dist-info/RECORD +71 -0
  68. pyatcli-2026.10.10.dist-info/WHEEL +5 -0
  69. pyatcli-2026.10.10.dist-info/entry_points.txt +2 -0
  70. pyatcli-2026.10.10.dist-info/licenses/LICENSE +661 -0
  71. pyatcli-2026.10.10.dist-info/top_level.txt +1 -0
PyATCLI/__init__.py ADDED
@@ -0,0 +1,196 @@
1
+ """
2
+ PyATCLI
3
+ -------
4
+ The analysis library, engine and command line behind PyAT (Python Analysis Tool): loading TDT, Oxysoft, generic-table and PT2 data, the analyses
5
+ (Z-score, AUC, FFT, curve fit, Event PETH, peaks, group statistics), saved state, provenance records, and `python -m PyATCLI`. It computes and
6
+ writes numbers and draws nothing; PyAT draws them. (Called PhysicsLibrary, on PyPI ZaksPhysicsLibrary, before it became PyATCLI.)
7
+ """
8
+
9
+ from ._version import resolve_version as _resolve_version
10
+
11
+ __version__ = _resolve_version() # a source checkout reports its own pyproject version — see _version.py
12
+
13
+ from .sources.tables import load_any_file
14
+
15
+ from .progress import Plan, track
16
+
17
+ from .provenance import (
18
+ SCHEMA_VERSION as PROVENANCE_SCHEMA_VERSION,
19
+ SIDECAR_SUFFIX as PROVENANCE_SUFFIX,
20
+ software_versions,
21
+ library_version,
22
+ check_environment,
23
+ pipeline_parameters,
24
+ file_fingerprint,
25
+ markers_summary,
26
+ recording_state,
27
+ build_record,
28
+ output_entry,
29
+ sidecar_path_for,
30
+ write_record,
31
+ read_record,
32
+ )
33
+
34
+ from .sources.dataset import detect_format, detect_format_file, DataFormat, Dataset
35
+
36
+ from .sources.load import load_dataset, load_dataset_file
37
+
38
+ from .sources.pt2 import load_pt2
39
+
40
+ from .sources.processing_oxysoft import process_oxysoft_folder, process_oxysoft_file
41
+
42
+ from .sources.processing_TDT import (
43
+ process_tdt_folder,
44
+ compute_dff,
45
+ validate_tdt_folder,
46
+ get_tdt_struct,
47
+ scan_tdt_markers,
48
+ get_plot_data,
49
+ correct_bleaching,
50
+ denoise_signal,
51
+ get_event_markers,
52
+ debounce_events,
53
+ REGRESSION_METHODS,
54
+ )
55
+
56
+ from .analysis import (
57
+ estimate_sample_rate,
58
+ mean_channels,
59
+ compute_group_stats,
60
+ compute_marker_intervals,
61
+ get_zscore_slice,
62
+ smooth_signal,
63
+ bin_for_heatmap,
64
+ compute_fft_slice,
65
+ find_fft_peaks,
66
+ compute_slope_segment,
67
+ fit_model_to_segment,
68
+ compute_event_zscore_peth,
69
+ find_significant_peaks,
70
+ find_peak_near_events,
71
+ compute_auc_from_trace,
72
+ compute_auc_window,
73
+ compute_auc_matrix,
74
+ compute_peri_event_from_trace,
75
+ compute_peri_event_matrix,
76
+ GroupSpec,
77
+ marker_index,
78
+ common_markers,
79
+ design_summary,
80
+ extract_group_trials,
81
+ measures_for_trial,
82
+ decay_time,
83
+ fit_group_models,
84
+ GroupResults,
85
+ write_group_results,
86
+ group_report_text,
87
+ default_subject_names,
88
+ scan_recording,
89
+ scan_recordings,
90
+ GROUP_SETTINGS_FILENAME,
91
+ load_group_recording,
92
+ run_group_analysis,
93
+ write_group_settings,
94
+ read_group_settings,
95
+ )
96
+
97
+ from .splice import (
98
+ splice_keep_inside,
99
+ splice_cut_out,
100
+ replay_splices,
101
+ MODE_CUT_OUT,
102
+ MODE_KEEP_INSIDE,
103
+ )
104
+
105
+ from .markers import (
106
+ PHASE_SUFFIX,
107
+ store_display_name,
108
+ marker_display_label,
109
+ group_markers_by_name,
110
+ )
111
+
112
+ from .recording import (
113
+ SAVES_FOLDER,
114
+ saved_state_dir,
115
+ marker_sidecar_path,
116
+ legacy_marker_sidecar_path,
117
+ annotation_sidecar_path,
118
+ splice_sidecar_path,
119
+ read_saved_splices,
120
+ read_saved_markers,
121
+ read_saved_annotations,
122
+ signal_labels_path,
123
+ read_saved_signal_labels,
124
+ apply_signal_labels,
125
+ current_signal_labels,
126
+ build_signal_options,
127
+ make_tdt_cache,
128
+ make_oxysoft_cache,
129
+ make_generic_cache,
130
+ normalized_signal,
131
+ apply_splice,
132
+ apply_splices,
133
+ spliced_store_name,
134
+ load_tdt_recording,
135
+ load_recording,
136
+ find_tdt_recordings,
137
+ )
138
+
139
+ from .models import (
140
+ double_exponential_model,
141
+ visibility_model,
142
+ linear_model,
143
+ single_exponential_model,
144
+ exponential_rise_model,
145
+ gaussian_model,
146
+ sinusoidal_model,
147
+ CURVE_FIT_MODELS,
148
+ )
149
+
150
+ from .fieldstudy.study import (
151
+ run_field_study_pipeline,
152
+ load_field_study_folder,
153
+ peek_fields,
154
+ flag_low_quality,
155
+ embed_text_fields,
156
+ compute_delta_vector,
157
+ compute_paired_similarity,
158
+ permutation_test_similarity,
159
+ wordcount_confound_check,
160
+ )
161
+
162
+ from .fieldstudy.validation import (
163
+ run_validation_pipeline,
164
+ build_validation_summary,
165
+ cohens_d,
166
+ benjamini_hochberg,
167
+ wordcount_controlled_regression,
168
+ bootstrap_mean_ci,
169
+ leave_one_out_sensitivity,
170
+ )
171
+
172
+ # Scripted use: run any analysis from a recording and a parameter dict, and run one again from its provenance record.
173
+ # `reproduce` stays the module (PyATCLI.reproduce); its function is reproduce_record.
174
+ from .analyses import (
175
+ run_analysis,
176
+ kinds,
177
+ describe_kinds,
178
+ normalize_parameters,
179
+ AnalysisResult,
180
+ ParameterError,
181
+ AnalysisError,
182
+ )
183
+
184
+ from .reproduce import (
185
+ reproduce as reproduce_record,
186
+ compare_table,
187
+ Reproduction,
188
+ ReproduceError,
189
+ )
190
+
191
+ # Where results go once there is an Output folder (the same layout PyAT's exports use)
192
+ from . import outputs, saved_state
193
+
194
+ # What an Export View holds, as numbers (PyAT draws the figure; nothing in this library draws)
195
+ from .analyses import VIEW_KIND, run_view
196
+ from .results import NoResults, OpenedResults, open_results
PyATCLI/__main__.py ADDED
@@ -0,0 +1,7 @@
1
+ """`python -m PyATCLI` — the command line (see cli.py)."""
2
+
3
+ import sys
4
+
5
+ from .cli import main
6
+
7
+ sys.exit(main())
PyATCLI/_version.py ADDED
@@ -0,0 +1,47 @@
1
+ """
2
+ _version.py
3
+ -----------
4
+ Which version of this library is running — the one place that decides, so the package's
5
+ `__version__`, the app's error-log header and every provenance record agree.
6
+
7
+ An installed copy reports its distribution's version. A copy running from a source checkout (a
8
+ pyproject.toml for this project sits beside the package) reports that checkout's own version
9
+ instead: an editable install's metadata is only refreshed by re-running pip, so it quietly goes
10
+ stale (a checkout at 2026.10.2 kept reporting 2026.8.20), and a result stamped with the wrong
11
+ library version is worse than one with none.
12
+ """
13
+
14
+ import os
15
+ import re
16
+ from importlib.metadata import PackageNotFoundError, version as _dist_version
17
+
18
+ DISTRIBUTION = "PyATCLI"
19
+
20
+
21
+ def source_tree_version():
22
+ """The version in the pyproject.toml beside the package, if this is a source checkout of this
23
+ project; None for an installed copy (wheels carry no pyproject)."""
24
+ here = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
25
+ try:
26
+ with open(os.path.join(here, "pyproject.toml"), encoding="utf-8") as f:
27
+ text = f.read()
28
+ except OSError:
29
+ return None
30
+ if not re.search(r'^name\s*=\s*"' + re.escape(DISTRIBUTION) + '"', text, re.M):
31
+ return None
32
+ m = re.search(r'^version\s*=\s*"([^"]+)"', text, re.M)
33
+ return m.group(1) if m else None
34
+
35
+
36
+ def installed_version():
37
+ """The installed distribution's version, or None if it isn't installed."""
38
+ try:
39
+ return _dist_version(DISTRIBUTION)
40
+ except PackageNotFoundError:
41
+ return None
42
+
43
+
44
+ def resolve_version():
45
+ """The running version: the source checkout's if running from one, else the installed
46
+ distribution's, else "unknown"."""
47
+ return source_tree_version() or installed_version() or "unknown"