ftmwpipeline 0.1.0b1__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 (144) hide show
  1. ftmwpipeline-0.1.0b1/LICENSE +21 -0
  2. ftmwpipeline-0.1.0b1/PKG-INFO +163 -0
  3. ftmwpipeline-0.1.0b1/README.md +108 -0
  4. ftmwpipeline-0.1.0b1/pyproject.toml +195 -0
  5. ftmwpipeline-0.1.0b1/setup.cfg +4 -0
  6. ftmwpipeline-0.1.0b1/src/ftmwpipeline/__init__.py +79 -0
  7. ftmwpipeline-0.1.0b1/src/ftmwpipeline/__main__.py +10 -0
  8. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/__init__.py +19 -0
  9. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/active_ft_support.py +214 -0
  10. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/catalog_xref.py +447 -0
  11. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/clocks_impl.py +114 -0
  12. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/progress.py +158 -0
  13. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/report_diff_impl.py +491 -0
  14. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/report_html_impl.py +4477 -0
  15. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/report_impl.py +2400 -0
  16. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/run_impl.py +217 -0
  17. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/shape_recommendation_impl.py +219 -0
  18. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/shared_utils.py +239 -0
  19. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/stage0_impl.py +391 -0
  20. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/stage1_impl.py +354 -0
  21. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/stage2_impl.py +540 -0
  22. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/stage2b_impl.py +515 -0
  23. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/stage3_impl.py +1015 -0
  24. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/stage4_impl.py +334 -0
  25. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/stage5_impl.py +3268 -0
  26. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/stage5_validation_impl.py +475 -0
  27. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/stage6_impl.py +3875 -0
  28. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/start_detection_impl.py +193 -0
  29. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/tau_settings_resolution.py +96 -0
  30. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/timebase_impl.py +249 -0
  31. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/tuning/__init__.py +43 -0
  32. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/tuning/engine.py +470 -0
  33. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/tuning/fit_support.py +212 -0
  34. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/tuning/plots.py +1960 -0
  35. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/tuning/registry.py +1512 -0
  36. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/tuning/settings_inspection.py +313 -0
  37. ftmwpipeline-0.1.0b1/src/ftmwpipeline/_internal/tuning/settings_mutation.py +436 -0
  38. ftmwpipeline-0.1.0b1/src/ftmwpipeline/api.py +2305 -0
  39. ftmwpipeline-0.1.0b1/src/ftmwpipeline/cli/__init__.py +9 -0
  40. ftmwpipeline-0.1.0b1/src/ftmwpipeline/cli/_argspec.py +97 -0
  41. ftmwpipeline-0.1.0b1/src/ftmwpipeline/cli/clocks_commands.py +219 -0
  42. ftmwpipeline-0.1.0b1/src/ftmwpipeline/cli/data_commands.py +549 -0
  43. ftmwpipeline-0.1.0b1/src/ftmwpipeline/cli/fitting_commands.py +622 -0
  44. ftmwpipeline-0.1.0b1/src/ftmwpipeline/cli/ft_commands.py +330 -0
  45. ftmwpipeline-0.1.0b1/src/ftmwpipeline/cli/info_commands.py +78 -0
  46. ftmwpipeline-0.1.0b1/src/ftmwpipeline/cli/main.py +194 -0
  47. ftmwpipeline-0.1.0b1/src/ftmwpipeline/cli/noise_commands.py +360 -0
  48. ftmwpipeline-0.1.0b1/src/ftmwpipeline/cli/peak_commands.py +243 -0
  49. ftmwpipeline-0.1.0b1/src/ftmwpipeline/cli/report_commands.py +330 -0
  50. ftmwpipeline-0.1.0b1/src/ftmwpipeline/cli/review_commands.py +1210 -0
  51. ftmwpipeline-0.1.0b1/src/ftmwpipeline/cli/run_commands.py +196 -0
  52. ftmwpipeline-0.1.0b1/src/ftmwpipeline/cli/scan_commands.py +515 -0
  53. ftmwpipeline-0.1.0b1/src/ftmwpipeline/cli/settings_commands.py +303 -0
  54. ftmwpipeline-0.1.0b1/src/ftmwpipeline/cli/start_commands.py +241 -0
  55. ftmwpipeline-0.1.0b1/src/ftmwpipeline/cli/tau_commands.py +379 -0
  56. ftmwpipeline-0.1.0b1/src/ftmwpipeline/cli/timebase_commands.py +218 -0
  57. ftmwpipeline-0.1.0b1/src/ftmwpipeline/cli/utils.py +183 -0
  58. ftmwpipeline-0.1.0b1/src/ftmwpipeline/cli/window_commands.py +210 -0
  59. ftmwpipeline-0.1.0b1/src/ftmwpipeline/core/__init__.py +45 -0
  60. ftmwpipeline-0.1.0b1/src/ftmwpipeline/core/data_structures.py +2089 -0
  61. ftmwpipeline-0.1.0b1/src/ftmwpipeline/core/knob_metadata.py +207 -0
  62. ftmwpipeline-0.1.0b1/src/ftmwpipeline/core/noise_settings.py +360 -0
  63. ftmwpipeline-0.1.0b1/src/ftmwpipeline/core/peak_detection_settings.py +479 -0
  64. ftmwpipeline-0.1.0b1/src/ftmwpipeline/core/peak_shape.py +57 -0
  65. ftmwpipeline-0.1.0b1/src/ftmwpipeline/core/settings.py +260 -0
  66. ftmwpipeline-0.1.0b1/src/ftmwpipeline/core/settings_framework.py +378 -0
  67. ftmwpipeline-0.1.0b1/src/ftmwpipeline/core/stage_fit_settings.py +1219 -0
  68. ftmwpipeline-0.1.0b1/src/ftmwpipeline/core/start_detection_settings.py +68 -0
  69. ftmwpipeline-0.1.0b1/src/ftmwpipeline/core/tau_calibration_settings.py +585 -0
  70. ftmwpipeline-0.1.0b1/src/ftmwpipeline/core/window_planning_settings.py +449 -0
  71. ftmwpipeline-0.1.0b1/src/ftmwpipeline/file_manager.py +816 -0
  72. ftmwpipeline-0.1.0b1/src/ftmwpipeline/fitting/__init__.py +158 -0
  73. ftmwpipeline-0.1.0b1/src/ftmwpipeline/fitting/active_ft.py +245 -0
  74. ftmwpipeline-0.1.0b1/src/ftmwpipeline/fitting/clock_lattice.py +353 -0
  75. ftmwpipeline-0.1.0b1/src/ftmwpipeline/fitting/doublet_alternative.py +536 -0
  76. ftmwpipeline-0.1.0b1/src/ftmwpipeline/fitting/peak_model.py +823 -0
  77. ftmwpipeline-0.1.0b1/src/ftmwpipeline/fitting/plan_execution.py +4809 -0
  78. ftmwpipeline-0.1.0b1/src/ftmwpipeline/fitting/residual_rescue.py +2053 -0
  79. ftmwpipeline-0.1.0b1/src/ftmwpipeline/fitting/residual_screening.py +205 -0
  80. ftmwpipeline-0.1.0b1/src/ftmwpipeline/fitting/result_conversion.py +849 -0
  81. ftmwpipeline-0.1.0b1/src/ftmwpipeline/fitting/spur_detection.py +1718 -0
  82. ftmwpipeline-0.1.0b1/src/ftmwpipeline/fitting/tau_calibration.py +2962 -0
  83. ftmwpipeline-0.1.0b1/src/ftmwpipeline/fitting/timebase_calibration.py +520 -0
  84. ftmwpipeline-0.1.0b1/src/ftmwpipeline/fitting/validation.py +1739 -0
  85. ftmwpipeline-0.1.0b1/src/ftmwpipeline/fitting/window_fit.py +3575 -0
  86. ftmwpipeline-0.1.0b1/src/ftmwpipeline/io/__init__.py +34 -0
  87. ftmwpipeline-0.1.0b1/src/ftmwpipeline/io/_hdf5_helpers.py +77 -0
  88. ftmwpipeline-0.1.0b1/src/ftmwpipeline/io/_settings_serialization.py +146 -0
  89. ftmwpipeline-0.1.0b1/src/ftmwpipeline/io/acquisition_layout.py +311 -0
  90. ftmwpipeline-0.1.0b1/src/ftmwpipeline/io/data_loaders/__init__.py +57 -0
  91. ftmwpipeline-0.1.0b1/src/ftmwpipeline/io/data_loaders/base.py +224 -0
  92. ftmwpipeline-0.1.0b1/src/ftmwpipeline/io/data_loaders/blackchirp.py +601 -0
  93. ftmwpipeline-0.1.0b1/src/ftmwpipeline/io/data_loaders/csv.py +175 -0
  94. ftmwpipeline-0.1.0b1/src/ftmwpipeline/io/data_loaders/ftmw_hdf5.py +269 -0
  95. ftmwpipeline-0.1.0b1/src/ftmwpipeline/io/data_loaders/keysight_mat.py +403 -0
  96. ftmwpipeline-0.1.0b1/src/ftmwpipeline/io/data_loaders/registry.py +339 -0
  97. ftmwpipeline-0.1.0b1/src/ftmwpipeline/io/fid_serialization.py +702 -0
  98. ftmwpipeline-0.1.0b1/src/ftmwpipeline/io/fitting_serialization.py +908 -0
  99. ftmwpipeline-0.1.0b1/src/ftmwpipeline/io/frequency_calibration_serialization.py +37 -0
  100. ftmwpipeline-0.1.0b1/src/ftmwpipeline/io/input_metadata.py +222 -0
  101. ftmwpipeline-0.1.0b1/src/ftmwpipeline/io/logging.py +20 -0
  102. ftmwpipeline-0.1.0b1/src/ftmwpipeline/io/noise_result_serialization.py +236 -0
  103. ftmwpipeline-0.1.0b1/src/ftmwpipeline/io/noise_settings_serialization.py +95 -0
  104. ftmwpipeline-0.1.0b1/src/ftmwpipeline/io/peak_detection_settings_serialization.py +102 -0
  105. ftmwpipeline-0.1.0b1/src/ftmwpipeline/io/peak_serialization.py +225 -0
  106. ftmwpipeline-0.1.0b1/src/ftmwpipeline/io/stage6_review_serialization.py +251 -0
  107. ftmwpipeline-0.1.0b1/src/ftmwpipeline/io/stage_fit_settings_serialization.py +388 -0
  108. ftmwpipeline-0.1.0b1/src/ftmwpipeline/io/tau_calibration_serialization.py +380 -0
  109. ftmwpipeline-0.1.0b1/src/ftmwpipeline/io/tau_calibration_settings_serialization.py +142 -0
  110. ftmwpipeline-0.1.0b1/src/ftmwpipeline/io/timebase_serialization.py +165 -0
  111. ftmwpipeline-0.1.0b1/src/ftmwpipeline/io/window_planning_settings_serialization.py +102 -0
  112. ftmwpipeline-0.1.0b1/src/ftmwpipeline/io/window_serialization.py +200 -0
  113. ftmwpipeline-0.1.0b1/src/ftmwpipeline/pipeline.py +2341 -0
  114. ftmwpipeline-0.1.0b1/src/ftmwpipeline/preprocessing/__init__.py +24 -0
  115. ftmwpipeline-0.1.0b1/src/ftmwpipeline/preprocessing/coherence_screen.py +365 -0
  116. ftmwpipeline-0.1.0b1/src/ftmwpipeline/preprocessing/edge_coherence.py +319 -0
  117. ftmwpipeline-0.1.0b1/src/ftmwpipeline/preprocessing/leakage.py +135 -0
  118. ftmwpipeline-0.1.0b1/src/ftmwpipeline/preprocessing/noise_estimation.py +751 -0
  119. ftmwpipeline-0.1.0b1/src/ftmwpipeline/preprocessing/peak_detection.py +492 -0
  120. ftmwpipeline-0.1.0b1/src/ftmwpipeline/preprocessing/start_detection.py +159 -0
  121. ftmwpipeline-0.1.0b1/src/ftmwpipeline/preprocessing/window_planning.py +1275 -0
  122. ftmwpipeline-0.1.0b1/src/ftmwpipeline/presets/__init__.py +12 -0
  123. ftmwpipeline-0.1.0b1/src/ftmwpipeline/presets/defaults.yaml +220 -0
  124. ftmwpipeline-0.1.0b1/src/ftmwpipeline/utils/__init__.py +20 -0
  125. ftmwpipeline-0.1.0b1/src/ftmwpipeline/utils/parallelism.py +33 -0
  126. ftmwpipeline-0.1.0b1/src/ftmwpipeline/utils/signal_processing.py +192 -0
  127. ftmwpipeline-0.1.0b1/src/ftmwpipeline/visualization/__init__.py +18 -0
  128. ftmwpipeline-0.1.0b1/src/ftmwpipeline/visualization/fid_visualization.py +399 -0
  129. ftmwpipeline-0.1.0b1/src/ftmwpipeline/visualization/fit_detail.py +1373 -0
  130. ftmwpipeline-0.1.0b1/src/ftmwpipeline/visualization/fit_visualization.py +994 -0
  131. ftmwpipeline-0.1.0b1/src/ftmwpipeline/visualization/noise_visualization.py +178 -0
  132. ftmwpipeline-0.1.0b1/src/ftmwpipeline/visualization/peak_visualization.py +216 -0
  133. ftmwpipeline-0.1.0b1/src/ftmwpipeline/visualization/report_style.py +149 -0
  134. ftmwpipeline-0.1.0b1/src/ftmwpipeline/visualization/spectrum_visualization.py +311 -0
  135. ftmwpipeline-0.1.0b1/src/ftmwpipeline/visualization/start_detection_visualization.py +113 -0
  136. ftmwpipeline-0.1.0b1/src/ftmwpipeline/visualization/tau_calibration_visualization.py +555 -0
  137. ftmwpipeline-0.1.0b1/src/ftmwpipeline/visualization/window_visualization.py +160 -0
  138. ftmwpipeline-0.1.0b1/src/ftmwpipeline/workflows.py +56 -0
  139. ftmwpipeline-0.1.0b1/src/ftmwpipeline.egg-info/PKG-INFO +163 -0
  140. ftmwpipeline-0.1.0b1/src/ftmwpipeline.egg-info/SOURCES.txt +142 -0
  141. ftmwpipeline-0.1.0b1/src/ftmwpipeline.egg-info/dependency_links.txt +1 -0
  142. ftmwpipeline-0.1.0b1/src/ftmwpipeline.egg-info/entry_points.txt +2 -0
  143. ftmwpipeline-0.1.0b1/src/ftmwpipeline.egg-info/requires.txt +31 -0
  144. ftmwpipeline-0.1.0b1/src/ftmwpipeline.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Kyle N. Crabtree
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,163 @@
1
+ Metadata-Version: 2.4
2
+ Name: ftmwpipeline
3
+ Version: 0.1.0b1
4
+ Summary: A Python package for FTMW spectroscopy signal processing and peak fitting
5
+ Author-email: "Kyle N. Crabtree" <kncrabtree@ucdavis.edu>
6
+ Maintainer-email: "Kyle N. Crabtree" <kncrabtree@ucdavis.edu>
7
+ License-Expression: MIT
8
+ Project-URL: Homepage, https://github.com/kncrabtree/ftmwpipeline
9
+ Project-URL: Documentation, https://ftmwpipeline.readthedocs.io/
10
+ Project-URL: Repository, https://github.com/kncrabtree/ftmwpipeline.git
11
+ Project-URL: Bug Tracker, https://github.com/kncrabtree/ftmwpipeline/issues
12
+ Keywords: spectroscopy,FTMW,signal-processing,peak-fitting,scientific-computing
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Scientific/Engineering :: Physics
22
+ Classifier: Topic :: Scientific/Engineering :: Chemistry
23
+ Requires-Python: >=3.9
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: numpy>=1.21.0
27
+ Requires-Dist: scipy>=1.7.0
28
+ Requires-Dist: matplotlib>=3.5.0
29
+ Requires-Dist: pandas>=1.3.0
30
+ Requires-Dist: h5py>=3.1.0
31
+ Requires-Dist: pyyaml>=6.0
32
+ Requires-Dist: tqdm>=4.60.0
33
+ Requires-Dist: threadpoolctl>=3.0.0
34
+ Requires-Dist: blackchirp>=0.1.0rc2
35
+ Provides-Extra: dev
36
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
37
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
38
+ Requires-Dist: pytest-xdist>=3.0.0; extra == "dev"
39
+ Requires-Dist: black>=22.0.0; extra == "dev"
40
+ Requires-Dist: isort>=5.10.0; extra == "dev"
41
+ Requires-Dist: flake8>=5.0.0; extra == "dev"
42
+ Requires-Dist: Flake8-pyproject>=1.2.0; extra == "dev"
43
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
44
+ Requires-Dist: pre-commit>=2.15.0; extra == "dev"
45
+ Requires-Dist: build>=1.0.0; extra == "dev"
46
+ Requires-Dist: twine>=4.0.0; extra == "dev"
47
+ Provides-Extra: docs
48
+ Requires-Dist: sphinx>=5.0.0; extra == "docs"
49
+ Requires-Dist: sphinx-rtd-theme>=1.0.0; extra == "docs"
50
+ Provides-Extra: notebook
51
+ Requires-Dist: jupyter>=1.0.0; extra == "notebook"
52
+ Requires-Dist: ipywidgets>=7.6.0; extra == "notebook"
53
+ Requires-Dist: ipykernel>=6.0.0; extra == "notebook"
54
+ Dynamic: license-file
55
+
56
+ # ftmwpipeline
57
+
58
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
59
+ [![Python](https://img.shields.io/badge/python-3.9%2B-blue.svg)](pyproject.toml)
60
+
61
+ A Python package for FTMW (Fourier Transform Microwave) spectroscopy signal
62
+ processing and peak fitting — from a raw free-induction decay to a fitted line
63
+ list with honest uncertainties.
64
+
65
+ The design goal is a **statistically faithful** measurement, not just a
66
+ plausible-looking spectrum:
67
+
68
+ - **Unbiased spectrum.** The canonical Fourier transform is computed with no
69
+ apodization, time-domain windowing, or zero-padding. Those operations trade
70
+ frequency resolution, bias the line shape, and interpolate bins so the noise
71
+ and χ² statistics no longer mean what they should. Keeping the transform
72
+ native-length preserves resolution and the line shape, and keeps the per-bin
73
+ statistics valid for everything downstream.
74
+ - **Rigorous from noise to fit.** A region-aware, per-bin noise estimate sets
75
+ detection thresholds; lines are fit in the time domain over finite-duration
76
+ windows; and fitted parameters carry uncertainties propagated **with their
77
+ correlations**, not as independent error bars. A reported precision reflects
78
+ what the data actually constrains.
79
+ - **Reproducible and portable.** Each experiment is one self-contained `.ftmw`
80
+ file. Given the file and a compatible package version, the analysis
81
+ reproduces the same result on any machine — no external preset or side
82
+ artifact can silently change it.
83
+ - **One analysis, three interfaces.** A command-line interface, an
84
+ object-oriented `Pipeline` class, and a stateless functional API are thin
85
+ wrappers over one implementation and produce numerically identical results;
86
+ use whichever fits your workflow.
87
+
88
+ ## Installation
89
+
90
+ `ftmwpipeline` is currently in open beta. To install,
91
+
92
+ ```bash
93
+ pip install --pre ftmwpipeline
94
+ ```
95
+
96
+ This pulls in the scientific Python stack (NumPy, SciPy, Matplotlib, pandas,
97
+ h5py) and the `blackchirp` loader dependency. Testing and documentation tooling
98
+ are available as extras (`[dev]`, `[docs]`).
99
+
100
+ To work from a clone, install in editable mode — directly with pip, or via the
101
+ provided conda environment files:
102
+
103
+ ```bash
104
+ pip install -e ".[dev]"
105
+ # or
106
+ conda env create -f environment-dev.yml && conda activate ftmwpipeline-dev
107
+ ```
108
+
109
+ ## Quick start
110
+
111
+ Process a raw experiment end to end in one command:
112
+
113
+ ```bash
114
+ ftmwpipeline run path/to/experiment/ --output exp.ftmw --trim 26500:40000
115
+ ```
116
+
117
+ `--trim` selects the active spectral band (MHz). The same build from Python,
118
+ through the class API:
119
+
120
+ ```python
121
+ from ftmwpipeline import Pipeline
122
+
123
+ result = Pipeline.build("path/to/experiment/", trim=(26500, 40000), output="exp.ftmw")
124
+ pipe = Pipeline.open(result["pipeline_file"])
125
+ print(pipe.info()) # provenance, completed stages, next available stages
126
+ ```
127
+
128
+ or driven stage by stage, with the same calls available on the functional API
129
+ (`import ftmwpipeline.api as ftmw`):
130
+
131
+ ```python
132
+ pipe = Pipeline.create("exp.ftmw", source="path/to/experiment/")
133
+ pipe.compute_ft(trim=(26500, 40000))
134
+ pipe.estimate_noise()
135
+ pipe.calibrate_tau()
136
+ pipe.detect_peaks()
137
+ pipe.assign_windows()
138
+ pipe.fit_peaks()
139
+ ```
140
+
141
+ At the command line each stage runs with the object-verb grammar
142
+ (`<stage> run` / `<stage> show`):
143
+
144
+ ```bash
145
+ ftmwpipeline data import exp.ftmw path/to/experiment/
146
+ ftmwpipeline ft run exp.ftmw --trim 26500:40000
147
+ ftmwpipeline noise run exp.ftmw
148
+ ftmwpipeline tau run exp.ftmw
149
+ ftmwpipeline peaks run exp.ftmw
150
+ ftmwpipeline windows run exp.ftmw
151
+ ftmwpipeline fit run exp.ftmw
152
+ ftmwpipeline report run exp.ftmw --output-dir report
153
+ ```
154
+
155
+ ## Documentation
156
+
157
+ Full documentation — installation, a worked quickstart on bundled example data,
158
+ a guide to each pipeline stage, and the CLI/API reference — is at
159
+ [ftmwpipeline.readthedocs.io](https://ftmwpipeline.readthedocs.io/).
160
+
161
+ ## License
162
+
163
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,108 @@
1
+ # ftmwpipeline
2
+
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
4
+ [![Python](https://img.shields.io/badge/python-3.9%2B-blue.svg)](pyproject.toml)
5
+
6
+ A Python package for FTMW (Fourier Transform Microwave) spectroscopy signal
7
+ processing and peak fitting — from a raw free-induction decay to a fitted line
8
+ list with honest uncertainties.
9
+
10
+ The design goal is a **statistically faithful** measurement, not just a
11
+ plausible-looking spectrum:
12
+
13
+ - **Unbiased spectrum.** The canonical Fourier transform is computed with no
14
+ apodization, time-domain windowing, or zero-padding. Those operations trade
15
+ frequency resolution, bias the line shape, and interpolate bins so the noise
16
+ and χ² statistics no longer mean what they should. Keeping the transform
17
+ native-length preserves resolution and the line shape, and keeps the per-bin
18
+ statistics valid for everything downstream.
19
+ - **Rigorous from noise to fit.** A region-aware, per-bin noise estimate sets
20
+ detection thresholds; lines are fit in the time domain over finite-duration
21
+ windows; and fitted parameters carry uncertainties propagated **with their
22
+ correlations**, not as independent error bars. A reported precision reflects
23
+ what the data actually constrains.
24
+ - **Reproducible and portable.** Each experiment is one self-contained `.ftmw`
25
+ file. Given the file and a compatible package version, the analysis
26
+ reproduces the same result on any machine — no external preset or side
27
+ artifact can silently change it.
28
+ - **One analysis, three interfaces.** A command-line interface, an
29
+ object-oriented `Pipeline` class, and a stateless functional API are thin
30
+ wrappers over one implementation and produce numerically identical results;
31
+ use whichever fits your workflow.
32
+
33
+ ## Installation
34
+
35
+ `ftmwpipeline` is currently in open beta. To install,
36
+
37
+ ```bash
38
+ pip install --pre ftmwpipeline
39
+ ```
40
+
41
+ This pulls in the scientific Python stack (NumPy, SciPy, Matplotlib, pandas,
42
+ h5py) and the `blackchirp` loader dependency. Testing and documentation tooling
43
+ are available as extras (`[dev]`, `[docs]`).
44
+
45
+ To work from a clone, install in editable mode — directly with pip, or via the
46
+ provided conda environment files:
47
+
48
+ ```bash
49
+ pip install -e ".[dev]"
50
+ # or
51
+ conda env create -f environment-dev.yml && conda activate ftmwpipeline-dev
52
+ ```
53
+
54
+ ## Quick start
55
+
56
+ Process a raw experiment end to end in one command:
57
+
58
+ ```bash
59
+ ftmwpipeline run path/to/experiment/ --output exp.ftmw --trim 26500:40000
60
+ ```
61
+
62
+ `--trim` selects the active spectral band (MHz). The same build from Python,
63
+ through the class API:
64
+
65
+ ```python
66
+ from ftmwpipeline import Pipeline
67
+
68
+ result = Pipeline.build("path/to/experiment/", trim=(26500, 40000), output="exp.ftmw")
69
+ pipe = Pipeline.open(result["pipeline_file"])
70
+ print(pipe.info()) # provenance, completed stages, next available stages
71
+ ```
72
+
73
+ or driven stage by stage, with the same calls available on the functional API
74
+ (`import ftmwpipeline.api as ftmw`):
75
+
76
+ ```python
77
+ pipe = Pipeline.create("exp.ftmw", source="path/to/experiment/")
78
+ pipe.compute_ft(trim=(26500, 40000))
79
+ pipe.estimate_noise()
80
+ pipe.calibrate_tau()
81
+ pipe.detect_peaks()
82
+ pipe.assign_windows()
83
+ pipe.fit_peaks()
84
+ ```
85
+
86
+ At the command line each stage runs with the object-verb grammar
87
+ (`<stage> run` / `<stage> show`):
88
+
89
+ ```bash
90
+ ftmwpipeline data import exp.ftmw path/to/experiment/
91
+ ftmwpipeline ft run exp.ftmw --trim 26500:40000
92
+ ftmwpipeline noise run exp.ftmw
93
+ ftmwpipeline tau run exp.ftmw
94
+ ftmwpipeline peaks run exp.ftmw
95
+ ftmwpipeline windows run exp.ftmw
96
+ ftmwpipeline fit run exp.ftmw
97
+ ftmwpipeline report run exp.ftmw --output-dir report
98
+ ```
99
+
100
+ ## Documentation
101
+
102
+ Full documentation — installation, a worked quickstart on bundled example data,
103
+ a guide to each pipeline stage, and the CLI/API reference — is at
104
+ [ftmwpipeline.readthedocs.io](https://ftmwpipeline.readthedocs.io/).
105
+
106
+ ## License
107
+
108
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,195 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "ftmwpipeline"
7
+ dynamic = ["version"]
8
+ description = "A Python package for FTMW spectroscopy signal processing and peak fitting"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ authors = [
13
+ {name = "Kyle N. Crabtree", email = "kncrabtree@ucdavis.edu"}
14
+ ]
15
+ maintainers = [
16
+ {name = "Kyle N. Crabtree", email = "kncrabtree@ucdavis.edu"}
17
+ ]
18
+ classifiers = [
19
+ "Development Status :: 4 - Beta",
20
+ "Intended Audience :: Science/Research",
21
+ "Operating System :: OS Independent",
22
+ "Programming Language :: Python :: 3",
23
+ "Programming Language :: Python :: 3.9",
24
+ "Programming Language :: Python :: 3.10",
25
+ "Programming Language :: Python :: 3.11",
26
+ "Programming Language :: Python :: 3.12",
27
+ "Topic :: Scientific/Engineering :: Physics",
28
+ "Topic :: Scientific/Engineering :: Chemistry",
29
+ ]
30
+ keywords = ["spectroscopy", "FTMW", "signal-processing", "peak-fitting", "scientific-computing"]
31
+ requires-python = ">=3.9"
32
+ dependencies = [
33
+ "numpy>=1.21.0",
34
+ "scipy>=1.7.0",
35
+ "matplotlib>=3.5.0",
36
+ "pandas>=1.3.0",
37
+ "h5py>=3.1.0",
38
+ "pyyaml>=6.0",
39
+ "tqdm>=4.60.0",
40
+ # Cross-backend BLAS/OpenMP thread limiting for the Stage 5 fork pool: the
41
+ # workers must run single-threaded BLAS to avoid N-workers x M-threads
42
+ # oversubscription, and threadpoolctl re-limits the already-loaded runtime
43
+ # (OpenBLAS / MKL / BLIS / Accelerate) at fork time -- an env var cannot,
44
+ # the backend reads it only at init, which has already happened.
45
+ "threadpoolctl>=3.0.0",
46
+ # 0.1.0rc2+ (the 2.0 pre-release line) exposes BCFTMW.get_fid /
47
+ # BCFid.is_lower_sideband and the version-tolerant enum parsing the
48
+ # Blackchirp loader delegates to. The stable 0.0.11 release predates them.
49
+ "blackchirp>=0.1.0rc2",
50
+ ]
51
+
52
+ [project.optional-dependencies]
53
+ dev = [
54
+ "pytest>=7.0.0",
55
+ "pytest-cov>=4.0.0",
56
+ "pytest-xdist>=3.0.0",
57
+ "black>=22.0.0",
58
+ "isort>=5.10.0",
59
+ "flake8>=5.0.0",
60
+ # Lets flake8 read the [tool.flake8] config from pyproject.toml (flake8 does
61
+ # not read pyproject natively), so local and CI linting agree.
62
+ "Flake8-pyproject>=1.2.0",
63
+ "mypy>=1.0.0",
64
+ "pre-commit>=2.15.0",
65
+ # Release tooling: build sdist/wheel and validate the package metadata.
66
+ "build>=1.0.0",
67
+ "twine>=4.0.0",
68
+ ]
69
+ docs = [
70
+ "sphinx>=5.0.0",
71
+ "sphinx-rtd-theme>=1.0.0",
72
+ ]
73
+ notebook = [
74
+ "jupyter>=1.0.0",
75
+ "ipywidgets>=7.6.0",
76
+ "ipykernel>=6.0.0",
77
+ ]
78
+
79
+ [project.urls]
80
+ Homepage = "https://github.com/kncrabtree/ftmwpipeline"
81
+ Documentation = "https://ftmwpipeline.readthedocs.io/"
82
+ Repository = "https://github.com/kncrabtree/ftmwpipeline.git"
83
+ "Bug Tracker" = "https://github.com/kncrabtree/ftmwpipeline/issues"
84
+
85
+ [project.scripts]
86
+ ftmwpipeline = "ftmwpipeline.cli:main"
87
+
88
+ [tool.setuptools.dynamic]
89
+ version = {attr = "ftmwpipeline.__version__"}
90
+
91
+ [tool.setuptools.packages.find]
92
+ where = ["src"]
93
+
94
+ [tool.setuptools.package-data]
95
+ ftmwpipeline = ["presets/*.yaml"]
96
+
97
+ [tool.pytest.ini_options]
98
+ minversion = "7.0"
99
+ addopts = [
100
+ "-ra",
101
+ "--strict-markers",
102
+ "--strict-config",
103
+ "--cov=ftmwpipeline",
104
+ "--cov-report=term-missing",
105
+ "--cov-report=html",
106
+ "--cov-report=xml",
107
+ ]
108
+ testpaths = ["tests"]
109
+ python_files = ["test_*.py", "*_test.py"]
110
+ python_classes = ["Test*"]
111
+ python_functions = ["test_*"]
112
+ markers = [
113
+ "slow: marks tests as slow (deselect with '-m \"not slow\"')",
114
+ "integration: marks tests as integration tests",
115
+ "unit: marks tests as unit tests",
116
+ "performance: marks tests as performance benchmarks",
117
+ ]
118
+
119
+ [tool.coverage.run]
120
+ source = ["src/ftmwpipeline"]
121
+ omit = [
122
+ "*/tests/*",
123
+ "*/test_*",
124
+ "setup.py",
125
+ ]
126
+
127
+ [tool.coverage.report]
128
+ exclude_lines = [
129
+ "pragma: no cover",
130
+ "def __repr__",
131
+ "if self.debug:",
132
+ "if settings.DEBUG",
133
+ "raise AssertionError",
134
+ "raise NotImplementedError",
135
+ "if 0:",
136
+ "if __name__ == .__main__.:",
137
+ "class .*\\bProtocol\\):",
138
+ "@(abc\\.)?abstractmethod",
139
+ ]
140
+
141
+ [tool.black]
142
+ line-length = 88
143
+ target-version = ['py39', 'py310', 'py311', 'py312']
144
+ include = '\.pyi?$'
145
+ exclude = '''
146
+ /(
147
+ \.eggs
148
+ | \.git
149
+ | \.hg
150
+ | \.mypy_cache
151
+ | \.tox
152
+ | \.venv
153
+ | _build
154
+ | buck-out
155
+ | build
156
+ | dist
157
+ )/
158
+ '''
159
+
160
+ [tool.isort]
161
+ profile = "black"
162
+ multi_line_output = 3
163
+ line_length = 88
164
+ known_first_party = ["ftmwpipeline"]
165
+
166
+ [tool.flake8]
167
+ max-line-length = 88
168
+ extend-ignore = ["E203", "W503", "E501"]
169
+ exclude = [".git", "__pycache__", "build", "dist", ".eggs"]
170
+
171
+ [tool.mypy]
172
+ python_version = "3.9"
173
+ warn_return_any = true
174
+ warn_unused_configs = true
175
+ disallow_untyped_defs = true
176
+ disallow_incomplete_defs = true
177
+ check_untyped_defs = true
178
+ disallow_untyped_decorators = true
179
+ no_implicit_optional = true
180
+ warn_redundant_casts = true
181
+ warn_unused_ignores = true
182
+ warn_no_return = true
183
+ warn_unreachable = true
184
+ strict_equality = true
185
+
186
+ [[tool.mypy.overrides]]
187
+ module = [
188
+ "scipy.*",
189
+ "matplotlib.*",
190
+ "h5py.*",
191
+ "pandas.*",
192
+ "blackchirp.*",
193
+ "threadpoolctl.*",
194
+ ]
195
+ ignore_missing_imports = true
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,79 @@
1
+ """
2
+ FTMW Pipeline - A Python package for FTMW spectroscopy signal processing and peak fitting.
3
+
4
+ This package provides tools for processing Fourier Transform Microwave (FTMW)
5
+ spectroscopy data, including baseline estimation, peak detection, window assignment,
6
+ and advanced fitting algorithms.
7
+ """
8
+
9
+ __version__ = "0.1.0b1"
10
+ __author__ = "Kyle N. Crabtree"
11
+
12
+ # Functional API - can be imported as "import ftmwpipeline.api as ftmw"
13
+ from ftmwpipeline import api
14
+
15
+ # Core data structures
16
+ from ftmwpipeline.core.data_structures import (
17
+ FID,
18
+ ComplexFT,
19
+ FIDProcessingParameters,
20
+ FittedPeak,
21
+ FittingResult,
22
+ FitWindow,
23
+ FixedContributor,
24
+ FTMWData,
25
+ Peak,
26
+ PeakClassification,
27
+ Sideband,
28
+ SpectralWindow,
29
+ WindowPlan,
30
+ )
31
+
32
+ # Main pipeline interface
33
+ from ftmwpipeline.pipeline import Pipeline
34
+
35
+ __all__ = [
36
+ # Version info
37
+ "__version__",
38
+ "__author__",
39
+ # Core data structures
40
+ "FTMWData",
41
+ "FID",
42
+ "ComplexFT",
43
+ "SpectralWindow",
44
+ "Peak",
45
+ "FittedPeak",
46
+ "FittingResult",
47
+ "FIDProcessingParameters",
48
+ "PeakClassification",
49
+ "Sideband",
50
+ "FixedContributor",
51
+ "FitWindow",
52
+ "WindowPlan",
53
+ # Main pipeline interface
54
+ "Pipeline",
55
+ # Functional API module
56
+ "api",
57
+ ]
58
+
59
+ # Package-level configuration
60
+ import logging
61
+
62
+ # Configure default logging
63
+ logging.getLogger(__name__).addHandler(logging.NullHandler())
64
+
65
+ # Optional imports with graceful fallbacks
66
+ try:
67
+ import matplotlib
68
+
69
+ _HAS_MATPLOTLIB = True
70
+ except ImportError:
71
+ _HAS_MATPLOTLIB = False
72
+
73
+ # Package metadata
74
+ PACKAGE_INFO = {
75
+ "name": "ftmwpipeline",
76
+ "version": __version__,
77
+ "description": "FTMW spectroscopy signal processing and peak fitting",
78
+ "has_matplotlib": _HAS_MATPLOTLIB,
79
+ }
@@ -0,0 +1,10 @@
1
+ """
2
+ Enables running ftmwpipeline as a module with python -m ftmwpipeline
3
+ """
4
+
5
+ import sys
6
+
7
+ from .cli import main
8
+
9
+ if __name__ == "__main__":
10
+ sys.exit(main())
@@ -0,0 +1,19 @@
1
+ """
2
+ Internal shared implementations for ftmwpipeline.
3
+
4
+ This module contains the core implementation functions that are shared between
5
+ the three interfaces: CLI commands, Pipeline class, and functional API.
6
+
7
+ The functions in this module are considered internal and should not be imported
8
+ directly by users. Instead, they should use one of the public interfaces:
9
+
10
+ - CLI: ftmwpipeline command-line interface
11
+ - Pipeline class: from ftmwpipeline import Pipeline
12
+ - Functional API: import ftmwpipeline as ftmw
13
+
14
+ Architecture:
15
+ - stage0_impl.py: Data import and FID visualization implementations
16
+ - stage1_impl.py: FT processing and spectrum visualization implementations
17
+ - stage2_impl.py: Noise estimation and visualization implementations (future)
18
+ - shared_utils.py: Common utilities used across pipeline stages
19
+ """