arrayprobe 0.1.0__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 (189) hide show
  1. arrayprobe/__init__.py +219 -0
  2. arrayprobe/__main__.py +19 -0
  3. arrayprobe/_v314_lazy.py +48 -0
  4. arrayprobe/ai_ready.py +212 -0
  5. arrayprobe/attributed_export.py +1333 -0
  6. arrayprobe/authordefaults.py +267 -0
  7. arrayprobe/cli.py +3510 -0
  8. arrayprobe/combine.py +12 -0
  9. arrayprobe/compare.py +950 -0
  10. arrayprobe/config.py +1239 -0
  11. arrayprobe/constants.py +12 -0
  12. arrayprobe/count_closure.py +204 -0
  13. arrayprobe/diagnostic_views.py +769 -0
  14. arrayprobe/diode_report.py +265 -0
  15. arrayprobe/driver/__init__.py +5 -0
  16. arrayprobe/driver/_load_record.py +331 -0
  17. arrayprobe/driver/preflight_inputs.py +250 -0
  18. arrayprobe/driver/reprocess.py +553 -0
  19. arrayprobe/driver/run_flight.py +8166 -0
  20. arrayprobe/driver/tas_from_probe_housekeeping.py +124 -0
  21. arrayprobe/dropsize.py +519 -0
  22. arrayprobe/friendly.py +206 -0
  23. arrayprobe/geometry/__init__.py +77 -0
  24. arrayprobe/geometry/min_rectangle.py +92 -0
  25. arrayprobe/intarr.py +12 -0
  26. arrayprobe/intarr_analysis.py +16 -0
  27. arrayprobe/intarr_plots.py +12 -0
  28. arrayprobe/inventory.py +129 -0
  29. arrayprobe/jit_kernels.py +344 -0
  30. arrayprobe/lwc.py +44 -0
  31. arrayprobe/masks.py +349 -0
  32. arrayprobe/matio.py +410 -0
  33. arrayprobe/matlab_compat.py +13 -0
  34. arrayprobe/ncio.py +26 -0
  35. arrayprobe/particle.py +55 -0
  36. arrayprobe/particle_perimeter.py +12 -0
  37. arrayprobe/products.py +78 -0
  38. arrayprobe/profiles.py +179 -0
  39. arrayprobe/provenance.py +21 -0
  40. arrayprobe/py.typed +11 -0
  41. arrayprobe/readers/__init__.py +9 -0
  42. arrayprobe/readers/dmt.py +603 -0
  43. arrayprobe/readers/mask_csv.py +12 -0
  44. arrayprobe/readers/pms.py +12 -0
  45. arrayprobe/readers/sea.py +433 -0
  46. arrayprobe/readers/tasinfo.py +12 -0
  47. arrayprobe/regimes.py +507 -0
  48. arrayprobe/render.py +728 -0
  49. arrayprobe/reproduce_report.py +149 -0
  50. arrayprobe/review_agreement.py +135 -0
  51. arrayprobe/review_sampling.py +327 -0
  52. arrayprobe/run_page.py +624 -0
  53. arrayprobe/sample_area.py +12 -0
  54. arrayprobe/selector.py +206 -0
  55. arrayprobe/sizing.py +151 -0
  56. arrayprobe/time_convert.py +12 -0
  57. arrayprobe/timing_closure.py +141 -0
  58. arrayprobe/tools/__init__.py +27 -0
  59. arrayprobe/tools/make_demo_flight.py +1089 -0
  60. arrayprobe/tools/make_tas_file.py +760 -0
  61. arrayprobe/tools/probe_comparison.py +569 -0
  62. arrayprobe/tools/synthetic_truth.py +698 -0
  63. arrayprobe/tools/tas_sources.py +705 -0
  64. arrayprobe/triage_context.py +488 -0
  65. arrayprobe/triage_server.py +5215 -0
  66. arrayprobe/tune/__init__.py +15 -0
  67. arrayprobe/tune/diodes.py +400 -0
  68. arrayprobe/tune/distributions.py +300 -0
  69. arrayprobe/tune/sample.py +243 -0
  70. arrayprobe/tune/score.py +230 -0
  71. arrayprobe/tune/settings.py +354 -0
  72. arrayprobe/validate_by_condition.py +208 -0
  73. arrayprobe/validation_report.py +166 -0
  74. arrayprobe-0.1.0.dist-info/METADATA +260 -0
  75. arrayprobe-0.1.0.dist-info/RECORD +189 -0
  76. arrayprobe-0.1.0.dist-info/WHEEL +5 -0
  77. arrayprobe-0.1.0.dist-info/entry_points.txt +2 -0
  78. arrayprobe-0.1.0.dist-info/licenses/LICENSE +31 -0
  79. arrayprobe-0.1.0.dist-info/licenses/LICENSES/BSD-3-Clause.txt +47 -0
  80. arrayprobe-0.1.0.dist-info/licenses/NOTICE.md +369 -0
  81. arrayprobe-0.1.0.dist-info/top_level.txt +4 -0
  82. arrayprobe_soda2/__init__.py +131 -0
  83. arrayprobe_soda2/angles.py +143 -0
  84. arrayprobe_soda2/aspect_ratio.py +541 -0
  85. arrayprobe_soda2/backfill.py +100 -0
  86. arrayprobe_soda2/binary_dof.py +181 -0
  87. arrayprobe_soda2/buildindex.py +113 -0
  88. arrayprobe_soda2/decompress_dmt.py +285 -0
  89. arrayprobe_soda2/enhancement_hooks.py +275 -0
  90. arrayprobe_soda2/export_ascii.py +732 -0
  91. arrayprobe_soda2/export_ncdf.py +683 -0
  92. arrayprobe_soda2/export_ncdf_raf.py +396 -0
  93. arrayprobe_soda2/fillholes.py +161 -0
  94. arrayprobe_soda2/find_radius.py +105 -0
  95. arrayprobe_soda2/findsize.py +407 -0
  96. arrayprobe_soda2/fit_poisson.py +170 -0
  97. arrayprobe_soda2/fix2dimage.py +63 -0
  98. arrayprobe_soda2/fixraking.py +162 -0
  99. arrayprobe_soda2/fixstuckbits.py +146 -0
  100. arrayprobe_soda2/hvps4_read_frame.py +121 -0
  101. arrayprobe_soda2/jit_kernels.py +152 -0
  102. arrayprobe_soda2/label_blobs.py +177 -0
  103. arrayprobe_soda2/min_circle_fast.py +320 -0
  104. arrayprobe_soda2/particlesort.py +703 -0
  105. arrayprobe_soda2/pbp_writer.py +558 -0
  106. arrayprobe_soda2/poisson_spot_correct.py +183 -0
  107. arrayprobe_soda2/princomp.py +107 -0
  108. arrayprobe_soda2/probespecs.py +361 -0
  109. arrayprobe_soda2/process_2d.py +1364 -0
  110. arrayprobe_soda2/process_2d_parallel.py +626 -0
  111. arrayprobe_soda2/process_hk.py +512 -0
  112. arrayprobe_soda2/processbuffer_2dc.py +155 -0
  113. arrayprobe_soda2/processbuffer_cip.py +213 -0
  114. arrayprobe_soda2/processbuffer_f2dc.py +139 -0
  115. arrayprobe_soda2/processbuffer_spec.py +441 -0
  116. arrayprobe_soda2/processbuffer_tail.py +350 -0
  117. arrayprobe_soda2/pth_readers.py +245 -0
  118. arrayprobe_soda2/py.typed +11 -0
  119. arrayprobe_soda2/read2dbuffer.py +371 -0
  120. arrayprobe_soda2/reject.py +246 -0
  121. arrayprobe_soda2/reprocess_pbp.py +156 -0
  122. arrayprobe_soda2/sample_area.py +264 -0
  123. arrayprobe_soda2/save_writer.py +480 -0
  124. arrayprobe_soda2/sea.py +324 -0
  125. arrayprobe_soda2/spec_absolutepointers.py +109 -0
  126. arrayprobe_soda2/spec_decompress.py +203 -0
  127. arrayprobe_soda2/spec_index.py +476 -0
  128. arrayprobe_soda2/spec_read_frame.py +286 -0
  129. arrayprobe_soda2/spec_read_hk.py +301 -0
  130. arrayprobe_soda2/spec_readint.py +127 -0
  131. arrayprobe_soda2/timeconv.py +77 -0
  132. arrayprobe_soda2/update_op.py +101 -0
  133. arrayprobe_uiops/__init__.py +45 -0
  134. arrayprobe_uiops/combine.py +192 -0
  135. arrayprobe_uiops/combine_fork.py +359 -0
  136. arrayprobe_uiops/constants.py +830 -0
  137. arrayprobe_uiops/decode_naming.py +113 -0
  138. arrayprobe_uiops/diode_mask.py +250 -0
  139. arrayprobe_uiops/engine_absence.py +41 -0
  140. arrayprobe_uiops/export_oap.py +325 -0
  141. arrayprobe_uiops/geometry_core.py +366 -0
  142. arrayprobe_uiops/habit.py +749 -0
  143. arrayprobe_uiops/habit_core.py +248 -0
  144. arrayprobe_uiops/hollow_size_rule.py +376 -0
  145. arrayprobe_uiops/imgproc.py +2081 -0
  146. arrayprobe_uiops/imgproc_core.py +275 -0
  147. arrayprobe_uiops/intarr.py +167 -0
  148. arrayprobe_uiops/intarr_analysis.py +569 -0
  149. arrayprobe_uiops/intarr_plots.py +119 -0
  150. arrayprobe_uiops/jit_kernels.py +430 -0
  151. arrayprobe_uiops/lwc.py +70 -0
  152. arrayprobe_uiops/matlab_compat.py +860 -0
  153. arrayprobe_uiops/measure.py +346 -0
  154. arrayprobe_uiops/min_circle.py +204 -0
  155. arrayprobe_uiops/min_ellipse.py +161 -0
  156. arrayprobe_uiops/min_rectangle.py +200 -0
  157. arrayprobe_uiops/ncar_2dc_timing.py +100 -0
  158. arrayprobe_uiops/ncio.py +810 -0
  159. arrayprobe_uiops/oap_read.py +228 -0
  160. arrayprobe_uiops/particle.py +51 -0
  161. arrayprobe_uiops/particle_perimeter.py +94 -0
  162. arrayprobe_uiops/particle_physics.py +199 -0
  163. arrayprobe_uiops/pecan_params.py +134 -0
  164. arrayprobe_uiops/probe_cases.py +298 -0
  165. arrayprobe_uiops/product_sanity.py +337 -0
  166. arrayprobe_uiops/profile.py +71 -0
  167. arrayprobe_uiops/profiles.py +756 -0
  168. arrayprobe_uiops/provenance.py +804 -0
  169. arrayprobe_uiops/py.typed +11 -0
  170. arrayprobe_uiops/qc.py +169 -0
  171. arrayprobe_uiops/readers/__init__.py +8 -0
  172. arrayprobe_uiops/readers/mask_csv.py +74 -0
  173. arrayprobe_uiops/readers/pms.py +239 -0
  174. arrayprobe_uiops/readers/tasinfo.py +57 -0
  175. arrayprobe_uiops/rect_ellipse.py +129 -0
  176. arrayprobe_uiops/register_image_assisted.py +25 -0
  177. arrayprobe_uiops/reject.py +501 -0
  178. arrayprobe_uiops/reject_core.py +220 -0
  179. arrayprobe_uiops/sample_area.py +93 -0
  180. arrayprobe_uiops/sizedist.py +1923 -0
  181. arrayprobe_uiops/sizedist_core.py +814 -0
  182. arrayprobe_uiops/sizedist_tables.py +642 -0
  183. arrayprobe_uiops/spec.py +1094 -0
  184. arrayprobe_uiops/spec_core.py +703 -0
  185. arrayprobe_uiops/stray_pixel.py +103 -0
  186. arrayprobe_uiops/tas.py +191 -0
  187. arrayprobe_uiops/time_convert.py +41 -0
  188. uiops/__init__.py +402 -0
  189. uiops/py.typed +11 -0
