PyOpenMagnetics 1.7.20__tar.gz → 1.7.21__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.
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/PKG-INFO +1 -1
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/pyproject.toml +1 -1
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/advisers.cpp +9 -3
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/advisers.h +1 -1
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/tests/test_datasheet_only_catalogue.py +32 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/.github/workflows/ci.yml +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/.github/workflows/publish.yml +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/.gitignore +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/AGENTS.md +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/CMakeLists.txt +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/LICENSE +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/PyOpenMagnetics.pyi +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/README.md +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/_packaging/__init__.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/_packaging/_build_info.py.in +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/api/MAS.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/api/mas_db_reader.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/api/validation.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/clear_cibuildwheel_cache.sh +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/docs/compatibility.md +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/docs/errors.md +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/docs/performance.md +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/examples/README.md +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/examples/buck_inductor.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/examples/complete_simulation_example.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/examples/converter_design_example.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/examples/debug_bobbin.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/examples/debug_coil.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/examples/debug_core.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/examples/debug_plotting.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/examples/flyback_220v_12v_1a.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/examples/flyback_220v_12v_2a_complete.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/examples/flyback_bh_curve.png +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/examples/flyback_core.png +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/examples/flyback_design.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/examples/flyback_summary.png +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/examples/flyback_waveforms.png +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/examples/list_plot_funcs.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/examples/plot_flyback_design.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/examples/plot_flyback_pyom.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/examples/test_field_calc.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/examples/test_field_plot.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/force_fresh_build.sh +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/llms.txt +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/notebooks/01_getting_started.ipynb +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/notebooks/02_buck_inductor.ipynb +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/notebooks/03_core_losses.ipynb +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/notebooks/README.md +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/requirements.txt +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/bobbin.cpp +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/bobbin.h +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/cmc.cpp +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/cmc.h +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/common.h +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/converter.cpp +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/converter.h +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/core.cpp +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/core.h +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/crossref.cpp +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/crossref.h +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/database.cpp +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/database.h +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/logging.cpp +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/logging.h +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/losses.cpp +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/losses.h +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/module.cpp +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/plotting.cpp +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/plotting.h +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/settings.cpp +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/settings.h +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/simulation.cpp +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/simulation.h +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/utils.cpp +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/utils.h +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/winding.cpp +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/winding.h +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/wire.cpp +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/src/wire.h +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/test.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/tests/__init__.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/tests/conftest.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/tests/test_converter_endpoints.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/tests/test_core.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/tests/test_core_adviser.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/tests/test_examples_integration.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/tests/test_inputs.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/tests/test_logging.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/tests/test_magnetic_adviser.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/tests/test_magnetics_catalogue_load.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/tests/test_mas_schema_walk.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/tests/test_plotting.py +0 -0
- {pyopenmagnetics-1.7.20 → pyopenmagnetics-1.7.21}/tests/test_winding.py +0 -0
|
@@ -222,7 +222,7 @@ json calculate_advised_magnetics_from_catalog(json inputsJson, json catalogJson,
|
|
|
222
222
|
return results;
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
json calculate_advised_magnetics_from_cache(json inputsJson, json filterFlowJson, int maximumNumberResults, std::optional<std::vector<std::string>> references) {
|
|
225
|
+
json calculate_advised_magnetics_from_cache(json inputsJson, json filterFlowJson, int maximumNumberResults, std::optional<std::vector<std::string>> references, bool simulateResults) {
|
|
226
226
|
OpenMagnetics::settings.set_coil_delimit_and_compact(true);
|
|
227
227
|
OpenMagnetics::Inputs inputs(inputsJson);
|
|
228
228
|
|
|
@@ -236,7 +236,9 @@ json calculate_advised_magnetics_from_cache(json inputsJson, json filterFlowJson
|
|
|
236
236
|
throw std::runtime_error("No magnetics found in cache");
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
-
|
|
239
|
+
// simulateResults=false returns the ranked parts with their scores and no simulated outputs:
|
|
240
|
+
// a caller that re-ranks many results itself need not pay a full simulation for each.
|
|
241
|
+
OpenMagnetics::MagneticAdviser magneticAdviser(simulateResults);
|
|
240
242
|
// `references` restricts the search to those cached parts -- one tool's family, or an
|
|
241
243
|
// admin-chosen pool, out of a cache several callers share. A reference the cache does not
|
|
242
244
|
// hold raises rather than silently searching fewer parts.
|
|
@@ -517,6 +519,10 @@ void register_adviser_bindings(py::module& m) {
|
|
|
517
519
|
PyOpenMagnetics.EngineError naming any reference the cache does not
|
|
518
520
|
hold. The cache may hold datasheet-only parts (no core, no coil):
|
|
519
521
|
they are ranked on the filters that apply to them.
|
|
522
|
+
simulate_results: True (default) returns each modelled part with its simulated
|
|
523
|
+
outputs (losses, temperature). False returns the ranking and the
|
|
524
|
+
per-filter scores only -- much faster over many results -- and a part
|
|
525
|
+
whose simulation would fail is then returned rather than dropped.
|
|
520
526
|
|
|
521
527
|
Returns:
|
|
522
528
|
JSON object with "data" array containing ranked results.
|
|
@@ -530,7 +536,7 @@ void register_adviser_bindings(py::module& m) {
|
|
|
530
536
|
Cache must be populated before calling this function.
|
|
531
537
|
Raises PyOpenMagnetics.EngineError if the cache is empty.
|
|
532
538
|
)pbdoc",
|
|
533
|
-
py::arg("inputs_json"), py::arg("filter_flow_json"), py::arg("max_results"), py::arg("references") = py::none(),
|
|
539
|
+
py::arg("inputs_json"), py::arg("filter_flow_json"), py::arg("max_results"), py::arg("references") = py::none(), py::arg("simulate_results") = true,
|
|
534
540
|
py::call_guard<py::gil_scoped_release>());
|
|
535
541
|
|
|
536
542
|
m.def("calculate_manufacturability_report", &calculate_manufacturability_report,
|
|
@@ -12,7 +12,7 @@ json calculate_advised_magnetics(json inputsJson, int maximumNumberResults, json
|
|
|
12
12
|
json calculate_advised_magnetics_with_filters(json inputsJson, json filterFlowJson, int maximumNumberResults, json coreModeJson);
|
|
13
13
|
json calculate_advised_magnetics_fast(json inputsJson, int maximumNumberResults, json coreModeJson);
|
|
14
14
|
json calculate_advised_magnetics_from_catalog(json inputsJson, json catalogJson, int maximumNumberResults);
|
|
15
|
-
json calculate_advised_magnetics_from_cache(json inputsJson, json filterFlowJson, int maximumNumberResults, std::optional<std::vector<std::string>> references = std::nullopt);
|
|
15
|
+
json calculate_advised_magnetics_from_cache(json inputsJson, json filterFlowJson, int maximumNumberResults, std::optional<std::vector<std::string>> references = std::nullopt, bool simulateResults = true);
|
|
16
16
|
|
|
17
17
|
// Design-for-manufacturing rule pack (ABT #1177, WP8)
|
|
18
18
|
json calculate_manufacturability_report(json masJson);
|
|
@@ -110,3 +110,35 @@ def test_datasheet_inductance_at_a_bias():
|
|
|
110
110
|
part = datasheet_part("P")
|
|
111
111
|
assert PyOpenMagnetics.calculate_datasheet_inductance(part, 1.0, 20) == pytest.approx(9.5e-6)
|
|
112
112
|
assert PyOpenMagnetics.calculate_datasheet_inductance(part, 5.0, 20) is None
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def modelled_part(reference):
|
|
116
|
+
"""A core and a coil on public MAS data, plus the datasheet the catalogue carries."""
|
|
117
|
+
part = datasheet_part(reference)
|
|
118
|
+
part["core"] = {"functionalDescription": {"type": "two-piece set", "material": "N87", "shape": "E 13/7/4", "gapping": [], "numberStacks": 1}}
|
|
119
|
+
part["coil"] = {"bobbin": "Basic", "functionalDescription": [{"name": "primary", "numberTurns": 10, "numberParallels": 1, "isolationSide": "primary", "wire": "Round 0.4 - Grade 1"}]}
|
|
120
|
+
return part
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
@pytest.fixture
|
|
124
|
+
def mixed_catalogue(tmp_path):
|
|
125
|
+
PyOpenMagnetics.clear_magnetic_cache()
|
|
126
|
+
path = tmp_path / "catalogue.ndjson"
|
|
127
|
+
parts = [modelled_part("BUILT"), datasheet_part("SHEET")]
|
|
128
|
+
path.write_text("\n".join(json.dumps(part) for part in parts) + "\n", encoding="utf-8")
|
|
129
|
+
PyOpenMagnetics.load_magnetics_from_file(str(path), True)
|
|
130
|
+
yield
|
|
131
|
+
PyOpenMagnetics.clear_magnetic_cache()
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def test_results_can_come_back_ranked_but_unsimulated(mixed_catalogue):
|
|
135
|
+
"""simulate_results=False: the same ranking and scores, without a simulation per part."""
|
|
136
|
+
flow = [dict(operation, strictlyRequired=False) for operation in FLOW]
|
|
137
|
+
simulated = PyOpenMagnetics.calculate_advised_magnetics_from_cache(buck_inputs(), flow, 10)
|
|
138
|
+
ranked = PyOpenMagnetics.calculate_advised_magnetics_from_cache(buck_inputs(), flow, 10, None, False)
|
|
139
|
+
|
|
140
|
+
assert references_of(ranked) == references_of(simulated)
|
|
141
|
+
assert [item["scoringPerFilter"] for item in ranked["data"]] == [item["scoringPerFilter"] for item in simulated["data"]]
|
|
142
|
+
built = references_of(simulated).index("BUILT")
|
|
143
|
+
assert simulated["data"][built]["mas"].get("outputs"), "the default still simulates a modelled part"
|
|
144
|
+
assert not ranked["data"][built]["mas"].get("outputs")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|