designoptpy-core 0.1.0__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.
- designoptpy_core-0.1.0/.gitignore +23 -0
- designoptpy_core-0.1.0/CHANGELOG.md +453 -0
- designoptpy_core-0.1.0/LICENSE-APACHE +201 -0
- designoptpy_core-0.1.0/LICENSE-MIT +21 -0
- designoptpy_core-0.1.0/NOTICE +3 -0
- designoptpy_core-0.1.0/PKG-INFO +1143 -0
- designoptpy_core-0.1.0/README.md +1116 -0
- designoptpy_core-0.1.0/pyproject.toml +36 -0
- designoptpy_core-0.1.0/src/designoptpy/core/__init__.py +76 -0
- designoptpy_core-0.1.0/src/designoptpy/core/arrays.py +948 -0
- designoptpy_core-0.1.0/src/designoptpy/core/choices.py +156 -0
- designoptpy_core-0.1.0/src/designoptpy/core/configuration.py +492 -0
- designoptpy_core-0.1.0/src/designoptpy/core/evaluation.py +1693 -0
- designoptpy_core-0.1.0/src/designoptpy/core/functions.py +150 -0
- designoptpy_core-0.1.0/src/designoptpy/core/geometry/__init__.py +64 -0
- designoptpy_core-0.1.0/src/designoptpy/core/geometry/box.py +859 -0
- designoptpy_core-0.1.0/src/designoptpy/core/geometry/convex_hull.py +1650 -0
- designoptpy_core-0.1.0/src/designoptpy/core/geometry/ellipsoid.py +367 -0
- designoptpy_core-0.1.0/src/designoptpy/core/grid.py +257 -0
- designoptpy_core-0.1.0/src/designoptpy/core/input_limits.py +122 -0
- designoptpy_core-0.1.0/src/designoptpy/core/integrate.py +531 -0
- designoptpy_core-0.1.0/src/designoptpy/core/io/__init__.py +77 -0
- designoptpy_core-0.1.0/src/designoptpy/core/io/fields.py +251 -0
- designoptpy_core-0.1.0/src/designoptpy/core/io/literals.py +484 -0
- designoptpy_core-0.1.0/src/designoptpy/core/io/outputs.py +256 -0
- designoptpy_core-0.1.0/src/designoptpy/core/io/run_archive.py +1384 -0
- designoptpy_core-0.1.0/src/designoptpy/core/io/run_results.py +439 -0
- designoptpy_core-0.1.0/src/designoptpy/core/io/workbooks.py +2581 -0
- designoptpy_core-0.1.0/src/designoptpy/core/mapping.py +2160 -0
- designoptpy_core-0.1.0/src/designoptpy/core/metrics/__init__.py +24 -0
- designoptpy_core-0.1.0/src/designoptpy/core/metrics/classification.py +519 -0
- designoptpy_core-0.1.0/src/designoptpy/core/numdiff.py +2353 -0
- designoptpy_core-0.1.0/src/designoptpy/core/plotting/__init__.py +254 -0
- designoptpy_core-0.1.0/src/designoptpy/core/plotting/_color_data/viridis-rgb/LICENSE +3 -0
- designoptpy_core-0.1.0/src/designoptpy/core/plotting/_color_data/viridis-rgb/LICENSE-MIT +21 -0
- designoptpy_core-0.1.0/src/designoptpy/core/plotting/_color_data/viridis-rgb/README.md +19 -0
- designoptpy_core-0.1.0/src/designoptpy/core/plotting/_color_data/viridis-rgb/cividis-rgb.csv +258 -0
- designoptpy_core-0.1.0/src/designoptpy/core/plotting/_color_data/viridis-rgb/inferno-rgb.csv +258 -0
- designoptpy_core-0.1.0/src/designoptpy/core/plotting/_color_data/viridis-rgb/magma-rgb.csv +258 -0
- designoptpy_core-0.1.0/src/designoptpy/core/plotting/_color_data/viridis-rgb/mako-rgb.csv +258 -0
- designoptpy_core-0.1.0/src/designoptpy/core/plotting/_color_data/viridis-rgb/plasma-rgb.csv +258 -0
- designoptpy_core-0.1.0/src/designoptpy/core/plotting/_color_data/viridis-rgb/rocket-rgb.csv +258 -0
- designoptpy_core-0.1.0/src/designoptpy/core/plotting/_color_data/viridis-rgb/turbo-rgb.csv +258 -0
- designoptpy_core-0.1.0/src/designoptpy/core/plotting/_color_data/viridis-rgb/viridis-rgb.csv +257 -0
- designoptpy_core-0.1.0/src/designoptpy/core/plotting/colors.py +1205 -0
- designoptpy_core-0.1.0/src/designoptpy/core/plotting/figures.py +1623 -0
- designoptpy_core-0.1.0/src/designoptpy/core/plotting/geometry.py +827 -0
- designoptpy_core-0.1.0/src/designoptpy/core/plotting/level_sets.py +426 -0
- designoptpy_core-0.1.0/src/designoptpy/core/plotting/style.py +453 -0
- designoptpy_core-0.1.0/src/designoptpy/core/py.typed +1 -0
- designoptpy_core-0.1.0/src/designoptpy/core/regions.py +1432 -0
- designoptpy_core-0.1.0/src/designoptpy/core/sampling.py +1492 -0
- designoptpy_core-0.1.0/src/designoptpy/core/signal.py +794 -0
- designoptpy_core-0.1.0/src/designoptpy/core/validation.py +324 -0
- designoptpy_core-0.1.0/tests/archive_interruption_probe.py +67 -0
- designoptpy_core-0.1.0/tests/conftest.py +51 -0
- designoptpy_core-0.1.0/tests/opendocument_fixtures.py +116 -0
- designoptpy_core-0.1.0/tests/test_core_arrays_and_records.py +476 -0
- designoptpy_core-0.1.0/tests/test_core_caller_ownership.py +279 -0
- designoptpy_core-0.1.0/tests/test_core_choice_names.py +208 -0
- designoptpy_core-0.1.0/tests/test_core_configuration.py +1186 -0
- designoptpy_core-0.1.0/tests/test_core_evaluation.py +1353 -0
- designoptpy_core-0.1.0/tests/test_core_geometry.py +1645 -0
- designoptpy_core-0.1.0/tests/test_core_grid.py +273 -0
- designoptpy_core-0.1.0/tests/test_core_integrate.py +546 -0
- designoptpy_core-0.1.0/tests/test_core_invalid_inputs.py +231 -0
- designoptpy_core-0.1.0/tests/test_core_invariances.py +93 -0
- designoptpy_core-0.1.0/tests/test_core_io_outputs.py +305 -0
- designoptpy_core-0.1.0/tests/test_core_io_parsing.py +284 -0
- designoptpy_core-0.1.0/tests/test_core_io_run_archive.py +982 -0
- designoptpy_core-0.1.0/tests/test_core_io_run_results.py +242 -0
- designoptpy_core-0.1.0/tests/test_core_io_staged_rename_retry.py +100 -0
- designoptpy_core-0.1.0/tests/test_core_io_workbooks.py +2164 -0
- designoptpy_core-0.1.0/tests/test_core_level_sets.py +107 -0
- designoptpy_core-0.1.0/tests/test_core_mapping.py +1601 -0
- designoptpy_core-0.1.0/tests/test_core_metrics.py +403 -0
- designoptpy_core-0.1.0/tests/test_core_numdiff.py +1266 -0
- designoptpy_core-0.1.0/tests/test_core_numdiff_evaluation_controls.py +444 -0
- designoptpy_core-0.1.0/tests/test_core_plotting_colors.py +765 -0
- designoptpy_core-0.1.0/tests/test_core_plotting_figures.py +1553 -0
- designoptpy_core-0.1.0/tests/test_core_plotting_geometry.py +426 -0
- designoptpy_core-0.1.0/tests/test_core_plotting_style.py +82 -0
- designoptpy_core-0.1.0/tests/test_core_public_imports.py +196 -0
- designoptpy_core-0.1.0/tests/test_core_regions.py +988 -0
- designoptpy_core-0.1.0/tests/test_core_row_and_dimension_contracts.py +198 -0
- designoptpy_core-0.1.0/tests/test_core_sampling.py +1046 -0
- designoptpy_core-0.1.0/tests/test_core_signal.py +334 -0
- designoptpy_core-0.1.0/tests/test_core_validation.py +82 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Outputs and local state of the DesignOptPy workspace.
|
|
2
|
+
# A leading slash anchors each rule to this folder, so authored source in a subfolder with the
|
|
3
|
+
# same name, such as a package named build, lib, or site, stays visible to Git.
|
|
4
|
+
# The repository-root .gitignore covers caches at every depth, such as __pycache__ and .pytest_cache.
|
|
5
|
+
|
|
6
|
+
# Isolated environments: the uv development environment and the Nox session environments
|
|
7
|
+
/.venv/
|
|
8
|
+
/.nox/
|
|
9
|
+
|
|
10
|
+
# Built wheels and source archives
|
|
11
|
+
/dist/
|
|
12
|
+
/build/
|
|
13
|
+
|
|
14
|
+
# Generated documentation site
|
|
15
|
+
/site/
|
|
16
|
+
|
|
17
|
+
# Run folders of the local test, quality, and package checks
|
|
18
|
+
/.artifacts/
|
|
19
|
+
# Retained output from runs before the folder rename
|
|
20
|
+
/artifacts/
|
|
21
|
+
|
|
22
|
+
# Local credentials and environment settings
|
|
23
|
+
/.env
|
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
First-release summary. No version of `designoptpy-core` has been released yet.
|
|
6
|
+
This distribution is the shared foundation of the DesignOptPy family. Import it through `designoptpy.core`.
|
|
7
|
+
|
|
8
|
+
- **Breaking:** the distribution is `designoptpy-core` and the import namespace is `designoptpy.core`. Before, they were
|
|
9
|
+
`designopt-core` and `designopt.core`. No alias keeps the old names.
|
|
10
|
+
- Choice names follow one rule, the choice-name rule of the new module `designoptpy.core.choices`. A user-supplied
|
|
11
|
+
choice name matches a valid name when both are equal after the ASCII letters `A` to `Z` are lowered and `_` is read as
|
|
12
|
+
`-`; nothing else changes. `parse_choice(value, choices, *, name)` returns the canonical choice (a member for a string
|
|
13
|
+
enumeration), `choice_key(name)` returns the normalized text, and `check_choice_names(names)` rejects a set with two
|
|
14
|
+
names of one key and names both. Every core parser of a named choice uses it: `RequirementSpace.parse`,
|
|
15
|
+
`RungeKuttaMethod.parse`, `convert_index_base` directions, the scoring rule names of `DeficitScoringPolicy` and
|
|
16
|
+
`deficit_to_label_score`, `extract_fields` policies, `HitAndRunOptions` and `LatinHypercubeBackendOptions` choices,
|
|
17
|
+
`region_limit_line_search`, filter time-constant policies, function parameter modes, grid roles, palette, colormap,
|
|
18
|
+
color, interpolation, print, unit, interpreter, and video-profile names, figure formats, `column_layout`, `sso_color`,
|
|
19
|
+
and `ConsoleLogging` level names. Before, some parsers compared exactly, some used Unicode case folding, and some also
|
|
20
|
+
read `_` as `-`. A spelling that one of them accepted is still accepted and gives the same result, with one exception:
|
|
21
|
+
a non-ASCII character that Unicode case folding mapped to an ASCII letter (such as the long s, U+017F, for `s`) no longer
|
|
22
|
+
matches. Records store the canonical name, and an error for an unknown name lists the canonical names. A non-string
|
|
23
|
+
value now raises `TypeError` where some parsers raised `ValueError`. Column and field names, option keys, and file paths
|
|
24
|
+
keep their own rules.
|
|
25
|
+
- The SciPy distance names of `prepare_distance_metric`, `closest_points_with_different_labels`, `boundary_samples`,
|
|
26
|
+
`select_max_distance`, and `sort_min_distance` match under the same rule against the SciPy metric names, their SciPy
|
|
27
|
+
aliases (such as `euclid` and `chebychev`), and their `test_` forms, and reach SciPy in its own spelling. So
|
|
28
|
+
`"test-euclidean"` now selects `"test_euclidean"`. Before, the name was Unicode case folded and passed to SciPy. A name
|
|
29
|
+
that only Unicode case folding matched (the long s, U+017F) is now rejected. An unknown name now fails in
|
|
30
|
+
`prepare_distance_metric` with `ValueError` that lists the valid names; before, SciPy raised `ValueError` at the first
|
|
31
|
+
distance. Result signal: none; a name that was accepted before gives the same distances. Distance functions are
|
|
32
|
+
unchanged.
|
|
33
|
+
- Correction: `prepare_distance_metric` prepares a SciPy alias or `test_` form exactly as its metric name. So `"se"`,
|
|
34
|
+
`"s"`, and `"test_seuclidean"` now get the pooled or supplied variance `V` of `"seuclidean"`, and `"mahal"`, `"mah"`,
|
|
35
|
+
and `"test_mahalanobis"` get the pooled or supplied inverse covariance `VI` of `"mahalanobis"`, with the same checks.
|
|
36
|
+
Before, these six spellings dropped a supplied `V` or `VI` and skipped the checks. SciPy then estimated the statistic
|
|
37
|
+
from the two row blocks of each distance call, so the distances depended on the rows of the call and on
|
|
38
|
+
`maximum_pairwise_distances`, and singular statistics raised SciPy or NumPy errors, or `DistanceMetricError`, instead of
|
|
39
|
+
the `ValueError` that names the metric. `closest_points_with_different_labels`, `boundary_samples`,
|
|
40
|
+
`select_max_distance`, `sort_min_distance`, and their callers in the SSO and surrogate packages inherit the
|
|
41
|
+
correction. The returned name keeps its spelling, because SciPy accepts `V` and `VI` under every spelling of their
|
|
42
|
+
metric. Result signal: results change only for these six spellings, which now give the results of their metric name.
|
|
43
|
+
Metric names and all other aliases give the same results as before.
|
|
44
|
+
- **Breaking:** `convert_color_name_or_hexcode_to_rgb` resolves every color name through Matplotlib, which uses the
|
|
45
|
+
Cascading Style Sheets (CSS) color table. The private table of 40 names is removed. Three names change color visibly:
|
|
46
|
+
`green` becomes `(0, 0.502, 0)` instead of `(0, 1, 0)`, `brown` becomes `(0.647, 0.165, 0.165)` instead of `(0.6, 0.4, 0.2)`,
|
|
47
|
+
and `salmon` becomes `(0.980, 0.502, 0.447)` instead of `(1, 0.55, 0.41)`. 28 other names, such as `orange` and `gray`,
|
|
48
|
+
move by at most 0.005 per channel, because the table rounded the CSS values to two decimals. Use `lime` or `#00FF00` for full green.
|
|
49
|
+
This also changes the X-Ray quantity colors that a workbook gives by name.
|
|
50
|
+
- **Breaking:** `ConsoleLogging.warn` and `ConsoleLogging.error` no longer accept a colon-delimited diagnostic identifier
|
|
51
|
+
before the message, and `ConsoleLoggingError` no longer has the attribute that held that identifier. The first argument is always
|
|
52
|
+
the format string, so a message such as `"time: %s"` is never read as an identifier.
|
|
53
|
+
- **Breaking:** `save_gif_video_3d_azimuth_rotation` takes `gif_options` instead of its former GIF option argument. It accepts
|
|
54
|
+
the keys `loop` (an integer from 0 to 65535; 0 loops forever), `duration` (milliseconds), and `comment`. The aliases `LoopCount` and
|
|
55
|
+
`DelayTime`, the letter-case folding, and the infinite loop count are removed.
|
|
56
|
+
- **Breaking:** `save_gif_video_3d_azimuth_rotation` writes each GIF frame as soon as it is captured. `maximum_frame_count`
|
|
57
|
+
is removed: the frame count has no limit, and memory use does not grow with it. `gif_options` accepts only `loop`,
|
|
58
|
+
`duration`, and `comment`; other Pillow keywords such as `optimize` raise `ValueError`, because a streamed writer cannot apply
|
|
59
|
+
them. `camera_position` together with `initial_azimuth` or `elevation` raises `ValueError`, because the angles had no effect.
|
|
60
|
+
Every requested frame is stored: before, identical consecutive views were merged into one frame with the summed delay.
|
|
61
|
+
A `loop` above 65535 or a resolved delay above 655350 milliseconds (the 16-bit limits of the GIF format) raises `ValueError`
|
|
62
|
+
before any frame is captured; before, Pillow raised `struct.error` while it wrote the file.
|
|
63
|
+
Tradeoff: GIF files are larger, because each frame is stored whole with its own palette instead of as a cropped difference
|
|
64
|
+
to the previous frame.
|
|
65
|
+
- **Breaking:** number tokens of the spreadsheet literal grammar use only ASCII digits and ASCII letter case, as in DesignOptRs.
|
|
66
|
+
A token with other Unicode digits, such as `١٠٠`, is now text. Before, it was the number 100.
|
|
67
|
+
The words `true`, `false`, `inf`, `infinity`, and `nan` also match in ASCII letter case only. Before, `inf` spelled with the
|
|
68
|
+
dotless i (U+0131) raised `ValueError`, and `false` spelled with the long s (U+017F) gave `False`. Both are now text.
|
|
69
|
+
- **Breaking:** `color_palette_tum_lpl` and its institutional TUM/LPL color table are removed from `designoptpy.core.plotting`.
|
|
70
|
+
Use `color_palette_ibm`, `color_palette_okabe_ito`, `color_palette_tol`, or explicit colors. No alias keeps the old name.
|
|
71
|
+
- **Breaking:** `color_palette_ibm` and `color_palette_okabe_ito` raise `ValueError` for a Boolean index, as `color_palette_tol`
|
|
72
|
+
already does. Before, `True` selected the second color and `False` the first.
|
|
73
|
+
- `find_convex_hull_facet_normal_inside` accepts `face_point_preference` (`"center"` or `"vertex"`, the new type alias
|
|
74
|
+
`FacePointPreference`), as `find_facet_reference_point_normal` already did. `"vertex"` takes the first indexed vertex of each
|
|
75
|
+
facet as its reference point. Normals, facet indices, and the measure do not change; offsets and labels can differ at the
|
|
76
|
+
rounding level. The choice is checked before any hull work. The default `"center"` keeps the earlier results.
|
|
77
|
+
- `write_run_results` accepts `file_name` (default `RUN_RESULTS_FILE`): a plain `.json` file name of another results file in
|
|
78
|
+
the run folder, such as `checkpoint-product-1.json`, with the same envelope and atomic replace. A name with `/`, `\`, or `:`,
|
|
79
|
+
another suffix, or an empty stem raises `ValueError` before any file is written. The colon rule keeps a Windows drive prefix
|
|
80
|
+
out: `D:x.json` names a file in the current folder of drive D, outside the run folder. The rule is the same on every system.
|
|
81
|
+
The default keeps `Results.json`.
|
|
82
|
+
- New run results file: `designoptpy.core.io.write_run_results` writes the settings and the numerical results of a run
|
|
83
|
+
into `Results.json` (`RUN_RESULTS_FILE`) in an existing run folder, and `read_run_results` reads it back
|
|
84
|
+
(`RUN_RESULTS_SCHEMA` `"designopt.run-results/1"`, value type `RunResultsValue`). The file is strict JSON with a fixed
|
|
85
|
+
envelope (`schema`, `run_name`, `implementation`, `elapsed_seconds`, `settings`, `results`). `None` becomes
|
|
86
|
+
`{"state": "unavailable"}`, and NaN and the infinities become `{"state": "nonfinite", "value": ...}`, so a missing value is
|
|
87
|
+
never zero and a NaN is never `null`. A value without a JSON form raises `TypeError` with its key path, and the reserved key
|
|
88
|
+
`state` raises `ValueError`; no placeholder is written. The writer replaces the file atomically through
|
|
89
|
+
`staged_output_files`. The reader applies `InputLimits.maximum_file_bytes` and rejects bare `NaN` tokens, numbers outside
|
|
90
|
+
the float64 range such as `1e999` (an infinity is only ever a tag), `null`, unknown tags, another schema, and missing
|
|
91
|
+
envelope keys. Before, a run folder held only the
|
|
92
|
+
console log and the figures, so the numbers of a run were not saved in a machine-readable form.
|
|
93
|
+
- Stability: the module `designoptpy.core.io.run_results` (`write_run_results`, `read_run_results`, `RUN_RESULTS_FILE`,
|
|
94
|
+
`RUN_RESULTS_SCHEMA`, and `RunResultsValue`) and the run-archive workflow `RunArchive`, `save_diary_files`, and
|
|
95
|
+
`archive_files` are Not yet in DesignOptRs. Their DesignOptRs counterpart is incomplete: it is lesson code in
|
|
96
|
+
designopt-examples, not a library component. Their docstrings and the README sections "Run archives" and
|
|
97
|
+
"Run results files" carry the marker, and their contract can change in DesignOptPy alone. The workspace README section
|
|
98
|
+
"Stability labels" defines the labels.
|
|
99
|
+
`archive_files` are Experimental. Their DesignOptRs counterpart is incomplete: it is lesson code in designopt-examples,
|
|
100
|
+
not a library component. Their docstrings and the README sections "Run archives" and "Run results files" carry the
|
|
101
|
+
marker, and their contract can change in DesignOptPy alone. The workspace README section "Stability labels" defines
|
|
102
|
+
the labels.
|
|
103
|
+
- Visible change: the save functions write raster images with 200 dots per inch (`RASTER_DPI`, new in
|
|
104
|
+
`designoptpy.core.plotting.style`). `save_figure` uses it as its `dpi` default (before 150), and `save_print_figure` uses it
|
|
105
|
+
for `resolution=None` (before, the figure DPI, usually 100); `resolution=0` keeps the figure DPI. A full-width figure is
|
|
106
|
+
therefore 1280 pixels wide instead of 640 to 960. Reason: images below about 600 pixels were too coarse to read.
|
|
107
|
+
Vector formats, animation frames, and GIF rotations do not change. Tradeoff: a PNG file is about 2.3 times larger and
|
|
108
|
+
takes about 80 ms more to write.
|
|
109
|
+
- Visible change: `figure_style` draws a golden landscape by default: 6.4 by 3.955 inches (before 6.4 by 4.8), and 3.4 by
|
|
110
|
+
2.101 inches for `column="single"` (before 3.4 by 2.55). New `figure_size(shape, column="full")` returns the
|
|
111
|
+
`"landscape"` (width / height = `GOLDEN_RATIO`, 1.6180339887), `"square"` (at most `SQUARE_SIDE_LIMIT`, 4.8 inches), and
|
|
112
|
+
`"portrait"` (height / width = `GOLDEN_RATIO`, at most `PORTRAIT_HEIGHT_LIMIT`, 8.5 inches high) sizes of both print widths.
|
|
113
|
+
`FigureShape` names the shapes; a shape name follows the choice-name rule. Tradeoff: a golden landscape is about
|
|
114
|
+
18 % lower than the former default, so its data area is shorter.
|
|
115
|
+
- Visible change: `save_figure` and `save_print_figure` save the whole figure canvas. Before, they cut each image to the drawn
|
|
116
|
+
content (a tight bounding box). An image now has the size and the shape of its figure: at 200 dots per inch, a full-width
|
|
117
|
+
golden landscape is 1280 by 791 pixels, a square 960 by 960 pixels, and a portrait 1050 by 1700 pixels. The new keyword
|
|
118
|
+
`crop` (default `False`) restores the cut; EPS output of `save_print_figure` still follows `eps_bounding_box`. A global
|
|
119
|
+
`rcParams["savefig.bbox"]` of `"tight"` does not crop the whole-canvas output; an explicit `savefig_options["bbox_inches"]`
|
|
120
|
+
still applies. Reason: the
|
|
121
|
+
golden and square shapes apply to the saved image. Tradeoff: an artist that reaches past the canvas, such as a legend wider
|
|
122
|
+
than the figure, is now cut at the canvas edge; give it room inside the figure (a layout engine, fewer legend columns) or
|
|
123
|
+
pass `crop=True`.
|
|
124
|
+
- Fix: `save_print_figure(..., eps_bounding_box="loose")` saves the whole figure as EPS. Before, Matplotlib rejected the value
|
|
125
|
+
and the export raised `AttributeError`.
|
|
126
|
+
- New: `save_figure` and `save_print_figure` also write an editable figure file, `<name>.pickle.gz`: the gzip-compressed
|
|
127
|
+
pickle of the Matplotlib figure and the Matplotlib version (format name `"pickle"`, file ending `FIGURE_FILE_SUFFIX`).
|
|
128
|
+
The new keyword `pickle_file` (default `True`) adds it; `False` leaves it out. The file is written with the same staged
|
|
129
|
+
replacement as the images. A figure that cannot be pickled, usually because a tick formatter or a secondary axis holds a
|
|
130
|
+
local function, gives a `UserWarning` that names the file and the cause, and the images are still written.
|
|
131
|
+
`save_figure` now accepts every format that the figure canvas can write. Tradeoff: about 10 ms and, for a typical
|
|
132
|
+
two-dimensional figure, about 25 KB per saved figure.
|
|
133
|
+
- New: `load_figure(path)` opens an editable figure file as a live figure, registers it with pyplot as the current figure,
|
|
134
|
+
and returns it, so `plt.show()` shows it and a three-dimensional view can be rotated. It warns when the stored Matplotlib
|
|
135
|
+
version differs from the installed one. Load only trusted files: loading a pickle can run code. Event callbacks are not
|
|
136
|
+
stored. A failed load, also one whose version warning a warning filter turns into an error, closes the figures that it
|
|
137
|
+
registered and makes the previous current figure current again.
|
|
138
|
+
- New `designoptpy.core.io.rename_staged(staged, destination)` renames a staged file or folder onto its destination. On
|
|
139
|
+
Windows, a rename that fails with the access-denied error (Windows error 5) or the sharing violation (Windows error 32)
|
|
140
|
+
is tried again after waits of 10, 20, 40, 80, 160, 320, 640, and 640 ms (1.91 s in all); then the error of the last attempt
|
|
141
|
+
propagates unchanged. On other systems, and for other errors, it is a single `Path.replace`. Windows refuses the rename
|
|
142
|
+
while another process, such as a virus scanner or the search indexer, briefly holds a staged file open. Before, one such
|
|
143
|
+
refusal made the publication fail. `staged_output_files` (and so `save_figure`, `save_print_figure`, the GIF and video
|
|
144
|
+
export, and `write_run_results`), the resource policy file of `RunArchive`, and the `Files` folder commit and recovery of
|
|
145
|
+
`archive_files` now publish through it. The keywords `rename`, `is_windows`, and `wait` replace the rename, the system
|
|
146
|
+
test, and the wait for controlled failure tests. DesignOptRs `designopt_core::rename_staged` has the same rule.
|
|
147
|
+
Limit: a refusal that lasts longer than the bound still fails, about 2 s later than before.
|
|
148
|
+
- New module `designoptpy.core.plotting.style`: `figure_style()` (Computer Modern via mathtext, Tol item-color cycle,
|
|
149
|
+
constrained layout, a golden landscape of 6.4 x 3.955 in), the color roles `GOOD_COLOR`, `BAD_COLOR`, `ITEM_COLORS`, `NEUTRAL_COLOR`,
|
|
150
|
+
`PHASE_COLOR`, `TOL_BRIGHT`, and the helpers `item_color`, `darker_color`, `is_light_color`.
|
|
151
|
+
The module also holds the line style of each item color (`ITEM_LINESTYLES`) and the color scales: the diverging
|
|
152
|
+
`SIGNED_COLORMAP` for signed values (blue below zero, the grey `SIGNED_ZERO_COLOR` `#949494` at zero, purple above;
|
|
153
|
+
built in CIELAB, so equal magnitudes of opposite sign have equal lightness) and the sequential `MAGNITUDE_COLORMAP`
|
|
154
|
+
(pale to dark blue) for values of one sign. The truss plots use these scales.
|
|
155
|
+
- `figure_style` gains `column` (`"full"`, default, or `"single"`). `"single"` draws a figure for one column of a
|
|
156
|
+
two-column paper at its print size: 3.4 by 2.101 inches, 9-point text, lines at 0.85 of their width, and markers at
|
|
157
|
+
0.7 of their size. Before, the only size was 6.4 by 4.8 inches with 12-point text, which shrinks to about 6.4 points
|
|
158
|
+
when a paper scales the figure to one column. `COLUMN_LAYOUTS`, `ColumnLayout`, and `column_layout` give these sizes
|
|
159
|
+
to functions that create figures; the SSO metric views use them for their `column` option.
|
|
160
|
+
- Visible change: `SSO_COLORS` (and `sso_color`) use the color roles of `designoptpy.core.plotting.style`, from Paul Tol's
|
|
161
|
+
colorblind-safe "bright" palette. `feasible` is `#228833` (`GOOD_COLOR`, before `#168A75`), `infeasible` is `#EE6677`
|
|
162
|
+
(`BAD_COLOR`, before `#D6544D`), `candidate` is `#4477AA` (Tol blue, before `#2E6FBB`), `reference` is `#444444`
|
|
163
|
+
(`NEUTRAL_COLOR`, before `#6E7781`), `warning` is `#CCBB44` (Tol yellow, before `#D99B2B`), and `accent` is `#AA3377`
|
|
164
|
+
(Tol purple, before `#7457A6`). Feasible and infeasible samples now have the good and bad colors of every other figure.
|
|
165
|
+
- Visible change: the geometry plotters in `designoptpy.core.plotting.geometry` take their default color from the color cycle
|
|
166
|
+
of the caller's axes. `plot_ellipse_2d` and `plot_circle_2d` draw a translucent face (opacity 0.25) with an opaque outline
|
|
167
|
+
of one color; before, the face was opaque and always the first cycle color, and it hid the data behind it.
|
|
168
|
+
`plot_convex_hull_3d` draws facets at opacity 0.15 with thin, darker facet edges; before, the facets had opacity 0.25
|
|
169
|
+
and no edges. `plot_convex_hull_2d` takes the next cycle color and closes its corners with round caps and joins.
|
|
170
|
+
`plot_convex_hull_1d` marks the interval bounds with vertical bars instead of circles.
|
|
171
|
+
`plot_line_with_shaded_region` gives each band the color of its own line, behind the line and without an outline; before,
|
|
172
|
+
every band had the first cycle color, so a second line and its band had different colors.
|
|
173
|
+
`plot_ellipsoid_3d` and `plot_sphere_3d` draw a translucent surface (opacity 0.5) without edge lines, with at most
|
|
174
|
+
60 drawn rows and columns sampled evenly from the grid (`SURFACE_MESH_LIMIT`; finer translucent facets form a striped
|
|
175
|
+
texture and dark specks at the poles). Before, the surface was opaque and Matplotlib downsampled the grid to 50 by 50.
|
|
176
|
+
Pass `rcount` and `ccount` to draw more grid lines. The surface is lit from the upper left at 45 degrees
|
|
177
|
+
(`lightsource=matplotlib.colors.LightSource()`), so the top and the bottom of a flat ellipsoid get different shades and
|
|
178
|
+
its thickness shows. Before, the low default light of `plot_surface` (19.5 degrees) shaded them almost the same.
|
|
179
|
+
Pass `lightsource` to change the light, or `shade=False` to draw one flat color.
|
|
180
|
+
- **Breaking:** the rotation angles of `plot_ellipsoid_3d` are named `angle_x`, `angle_y`, and `angle_z` (positions
|
|
181
|
+
unchanged). Before, they were named `alpha`, `beta`, and `gamma`, so a surface option `alpha=` (opacity) was taken as
|
|
182
|
+
the rotation angle about x, also through `plot_sphere_3d`. `alpha=` now sets the surface opacity.
|
|
183
|
+
A light cycle color (Tol cyan or yellow) gets a darker outline or line, so it stays visible on white.
|
|
184
|
+
A line or outline in an item color also gets the line style of that color (`style.ITEM_LINESTYLES`: solid,
|
|
185
|
+
dashed, dash-dotted, dotted for blue, cyan, yellow, purple), so shapes stay apart in grayscale; a `linestyle` option
|
|
186
|
+
replaces it. The 3-D hull facet edges and the surfaces keep solid lines.
|
|
187
|
+
A `facecolor` or `edgecolor` option replaces only that part, and `color` replaces both.
|
|
188
|
+
- Visible change: `style_axes` and `format_figure_text` use the sizes of `figure_style()`. `style_axes` now defaults to
|
|
189
|
+
`font_size=12.0` (before 11.0), sets axis labels and titles to 1.125 times and legend text to 0.92 times that size,
|
|
190
|
+
draws a lighter grid behind the data (opacity 0.3, width 0.6 points), and hides the top and right spines of
|
|
191
|
+
two-dimensional axes, and removes the frame of an existing legend. It raises `ValueError` for a font size that is not positive and finite. `format_figure_text` defaults
|
|
192
|
+
to 12, 12, 13.5, 13.5, and 11.04 points for text, tick labels, axis labels, titles, and legends (before 11, 11, 13, 13,
|
|
193
|
+
and 11). Both functions keep the font family of the existing text. `format_figure_text` gives each text object one size:
|
|
194
|
+
tick labels, axis labels, titles, and legend texts get only their category size. Before, the general text size was
|
|
195
|
+
applied first, so under `use_minimum_font_size=True` a larger general size won over the category size.
|
|
196
|
+
On three-dimensional axes, `style_axes` also sets the z-label size and only switches the 3-D grid on or off.
|
|
197
|
+
- **Breaking:** `format_figure_text` gives each interpreter its own behavior. `interpreter="latex"` typesets all text of the
|
|
198
|
+
figure with an external LaTeX installation (Matplotlib `usetex`); before, it behaved as `"tex"`. The default becomes `"tex"`
|
|
199
|
+
(Matplotlib math text), so default figures look the same. Each interpreter now sets the TeX switch of every existing text
|
|
200
|
+
object, so `"tex"` and `"none"` also switch off TeX typesetting that `text.usetex` or an earlier call switched on.
|
|
201
|
+
- Visible change: `legend_valid` removes the existing legend of the axes when no valid entry remains, and still returns `None`.
|
|
202
|
+
Before, the old legend stayed and could show keys for artists that no longer exist.
|
|
203
|
+
- `set_figure_size` accepts `size=None`, which keeps the current size, and points (`"pt"`, `"points"`; 72 per inch), also
|
|
204
|
+
through `save_print_figure` and its `position`. Before, `size` was required and points raised `ValueError`. The units
|
|
205
|
+
`"normalized"` and `"characters"` still raise, now with a message that names the reason. `set_figure_size` checks the units,
|
|
206
|
+
the size, and the position before it changes anything; before, an invalid `position` raised after the size had changed.
|
|
207
|
+
- `colormap_cmocean` hides the `MatplotlibDeprecationWarning` "Passing 'N' to ListedColormap is deprecated" that cmocean
|
|
208
|
+
emits while it is imported under Matplotlib 3.11. Only that warning of that module is hidden.
|
|
209
|
+
- The spreadsheet literal grammar is now described on its own terms as the DesignOptPy spreadsheet literal grammar.
|
|
210
|
+
- `ConvexPolytope`, `convex_hull`, `compute_convex_hull`, and `find_convex_hull_facet_normal_inside` report a hull measure above the float64 range as `+inf`, as `box_measure` does. Before, the polytope raised `ValueError` although its facets were valid; for example, the six-dimensional simplex with edges `1e60` has representable facets and the volume `1e360 / 720`. A negative or NaN measure still raises.
|
|
211
|
+
- Result-signal change: the inferred hull facet tolerance is `max(10, d + 2)` spacings of the local magnitude instead of 10, for `d`
|
|
212
|
+
dimensions. It bounds the rounding error `gamma_(d+1)` of the facet projection, so a query exactly on a facet plane stays inside
|
|
213
|
+
in every dimension. Labels with `d <= 8` do not change; for `d >= 9`, a query within the wider tolerance of a facet is now inside.
|
|
214
|
+
- `box_volumes` returns the plain sequential products when every partial product of every nonzero row is a finite normal number. These equal the binary split results bit for bit; other batches keep the binary split path. No value changes.
|
|
215
|
+
- `numdiff.gradient` and `numdiff.hessian` gain three keyword controls: `max_evaluations` (default None), a hard row limit
|
|
216
|
+
checked before the first call, which raises the new `DerivativeBudgetExceededError` (a `ValueError` with `requested_rows`
|
|
217
|
+
and `max_evaluations`); `evaluation_batch_size` (default None), the largest number of rows in one call; and `base_value`
|
|
218
|
+
(default None), a known function value at a single design sample, one row per output group. Before, each call sent all rows
|
|
219
|
+
in one call without a limit and always evaluated the base row. A known base value replaces the base row only when the stencil
|
|
220
|
+
lists it: the forward gradient `(0, 1)` of a three-coordinate function then evaluates three rows instead of four, and the
|
|
221
|
+
default Hessian eighteen instead of nineteen, with the same derivatives. The defaults keep the current rows and calls.
|
|
222
|
+
Limit: the function cannot verify that a known value belongs to the same function and sample.
|
|
223
|
+
- `DerivativeResult` gains `evaluations`, the rows sent to the function, and `batch_metadata`, one metadata snapshot per call when
|
|
224
|
+
the trace is retained. Before, the count was lost with `retain_evaluation_trace=False`, and callback metadata had no channel.
|
|
225
|
+
A function or adapter can now return `FunctionEvaluation(values, metadata)`. `FunctionEvaluation` moved to
|
|
226
|
+
`designoptpy.core.numdiff` from `designoptpy.point.coefficients`, because core cannot import point; coefficient recovery
|
|
227
|
+
accepts the same record.
|
|
228
|
+
- New function `compute_affine_rank(points)` in `designoptpy.core.geometry`. It returns the number of independent directions
|
|
229
|
+
that a point set spans, an integer in `[0, d]`, or `None` when an offset or a singular value exceeds the float64 range.
|
|
230
|
+
The rank counts the singular values of the offsets from the first row above `s_max * (max(n_points, d) * eps)`; one
|
|
231
|
+
coordinate uses `max - min`. Before, no public function returned the rank; `convex_hull` tested it inline.
|
|
232
|
+
- Result-signal change: `convex_hull` (and with it `compute_convex_hull` and `find_convex_hull_facet_normal_inside`)
|
|
233
|
+
applies `compute_affine_rank` to the unique rows. Point offsets above the float64 range now raise
|
|
234
|
+
`ValueError("point offsets exceed the float64 range; rescale the coordinates")`. Before, they raised the misleading rank
|
|
235
|
+
error "points must span their ambient dimension" (for example for `[[-1e308, 0], [1e308, 0], [0, 1]]` and
|
|
236
|
+
`[[-1e308], [1e308]]`), after the NumPy `RuntimeWarning` "overflow encountered in subtract"; that warning no longer
|
|
237
|
+
appears. The rank error now also states the rank. Both errors are `ValueError`. The rank decision changes only for a
|
|
238
|
+
singular value within one rounding of the tolerance, because the tolerance multiplies `s_max * (max(n, d) * eps)`
|
|
239
|
+
instead of `(s_max * max(n, d)) * eps`. Reason: one rank rule for the public function and the hull.
|
|
240
|
+
- Result-signal change: above three coordinates, `convex_hull` removes the zero-volume facets of the Qhull triangulation:
|
|
241
|
+
simplices of a flat face whose unit edges from the first vertex have a rank below `d - 1`. The facet rows of
|
|
242
|
+
`convex_hull`, `compute_convex_hull`, and `find_convex_hull_facet_normal_inside` change (48 instead of 58 for the
|
|
243
|
+
corners of `[0, 1]^4`), and `find_convex_hull_facet_normal_inside` succeeds on hulls with flat faces where it raised
|
|
244
|
+
"facet 1 is degenerate" before. The measure stays the Qhull measure. `ConvexPolytope.classify` labels and
|
|
245
|
+
largest-deficit scores change at most at the rounding level, because each removed row repeats the plane of a kept
|
|
246
|
+
facet. A plane guard raises `HullConsistencyError` if a removed equation row equals no kept row. Variant scores of
|
|
247
|
+
`ConvexPolytope.facet_deficits` change, because a face no longer counts once per redundant simplex. One to three
|
|
248
|
+
coordinates: no change. Reason: each facet must define a unique normal. `find_facet_reference_point_normal` uses the
|
|
249
|
+
same edge and rank test, so these checks pass for every returned facet.
|
|
250
|
+
- `is_in_convex_hull_with_facet_normal` gains two keyword options. `coordinate_range` (default `None`) supplies one finite
|
|
251
|
+
nonnegative range per coordinate for the inferred tolerance, in place of the range of the facet reference points; a
|
|
252
|
+
caller that knows the hull points passes their range, so the allowance does not depend on the chosen reference points.
|
|
253
|
+
It raises `ValueError` together with an explicit `tolerance`, so no input is ignored. `membership_batch_size` (default
|
|
254
|
+
`None`) bounds the query rows of one deficit batch; the variant policy scores each batch separately, so a custom scorer
|
|
255
|
+
receives at most that many rows per call. Without the variant score, a batch also holds at most `2**21 // n_facets`
|
|
256
|
+
rows (at least one), about 16 MiB per float64 matrix. Labels and scores do not depend on the batch size, because each
|
|
257
|
+
deficit uses the fixed-order projection of its own row and facet. Before, the range always came from the facet
|
|
258
|
+
references, and one deficit matrix held every query row. An error now names the query row of the whole call also
|
|
259
|
+
when it occurs in a later batch.
|
|
260
|
+
- Result-signal change: `is_in_convex_hull_with_facet_normal` raises `ValueError` for inputs that define no half-space.
|
|
261
|
+
Before, a normal row of zeros passed every query at that facet (for example `facet_points=[[0, 0]]`,
|
|
262
|
+
`inward_normals=[[0, 0]]`, and the query `[[1, 1]]` gave the label true and the score `-5e-323`), and zero facets raised
|
|
263
|
+
a NumPy `ValueError` with the unrelated message "zero-size array to reduction operation maximum which has no
|
|
264
|
+
identity". A deficit that is not finite now also raises; only `-inf` can occur, from a large offset and tolerance, and
|
|
265
|
+
before, such a row was labeled inside with the score `-inf`. Reason: a zero normal defines no half-space, and an
|
|
266
|
+
overflowing deficit is an arithmetic failure, not a label.
|
|
267
|
+
- Distance functions (custom metrics) in the region selectors. `closest_points_with_different_labels`,
|
|
268
|
+
`select_max_distance`, `sort_min_distance`, and `prepare_distance_metric` accept a callable `metric(first, second)`
|
|
269
|
+
that returns the `(n_first, n_second)` distances of two read-only row blocks; `boundary_samples` accepts such callables
|
|
270
|
+
in `metrics`. The new protocol `designoptpy.core.regions.DistanceFunction` states the contract: each entry depends only
|
|
271
|
+
on its own two rows, because the block size is not part of the contract. Before, `metric` had to be a SciPy distance
|
|
272
|
+
name, and a callable raised `ValueError`. A result of another shape raises `ValueError`, and NaN, infinity, or a negative
|
|
273
|
+
entry raises `DistanceMetricError`. With a distance function, `distance_options` may hold only `V` and `VI`, which it
|
|
274
|
+
ignores; another key raises `ValueError`. Named metrics and their results do not change. A distance function also covers
|
|
275
|
+
metrics without a SciPy name, such as a rank correlation distance. Hit-and-run thinning keeps metric names.
|
|
276
|
+
- New function `convert_index_base(is_in_subset, index_query, direction)` and enumeration `IndexBaseDirection` in
|
|
277
|
+
`designoptpy.core.arrays`. They translate zero-based positions between a full list and the subset that a Boolean mask
|
|
278
|
+
selects: `"subset-to-full"` through the list of true positions, `"full-to-subset"` through the running count of true
|
|
279
|
+
entries. A full position outside the subset returns NaN. A query holds positions (shape, order, and repetitions stay) or
|
|
280
|
+
a Boolean mask over the source list, one query per column; shorter Boolean columns end with NaN padding. A second output
|
|
281
|
+
marks the converted positions in a Boolean destination mask. Directions are exact names without letter-case folding.
|
|
282
|
+
- Result-signal change: `classification_evaluation_metrics` computes the Matthews correlation coefficient (MCC) as a difference
|
|
283
|
+
of two products of four square-root ratios, such as `sqrt(tp) / sqrt(tp + fp)`. Before, it divided each count by the total
|
|
284
|
+
before the roots. A tiny count beside a huge count then underflowed to zero: `fp = fn = 0`, `tp = 1e-308`, and
|
|
285
|
+
`tn = 4.49e307` gave NaN. It now gives 1. Each factor lies in `[0, 1]`, so weighted counts still cannot overflow.
|
|
286
|
+
Other MCC values change by at most a few units in the last place; for example, `fp, fn, tp, tn = 2, 1, 3, 4` gives
|
|
287
|
+
`0.40824829046386296` instead of `0.4082482904638629`. The MCC is still NaN when a marginal sum is zero. `classification_metrics`
|
|
288
|
+
keeps the plain formula, because its integer label counts cannot underflow.
|
|
289
|
+
- `region_limit_line_search` clips each ray point to the box before it calls the region criterion. Before, rounding could place a face
|
|
290
|
+
point outside the box, and `point_hit_and_run_sample` then raised `ValueError` for every region that reaches a box face.
|
|
291
|
+
Result-signal change: such calls now return samples; other callers of `region_limit_line_search` (SSO and surrogate sampling) can see
|
|
292
|
+
criterion inputs that differ from before by rounding only.
|
|
293
|
+
- `WorkbookModelData` has five read-only row diagnostics: `invalid_design_rows`, `invalid_measure_rows`, `complete_rows`,
|
|
294
|
+
`invalid_design_rows_by_column`, and `invalid_measure_rows_by_column`. Each holds ascending zero-based data-row indices
|
|
295
|
+
(`int64`) that skip the header row. A row is invalid when a value is NaN or infinite, and complete when every design and
|
|
296
|
+
measure value is finite. Before, a reader had to search the matrices for NaN to find the rows that complete-case fitting
|
|
297
|
+
drops and the cells that caused it. The properties compute the lists from the matrices, which do not change.
|
|
298
|
+
- OpenDocument spreadsheets (`.ods`): new `preflight_opendocument_worksheets`, `load_opendocument_workbook`,
|
|
299
|
+
`OpenDocumentWorkbook`, `OpenDocumentWorksheet`, and `OpenDocumentCell` in `designoptpy.core.io`, and
|
|
300
|
+
`read_workbook_model_data` reads an `.ods` path (the suffix in any letter case). The preflight reads the file once, checks
|
|
301
|
+
the ZIP members, the exact `mimetype`, the manifest (an encrypted package fails), and streams `content.xml` with
|
|
302
|
+
`defusedxml`: it counts every repeated row and cell position, applies the row, column, and cell limits per sheet and to
|
|
303
|
+
the sum of all sheet rectangles, bounds the cell and total text, and rejects a value beyond row 1,048,576 or column
|
|
304
|
+
16,384, which the parser would drop without an error. Only then does python-calamine parse the same bytes. Error results
|
|
305
|
+
read as error cells (type `"e"`), dates as date cells, and cell styles give background fills. Before, every workbook
|
|
306
|
+
reader accepted Office Open XML only. Limit: formulas are not recalculated; `.ots`, `.fods`, `.xls`, and `.xlsb` are not read.
|
|
307
|
+
- The `io` and `all` extras install python-calamine 0.9.1 or later (below 1), the reader of OpenDocument spreadsheets. It
|
|
308
|
+
bundles calamine 0.37.0, the parser of DesignOptRs, so both implementations parse a file with the same code.
|
|
309
|
+
- `WorksheetXMLInfo` has the field `error_coordinates` (default empty): the cells that hold an error result, from the XLSX
|
|
310
|
+
cell type `e` or the OpenDocument `calcext:value-type="error"`. The XLSX preflight fills it too.
|
|
311
|
+
- `read_workbook_model_data` names a wrong sheet count with `workbooks must contain one or two sheets` (before: `Excel
|
|
312
|
+
workbooks ...`), because the reader also reads `.ods` files.
|
|
313
|
+
|
|
314
|
+
- Requirements and deficits: `measure_to_deficit` converts raw measures into normalized, weighted deficits.
|
|
315
|
+
A nonpositive deficit satisfies a requirement. `deficit_to_label_score` returns labels and ranking scores.
|
|
316
|
+
`score_good` names `geometric-mean` or `worst-case`, and `score_bad` names `euclidean-norm` or `worst-case`, compared exactly.
|
|
317
|
+
`max` and letter-case variants are removed. None still selects the default rule.
|
|
318
|
+
- One result contract for every package: `DesignEvaluator`, `DesignEvaluation`, `MappingResult`,
|
|
319
|
+
`coerce_evaluation`, and `coerce_mapping_result`.
|
|
320
|
+
- Mapping adapters: `CallableMapping`, `FixedVariableMapping`, `ContinuousVariableMapping` for functional variables,
|
|
321
|
+
and `SurrogateMapping` with optional trusted ranges.
|
|
322
|
+
- Auxiliary mapping records are `CallableMappingMetadata` and `SurrogateMappingMetadata`.
|
|
323
|
+
Their fields identify system-function metadata, physical feasibility-function metadata,
|
|
324
|
+
performance-prediction metadata, and physical feasibility-prediction metadata.
|
|
325
|
+
`DesignSpaceGridData.function_metadata` retains auxiliary grid-function metadata.
|
|
326
|
+
- Geometry (`designoptpy.core.geometry`): boxes, ellipsoids, and convex hulls with stated membership tolerances.
|
|
327
|
+
Region search (`designoptpy.core.regions`): distance selection, boundary samples, nearest-neighbor paths, and ray line searches.
|
|
328
|
+
- Numerics: finite-difference gradients and Hessians (`numdiff`), fixed-step Runge-Kutta integration (`integrate`),
|
|
329
|
+
low-pass filters and Spencer smoothing (`signal`), and binary classification metrics (`metrics`).
|
|
330
|
+
- Sampling (`designoptpy.core.sampling`): random, full-factorial, Latin-hypercube, and hit-and-run samplers.
|
|
331
|
+
Each sampler takes an explicit `rng` and optional proposal or step budgets. `copy_generator` copies a generator with its seed sequence.
|
|
332
|
+
- Records and files: immutable result records, staged file output that restores prior files after a handled failure,
|
|
333
|
+
`RunArchive` result folders, workbook readers, a spreadsheet literal parser, and `InputLimits` for untrusted files.
|
|
334
|
+
`RunArchive.results_folder` selects a direct results parent without inserting a `RESULTS` directory.
|
|
335
|
+
- Plotting (`designoptpy.core.plotting`): figure export, color palettes, and marching-tetrahedra level sets.
|
|
336
|
+
The functions format only the supplied figure or axes.
|
|
337
|
+
A failed print export restores changed, readable, settable figure properties, including layout state.
|
|
338
|
+
Tol palette tables keep each qualitative name beside its hexadecimal color value.
|
|
339
|
+
- Optional extras: `io` (OpenPyXL, python-calamine, and defusedxml for Excel and OpenDocument workbooks), `colors`
|
|
340
|
+
(cmocean palettes), and `all`.
|
|
341
|
+
- Requirements: Python 3.12 to 3.14, NumPy, SciPy 1.12 or later, Matplotlib 3.11 or later, and Pillow.
|
|
342
|
+
- Limits: the supported numeric domain is ordinary engineering magnitudes in double precision.
|
|
343
|
+
Runge-Kutta integration uses the supplied time intervals without adaptive error control.
|
|
344
|
+
`derivative_with_low_pass_filter` names its initial interpolation degree `startup_polynomial_degree`.
|
|
345
|
+
|
|
346
|
+
The [README](README.md) states each contract, its theory, and its limits.
|
|
347
|
+
|
|
348
|
+
### Performance work from the audit of 2026-11-11
|
|
349
|
+
|
|
350
|
+
These entries come from the performance audit of 2026-11-11 and its update of 2026-11-13.
|
|
351
|
+
|
|
352
|
+
- `evaluate_samples` has a new keyword `executor` (a `concurrent.futures.Executor`, default `None`).
|
|
353
|
+
Before, per-row evaluation (`vectorized=False`) always called the function once per row on the calling thread.
|
|
354
|
+
With an executor, `executor.map` runs the per-row calls and returns the results in row order. `None` keeps the serial loop.
|
|
355
|
+
The rows are independent, so a model that waits for an external program or releases the global interpreter lock gains from a pool.
|
|
356
|
+
For 100 rows of a model that waits 2 ms, the evaluation took 299 ms serially and 74 ms with four threads.
|
|
357
|
+
Tradeoff: the values equal the serial values only for a deterministic function without state between calls that is safe to call
|
|
358
|
+
concurrently. A process pool needs a picklable function. After a failing row, later rows can already have run.
|
|
359
|
+
- `integrate_runge_kutta` has a new keyword `reuse_first_stage_outputs` (default `True`).
|
|
360
|
+
Before, the auxiliary outputs always came from a separate pass that called the ODE function once more at every stored time.
|
|
361
|
+
Now the output at each stored time except the last comes from the first stage call of the interval that starts there.
|
|
362
|
+
That call already uses the values of the stored state, input row, and time, because every supported tableau has `c[0] = 0`
|
|
363
|
+
and a zero first row of `A`.
|
|
364
|
+
The reuse assumes a deterministic function that treats `-0.0` and `+0.0` alike and does not depend on the type of the time.
|
|
365
|
+
For such a function, the outputs are bit-identical.
|
|
366
|
+
Result-signal change: with `n` times and `s` stages, the callback count falls from `(n - 1) * s + n` to `(n - 1) * s + 1`.
|
|
367
|
+
For 1001 times, forward Euler makes 1001 calls instead of 2001, and the fourth-order method makes 4001 instead of 5001.
|
|
368
|
+
The time saved is the time of the calls left out, so a costly model function gains most.
|
|
369
|
+
For other functions, the outputs can differ. A function that is not deterministic can return other values on another call.
|
|
370
|
+
The first stage passes `y + 0.0` and `t + 0.0 * h`, so a stored `-0.0` in the state or the time arrives as `+0.0`.
|
|
371
|
+
The time also arrives as a NumPy float instead of a Python float.
|
|
372
|
+
A deterministic function that distinguishes signed zero (for example with `numpy.signbit`) or checks the time type
|
|
373
|
+
can therefore return other auxiliary outputs.
|
|
374
|
+
The call order also changes, and a nonreal output raises during the integration, before a later divergence error.
|
|
375
|
+
Set `reuse_first_stage_outputs=False` for a function that can change between calls, distinguishes signed zero,
|
|
376
|
+
or depends on the time type. It restores the separate pass.
|
|
377
|
+
- `FixedVariableMapping` is frozen. Before, a caller could reassign `mapping`, `n_dimension`, `fixed_indices`, or `fixed_values`
|
|
378
|
+
after construction without a new check, and a later write into the caller's index or value array changed the mapping.
|
|
379
|
+
Now a reassignment raises `dataclasses.FrozenInstanceError`, and the mapping stores read-only copies of the index and value vectors.
|
|
380
|
+
Pickle and `copy` restore the mapping through its constructor, so a restored mapping also has read-only vectors and matching free indices.
|
|
381
|
+
The free indices depend only on these fields, so the mapping computes them once at construction instead of twice per batch.
|
|
382
|
+
`free_indices` still returns a new array. For a one-row batch, `expand` takes 8 us instead of 67 us.
|
|
383
|
+
Results do not change. Create a new mapping to change the fixed variables.
|
|
384
|
+
|
|
385
|
+
- `designoptpy.core.plotting` resolves its public names on first access. Before, importing the package or any of its
|
|
386
|
+
submodules, such as `designoptpy.core.plotting.colors`, imported the Matplotlib figure, axes, animation, and
|
|
387
|
+
three-dimensional axes modules, and `colors` imported SciPy interpolation. Now each name loads only its defining submodule,
|
|
388
|
+
and `colors` loads Matplotlib for a color name and SciPy for a resampled color map. The headless X-Ray engine
|
|
389
|
+
(`import designoptpy.sso.xray`) imports no Matplotlib, and its import falls from about 1.7 s to 1.1 s on the development
|
|
390
|
+
machine (`python -X importtime`). Tradeoff: an import error of Matplotlib or SciPy now appears at the first use of a name
|
|
391
|
+
that needs it, not at import. Names and results do not change.
|
|
392
|
+
- `designoptpy.core`, `designoptpy.core.geometry`, and `designoptpy.core.regions` import SciPy inside the functions that use it:
|
|
393
|
+
`convex_hull` imports Qhull, `is_in_convex_hull_linear_programming` imports `linprog`, the distance functions import
|
|
394
|
+
`cdist`, and the default interpolator of `designoptpy.core.mapping` imports `PchipInterpolator`. Before, `import designoptpy.core`
|
|
395
|
+
and `from designoptpy.core.geometry import Box` loaded `scipy.interpolate`, `scipy.optimize`, and `scipy.spatial`.
|
|
396
|
+
Now they load no SciPy module, and the import falls from about 0.87 s to 0.20 s on the development machine
|
|
397
|
+
(`python -X importtime`). Tradeoff: an import error of SciPy now appears at the first call of a function that needs it.
|
|
398
|
+
Results do not change.
|
|
399
|
+
- New option `hull_vertices_only` (default `False`) of `is_in_convex_hull_linear_programming` and
|
|
400
|
+
`ConvexPolytope.classify_linear_programming`. With it, each feasibility program uses only the vertices of the convex hull
|
|
401
|
+
of the generators instead of every generator. The vertices describe the same convex set with fewer columns: 200 queries
|
|
402
|
+
against 2000 generators in five dimensions take about 0.57 s instead of 2.0 s on the development machine. Tradeoff: the
|
|
403
|
+
solver works on another program, so a query within the feasibility tolerance of the boundary can change its label, and an
|
|
404
|
+
inconclusive status (NaN score) can appear or disappear. The free function then needs generators that span their ambient
|
|
405
|
+
dimension, and it raises the `ValueError` of `convex_hull` otherwise. The default keeps every generator and its results.
|
|
406
|
+
|
|
407
|
+
- `region_limit_line_search` option `initial_state` (default `None`). With `None`, the search evaluates the criterion at
|
|
408
|
+
the initial points, as before. With one Boolean per ray, it uses these states and makes no criterion call for the
|
|
409
|
+
initial points. Reason: the two-ray surrogate samplers search the same starts twice and can predict each start once.
|
|
410
|
+
The states must be the criterion values at these points; a wrong state gives a wrong bracket. The hit-and-run chain
|
|
411
|
+
keeps its origin call.
|
|
412
|
+
- `region_limit_line_search` option `batch_first_search` (default `False`). With `True`, the search evaluates the complete
|
|
413
|
+
probe ladder of its first search in one criterion call and takes the first state change of each ray. The ladder uses
|
|
414
|
+
the recurrence of the sequential search, so the probe steps and the brackets are the same, and bisection is unchanged.
|
|
415
|
+
Reason: a default search then makes at most 22 instead of 42 criterion calls, which helps a cheap criterion with few
|
|
416
|
+
rows; 200 searches of 2 rays with a disk criterion made 4,400 instead of 8,239 calls (335 ms instead of 431 ms).
|
|
417
|
+
Tradeoff: the ladder also evaluates the probes after an early state change, so it evaluates more rows (16,800 instead
|
|
418
|
+
of 16,409 in that case), and it needs a row-independent criterion. If a point of the full ladder is not finite, the
|
|
419
|
+
search falls back to the sequential first search, which evaluates only the probes that it needs.
|
|
420
|
+
|
|
421
|
+
- Add `deficit_labels`, the label-only counterpart of `deficit_to_label_score`. A row is satisfied when every deficit
|
|
422
|
+
is at or below zero; NaN raises `ValueError`. It takes no weights or scorers and computes no score.
|
|
423
|
+
- `DeficitScoringPolicy.score` no longer checks its scorers and weights again on each call, because the frozen policy
|
|
424
|
+
checked them at construction. `deficit_to_label_score` still checks them on every call. Both compute the
|
|
425
|
+
violations only for the violating rows. Labels, scores, and errors are unchanged. Measured: one-row
|
|
426
|
+
`DeficitScoringPolicy.score` 88 us -> 70 us; 2,000 rows x 6 requirements 601 us -> 510 us.
|
|
427
|
+
- Add `adaptive_batch_size: bool = False` to `random_sample`. Before, every batch held `n_sample` candidates, also when
|
|
428
|
+
few rows were missing, and the region criterion evaluated every candidate. With the option, the first batch keeps that
|
|
429
|
+
size, and each later batch holds the candidates expected to fill the remaining need at the acceptance fraction observed
|
|
430
|
+
so far, at most `n_sample`. It is the rule of the `adaptive_batch_size` option of the SSO rejection samplers.
|
|
431
|
+
The returned rows stay the same for a criterion that labels each row on its own, because both paths return the first
|
|
432
|
+
`n_sample` accepted rows of one sequence of draws. In an example with 500 rows at 95 percent acceptance, the criterion
|
|
433
|
+
evaluated 528 instead of 1,000 rows. Tradeoff: a passed Generator ends in another state, so its later draws change,
|
|
434
|
+
and more batches can be needed (2 to 5 batches at 60 percent acceptance), so `max_iterations` can stop a request that
|
|
435
|
+
the default fills. `latin_hypercube_sample` keeps full batches, because each batch is its own Latin hypercube.
|
|
436
|
+
The default keeps the present batches.
|
|
437
|
+
- `designoptpy.core.sampling` imports `scipy.spatial.distance.pdist` at the first maximin score of a Latin hypercube design.
|
|
438
|
+
Before, the module-level import loaded `scipy.spatial` with every import of `designoptpy.sso`, which reaches this module.
|
|
439
|
+
Tradeoff: an import error of SciPy now appears at the first maximin score. Results do not change.
|
|
440
|
+
- Add `performance_measure_index` and `feasibility_measure_index` to `SurrogateMapping`: zero-based prediction columns to keep,
|
|
441
|
+
in the given order, with repeats allowed. The mapping validates the whole prediction first and then selects; a design outside
|
|
442
|
+
the trusted range gets `+inf` in every selected column. An index at or above the prediction width raises `ValueError` at the
|
|
443
|
+
response, and an empty, real, Boolean, or negative index raises at construction. An unsigned entry above the `int64` range
|
|
444
|
+
also raises at construction, because the `int64` conversion would wrap it to a negative column. `None` (default) keeps every
|
|
445
|
+
column, as before.
|
|
446
|
+
- **Breaking:** a trusted range or a measure index of `SurrogateMapping` without the model of its group raises `ValueError` at
|
|
447
|
+
construction (`"performance_trusted_range requires a performance model"`, then the feasibility range, then the two indices).
|
|
448
|
+
Before, a range without its model was accepted and had no effect on the default row. Reason: an unused input is a defect.
|
|
449
|
+
- Add `free_interpolation_nodes` to `ContinuousVariableMapping.from_design_spaces`: one strictly increasing, finite node
|
|
450
|
+
vector per functional variable, inside its location bounds, in place of the uniform grid. Fixed points, bounds, initial values,
|
|
451
|
+
and component indices then expand over the remaining free nodes, as for the grid. Before, explicit nodes needed a
|
|
452
|
+
`ContinuousVariableMapping(parameter_points=...)` and a manual expansion of the design data. A node count other than one
|
|
453
|
+
together with explicit nodes raises `ValueError`.
|