arrayprobe/profiles.py ADDED
@@ -0,0 +1,179 @@
1
+ # SPDX-License-Identifier: BSD-3-Clause
2
+ """Which MATLAB variant a run is reproducing.
3
+
4
+ UIOOPS is not one program. Stock v3.1.4 is a snapshot of a codebase that groups
5
+ fork, edit and re-fork, and the ORACLES reference output this port is validated
6
+ against was produced by one such fork -- the tree in
7
+ a local reference-data directory (set with ``ARRAYPROBE_REFERENCE_DATA``), dated
8
+ November 2016. Where the two disagree, "faithful" is ambiguous until you say
9
+ *faithful to which*. A :class:`FidelityProfile` is that answer, passed
10
+ explicitly so no call site ever guesses.
11
+
12
+ It exists from S2 onward because S2 is where the
13
+ first *provable* divergence turned up: the ORACLES variant predates Joe Finlon's
14
+ 2017-03-08 image-buffer guards, so the two decoders behave differently on a
15
+ truncated packet (see :attr:`FidelityProfile.spec_buffer_guard`).
16
+
17
+ Two rules keep this from rotting into a settings bag:
18
+
19
+ 1. **Every field names a specific divergence with file:line provenance on both
20
+ sides.** Not a preference, not a tuning knob -- a place where two MATLAB
21
+ sources demonstrably differ.
22
+ 2. **No field gets a "sensible" default that silently picks a side.** The
23
+ profile is a required argument wherever it matters.
24
+
25
+ Profiles compose with, but do not replace, :mod:`arrayprobe.constants`: the
26
+ config *tables* stay keyed on ``(project, probe)`` as MATLAB keys them, while the
27
+ profile selects which *source variant* is being reproduced.
28
+ """
29
+
30
+ from __future__ import annotations
31
+
32
+ # Shared leaf (split slice 10a(i)): the type and the registry live in
33
+ # arrayprobe_uiops.profiles; these names are the SAME objects.
34
+ # Split slice 10a(ii): the v3.5 builders, their caches and the three
35
+ # register_*_v35 functions live in arrayprobe_uiops.profiles, which also
36
+ # registers the two lazy builders in _LAZY; these names are the SAME objects.
37
+ from arrayprobe_uiops.profiles import ( # noqa: F401 -- shared leaf # noqa: F401 -- re-exported
38
+ _BEHAVIOUR_FIELDS,
39
+ _LAZY,
40
+ _ORACLES_PROD_V35_NAME,
41
+ _REGISTRY,
42
+ _SHIPPED,
43
+ _STOCK_V35_NAME,
44
+ _V35_TREE_PROFILES,
45
+ PROFILES,
46
+ FidelityProfile,
47
+ _build_oracles_production_v35,
48
+ _build_stock_v35,
49
+ _ProfileRegistry,
50
+ is_v35_flavoured,
51
+ profile,
52
+ register_profile,
53
+ register_stock_v35_image_assisted,
54
+ )
55
+ from arrayprobe_uiops.reject_core import DEFAULT_REJECT_CONFIG, ORACLES_PRODUCTION_REJECT_CONFIG
56
+
57
+ # NOTE: no ``from arrayprobe_uiops.measure import STOCK_V35_REJECT_CONFIG`` here.
58
+ # That import used to run unconditionally at module load, which is why
59
+ # ``import arrayprobe`` pulled in the whole v3.5 engine -- and, through
60
+ # ``arrayprobe.reject``, numba -- before any caller asked for anything
61
+ # (2026-09-15: measured at 2.24 s of a 2.75 s wall import).
62
+ # It is deferred to :func:`_build_stock_v35` below, run once on first actual
63
+ # need for :data:`STOCK_V35`, so the selector's "neither engine is imported
64
+ # at module level" property (``tests/test_uiops_selector.py``) also holds for
65
+ # the packages themselves, not just for ``uiops``.
66
+
67
+ __all__ = [
68
+ "FidelityProfile",
69
+ "STOCK_V314",
70
+ "ORACLES_2016",
71
+ "ORACLES_PRODUCTION",
72
+ "STOCK_V35", # noqa: F822 -- module __getattr__ below serves this lazily; see _build_stock_v35
73
+ # noqa: F822 -- lazy too; see _build_oracles_production_v35
74
+ "ORACLES_PRODUCTION_V35", # noqa: F822
75
+ "PROFILES",
76
+ "SHIPPED",
77
+ "profile",
78
+ "register_profile",
79
+ "is_v35_flavoured",
80
+ "register_stock_v35_image_assisted",
81
+ ]
82
+
83
+
84
+
85
+
86
+ STOCK_V314 = FidelityProfile(
87
+ name="stock-v3.1.4",
88
+ description="joefinlon/UIOPS v3.1.4 as shipped (UIOPS-v3.1.4/joefinlon-UIOPS-ba5e67c/).",
89
+ spec_buffer_guard=True,
90
+ hvps_reader="spec",
91
+ diode_stats_counts_shadowed=True,
92
+ zero_image_particle_recovery=True,
93
+ time_in_seconds_from_tas=True,
94
+ inter_arrival_in_seconds=True,
95
+ shadow_diode_reillumination=False,
96
+ imgproc_output_typing="typed",
97
+ nan_tas_substitution=True,
98
+ reject_thresholds=DEFAULT_REJECT_CONFIG,
99
+ )
100
+
101
+ ORACLES_2016 = FidelityProfile(
102
+ name="oracles-2016",
103
+ description=(
104
+ "The behaviour a field campaign's modified UIOOPS used, November 2016 vintage. "
105
+ "Predates the 2017-03-08 buffer guards; ships its own read_binary_hvps."
106
+ ),
107
+ spec_buffer_guard=False,
108
+ hvps_reader="hvps",
109
+ diode_stats_counts_shadowed=False,
110
+ zero_image_particle_recovery=False,
111
+ time_in_seconds_from_tas=False,
112
+ inter_arrival_in_seconds=False,
113
+ shadow_diode_reillumination=False,
114
+ imgproc_output_typing="all-double",
115
+ nan_tas_substitution=False,
116
+ reject_thresholds=DEFAULT_REJECT_CONFIG,
117
+ )
118
+
119
+ ORACLES_PRODUCTION = FidelityProfile(
120
+ name="oracles-production",
121
+ description=(
122
+ "The thresholds a field campaign's modified UIOOPS used, with its "
123
+ "nine-argument imgProc_sm. Differs from oracles-2016 in two places: the "
124
+ "stuck-diode re-illumination block (c(:,shadow_diode)='1'); and the reject "
125
+ "thresholds -- the modified calculate_reject_unified.m:73-77 sets "
126
+ "rej_hollow=0, max_edge_img_ar=4, max_comp_img_ar=4, measured to be what "
127
+ "the archived products were made with (see reject.py). Its imgProc_sm "
128
+ "differs from the stock file by that one block, one progress disp and two "
129
+ "comment typo fixes."
130
+ ),
131
+ spec_buffer_guard=False,
132
+ hvps_reader="hvps",
133
+ diode_stats_counts_shadowed=False,
134
+ zero_image_particle_recovery=False,
135
+ time_in_seconds_from_tas=False,
136
+ inter_arrival_in_seconds=False,
137
+ shadow_diode_reillumination=True,
138
+ imgproc_output_typing="all-double",
139
+ nan_tas_substitution=False,
140
+ reject_thresholds=ORACLES_PRODUCTION_REJECT_CONFIG,
141
+ )
142
+
143
+
144
+
145
+ for _p in (STOCK_V314, ORACLES_2016, ORACLES_PRODUCTION):
146
+ _REGISTRY.setdefault(_p.name, _p)
147
+
148
+ SHIPPED: frozenset[str] = frozenset(
149
+ {p.name for p in (STOCK_V314, ORACLES_2016, ORACLES_PRODUCTION)}
150
+ | {_STOCK_V35_NAME, _ORACLES_PROD_V35_NAME})
151
+ """The four names this package ships, fixed at import and never added to.
152
+
153
+ Kept separately from :data:`PROFILES` so that "is this one of ours?" survives a
154
+ registration. Complete from the start (``stock-v3.5`` included) even though the
155
+ object behind that name is built lazily.
156
+ """
157
+ _SHIPPED.update(SHIPPED)
158
+
159
+
160
+ def __getattr__(name: str) -> FidelityProfile:
161
+ """Module-level lazy attribute: ``profiles.STOCK_V35`` triggers the build.
162
+
163
+ Only reached when normal attribute lookup misses -- i.e. before
164
+ :func:`_build_stock_v35` has ever run, since it is only then that this
165
+ module's namespace has no ``STOCK_V35`` of its own. ``from arrayprobe.
166
+ profiles import STOCK_V35`` goes through this too, the same as any other
167
+ attribute access.
168
+ """
169
+ if name in ("STOCK_V35", "ORACLES_PRODUCTION_V35"):
170
+ import arrayprobe_uiops.profiles as _v35_profiles
171
+
172
+ return getattr(_v35_profiles, name)
173
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
174
+
175
+
176
+ def __dir__() -> list[str]:
177
+ """``dir(profiles)`` lists the lazy :data:`STOCK_V35` too (PEP 562), so code that
178
+ enumerates the module's profiles still finds it; listing it builds nothing."""
179
+ return sorted(set(globals()) | {"STOCK_V35", "ORACLES_PRODUCTION_V35"})
@@ -0,0 +1,21 @@
1
+ # SPDX-License-Identifier: BSD-3-Clause
2
+ """Alias of :mod:`arrayprobe_uiops.provenance`, the one ``.call`` sidecar parser.
3
+
4
+ The module moved to the v3.5 engine on 2026-09-30 (the rule that code both engines share lives
5
+ there, so deleting this package breaks nothing else). This file keeps ``from arrayprobe import
6
+ provenance`` working for the v3.1.4 callers and computes nothing.
7
+
8
+ The star import gives static readers (mypy, ruff) the public names; the ``sys.modules`` line
9
+ then makes ``arrayprobe.provenance`` the *same module object*, so a patch, ``__file__`` and the
10
+ private helpers all resolve to the real module rather than to a copy of its namespace.
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ import sys
16
+
17
+ from arrayprobe_uiops import provenance as _impl
18
+ from arrayprobe_uiops.provenance import * # noqa: F401,F403
19
+ from arrayprobe_uiops.provenance import __all__ # noqa: F401
20
+
21
+ sys.modules[__name__] = _impl
arrayprobe/py.typed ADDED
@@ -0,0 +1,11 @@
1
+ # PEP 561 marker.
2
+ #
3
+ # This package is fully annotated and `mypy src` is clean, but without this
4
+ # file a type checker in a DOWNSTREAM project ignores every annotation --
5
+ # PEP 561 says an installed package's types are invisible unless it says so.
6
+ # Nothing in this repository would ever have noticed: `mypy src` runs against
7
+ # the source tree, where the marker is irrelevant.
8
+ #
9
+ # Added 2026-09-12 in a release-readiness pass. `tests/test_py_typed.py`
10
+ # asserts one exists per shipped package and that setuptools is told to
11
+ # include it, because a marker that is not packaged is the same as no marker.
@@ -0,0 +1,9 @@
1
+ # SPDX-License-Identifier: BSD-3-Clause
2
+ """Raw-probe-file decoders: ``read_binary_*.m``.
3
+
4
+ Each module here turns a manufacturer's raw buffer format into the uncompressed
5
+ image netCDF (``8 x 1700 x time`` of packed 16-bit words) that ``imgProc_sm``
6
+ consumes. The formats share nothing but that output contract.
7
+ """
8
+
9
+ from __future__ import annotations