PyOpenMagnetics 1.1.3__cp310-cp310-macosx_15_0_arm64.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.
- PyOpenMagnetics.cpython-310-darwin.so +0 -0
- include/pybind11_json/pybind11_json.hpp +249 -0
- pyopenmagnetics-1.1.3.dist-info/METADATA +373 -0
- pyopenmagnetics-1.1.3.dist-info/RECORD +15 -0
- pyopenmagnetics-1.1.3.dist-info/WHEEL +5 -0
- pyopenmagnetics-1.1.3.dist-info/licenses/LICENSE +21 -0
- pyopenmagnetics.dylibs/libjpeg.8.3.2.dylib +0 -0
- pyopenmagnetics.dylibs/liblzma.5.dylib +0 -0
- pyopenmagnetics.dylibs/libpng16.16.dylib +0 -0
- pyopenmagnetics.dylibs/libtiff.6.dylib +0 -0
- pyopenmagnetics.dylibs/libzstd.1.5.7.dylib +0 -0
- share/cmake/pybind11_json/pybind11_jsonConfig.cmake +52 -0
- share/cmake/pybind11_json/pybind11_jsonConfigVersion.cmake +32 -0
- share/cmake/pybind11_json/pybind11_jsonTargets.cmake +106 -0
- share/pkgconfig/pybind11_json.pc +7 -0
|
Binary file
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/***************************************************************************
|
|
2
|
+
* Copyright (c) 2019, Martin Renou *
|
|
3
|
+
* *
|
|
4
|
+
* Distributed under the terms of the BSD 3-Clause License. *
|
|
5
|
+
* *
|
|
6
|
+
* The full license is in the file LICENSE, distributed with this software. *
|
|
7
|
+
****************************************************************************/
|
|
8
|
+
|
|
9
|
+
#ifndef PYBIND11_JSON_HPP
|
|
10
|
+
#define PYBIND11_JSON_HPP
|
|
11
|
+
|
|
12
|
+
#include <set>
|
|
13
|
+
#include <string>
|
|
14
|
+
#include <vector>
|
|
15
|
+
|
|
16
|
+
#include "nlohmann/json.hpp"
|
|
17
|
+
|
|
18
|
+
#include "pybind11/pybind11.h"
|
|
19
|
+
|
|
20
|
+
namespace py = pybind11;
|
|
21
|
+
namespace nl = nlohmann;
|
|
22
|
+
|
|
23
|
+
namespace pyjson
|
|
24
|
+
{
|
|
25
|
+
inline py::object from_json(const nl::json& j)
|
|
26
|
+
{
|
|
27
|
+
if (j.is_null())
|
|
28
|
+
{
|
|
29
|
+
return py::none();
|
|
30
|
+
}
|
|
31
|
+
else if (j.is_boolean())
|
|
32
|
+
{
|
|
33
|
+
return py::bool_(j.get<bool>());
|
|
34
|
+
}
|
|
35
|
+
else if (j.is_number_unsigned())
|
|
36
|
+
{
|
|
37
|
+
return py::int_(j.get<nl::json::number_unsigned_t>());
|
|
38
|
+
}
|
|
39
|
+
else if (j.is_number_integer())
|
|
40
|
+
{
|
|
41
|
+
return py::int_(j.get<nl::json::number_integer_t>());
|
|
42
|
+
}
|
|
43
|
+
else if (j.is_number_float())
|
|
44
|
+
{
|
|
45
|
+
return py::float_(j.get<double>());
|
|
46
|
+
}
|
|
47
|
+
else if (j.is_string())
|
|
48
|
+
{
|
|
49
|
+
return py::str(j.get<std::string>());
|
|
50
|
+
}
|
|
51
|
+
else if (j.is_array())
|
|
52
|
+
{
|
|
53
|
+
py::list obj(j.size());
|
|
54
|
+
for (std::size_t i = 0; i < j.size(); i++)
|
|
55
|
+
{
|
|
56
|
+
obj[i] = from_json(j[i]);
|
|
57
|
+
}
|
|
58
|
+
return obj;
|
|
59
|
+
}
|
|
60
|
+
else // Object
|
|
61
|
+
{
|
|
62
|
+
py::dict obj;
|
|
63
|
+
for (nl::json::const_iterator it = j.cbegin(); it != j.cend(); ++it)
|
|
64
|
+
{
|
|
65
|
+
obj[py::str(it.key())] = from_json(it.value());
|
|
66
|
+
}
|
|
67
|
+
return obj;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
inline nl::json to_json(const py::handle& obj, std::set<const PyObject*>& refs)
|
|
72
|
+
{
|
|
73
|
+
if (obj.ptr() == nullptr || obj.is_none())
|
|
74
|
+
{
|
|
75
|
+
return nullptr;
|
|
76
|
+
}
|
|
77
|
+
if (py::isinstance<py::bool_>(obj))
|
|
78
|
+
{
|
|
79
|
+
return obj.cast<bool>();
|
|
80
|
+
}
|
|
81
|
+
if (py::isinstance<py::int_>(obj))
|
|
82
|
+
{
|
|
83
|
+
try
|
|
84
|
+
{
|
|
85
|
+
nl::json::number_integer_t s = obj.cast<nl::json::number_integer_t>();
|
|
86
|
+
if (py::int_(s).equal(obj))
|
|
87
|
+
{
|
|
88
|
+
return s;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch (...)
|
|
92
|
+
{
|
|
93
|
+
}
|
|
94
|
+
try
|
|
95
|
+
{
|
|
96
|
+
nl::json::number_unsigned_t u = obj.cast<nl::json::number_unsigned_t>();
|
|
97
|
+
if (py::int_(u).equal(obj))
|
|
98
|
+
{
|
|
99
|
+
return u;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch (...)
|
|
103
|
+
{
|
|
104
|
+
}
|
|
105
|
+
throw std::runtime_error("to_json received an integer out of range for both nl::json::number_integer_t and nl::json::number_unsigned_t type: " + py::repr(obj).cast<std::string>());
|
|
106
|
+
}
|
|
107
|
+
if (py::isinstance<py::float_>(obj))
|
|
108
|
+
{
|
|
109
|
+
return obj.cast<double>();
|
|
110
|
+
}
|
|
111
|
+
if (py::isinstance<py::bytes>(obj))
|
|
112
|
+
{
|
|
113
|
+
py::module base64 = py::module::import("base64");
|
|
114
|
+
return base64.attr("b64encode")(obj).attr("decode")("utf-8").cast<std::string>();
|
|
115
|
+
}
|
|
116
|
+
if (py::isinstance<py::str>(obj))
|
|
117
|
+
{
|
|
118
|
+
return obj.cast<std::string>();
|
|
119
|
+
}
|
|
120
|
+
if (py::isinstance<py::tuple>(obj) || py::isinstance<py::list>(obj))
|
|
121
|
+
{
|
|
122
|
+
auto insert_ret = refs.insert(obj.ptr());
|
|
123
|
+
if (!insert_ret.second) {
|
|
124
|
+
throw std::runtime_error("Circular reference detected");
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
auto out = nl::json::array();
|
|
128
|
+
for (const py::handle value : obj)
|
|
129
|
+
{
|
|
130
|
+
out.push_back(to_json(value, refs));
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
refs.erase(insert_ret.first);
|
|
134
|
+
|
|
135
|
+
return out;
|
|
136
|
+
}
|
|
137
|
+
if (py::isinstance<py::dict>(obj))
|
|
138
|
+
{
|
|
139
|
+
auto insert_ret = refs.insert(obj.ptr());
|
|
140
|
+
if (!insert_ret.second) {
|
|
141
|
+
throw std::runtime_error("Circular reference detected");
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
auto out = nl::json::object();
|
|
145
|
+
for (const py::handle key : obj)
|
|
146
|
+
{
|
|
147
|
+
out[py::str(key).cast<std::string>()] = to_json(obj[key], refs);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
refs.erase(insert_ret.first);
|
|
151
|
+
|
|
152
|
+
return out;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
throw std::runtime_error("to_json not implemented for this type of object: " + py::repr(obj).cast<std::string>());
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
inline nl::json to_json(const py::handle& obj)
|
|
159
|
+
{
|
|
160
|
+
std::set<const PyObject*> refs;
|
|
161
|
+
return to_json(obj, refs);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// nlohmann_json serializers
|
|
167
|
+
namespace nlohmann
|
|
168
|
+
{
|
|
169
|
+
#define MAKE_NLJSON_SERIALIZER_DESERIALIZER(T) \
|
|
170
|
+
template <> \
|
|
171
|
+
struct adl_serializer<T> \
|
|
172
|
+
{ \
|
|
173
|
+
inline static void to_json(json& j, const T& obj) \
|
|
174
|
+
{ \
|
|
175
|
+
j = pyjson::to_json(obj); \
|
|
176
|
+
} \
|
|
177
|
+
\
|
|
178
|
+
inline static T from_json(const json& j) \
|
|
179
|
+
{ \
|
|
180
|
+
return pyjson::from_json(j); \
|
|
181
|
+
} \
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
#define MAKE_NLJSON_SERIALIZER_ONLY(T) \
|
|
185
|
+
template <> \
|
|
186
|
+
struct adl_serializer<T> \
|
|
187
|
+
{ \
|
|
188
|
+
inline static void to_json(json& j, const T& obj) \
|
|
189
|
+
{ \
|
|
190
|
+
j = pyjson::to_json(obj); \
|
|
191
|
+
} \
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
MAKE_NLJSON_SERIALIZER_DESERIALIZER(py::object);
|
|
195
|
+
|
|
196
|
+
MAKE_NLJSON_SERIALIZER_DESERIALIZER(py::bool_);
|
|
197
|
+
MAKE_NLJSON_SERIALIZER_DESERIALIZER(py::int_);
|
|
198
|
+
MAKE_NLJSON_SERIALIZER_DESERIALIZER(py::float_);
|
|
199
|
+
MAKE_NLJSON_SERIALIZER_DESERIALIZER(py::str);
|
|
200
|
+
|
|
201
|
+
MAKE_NLJSON_SERIALIZER_DESERIALIZER(py::list);
|
|
202
|
+
MAKE_NLJSON_SERIALIZER_DESERIALIZER(py::tuple);
|
|
203
|
+
MAKE_NLJSON_SERIALIZER_DESERIALIZER(py::dict);
|
|
204
|
+
|
|
205
|
+
MAKE_NLJSON_SERIALIZER_ONLY(py::handle);
|
|
206
|
+
MAKE_NLJSON_SERIALIZER_ONLY(py::detail::item_accessor);
|
|
207
|
+
MAKE_NLJSON_SERIALIZER_ONLY(py::detail::list_accessor);
|
|
208
|
+
MAKE_NLJSON_SERIALIZER_ONLY(py::detail::tuple_accessor);
|
|
209
|
+
MAKE_NLJSON_SERIALIZER_ONLY(py::detail::sequence_accessor);
|
|
210
|
+
MAKE_NLJSON_SERIALIZER_ONLY(py::detail::str_attr_accessor);
|
|
211
|
+
MAKE_NLJSON_SERIALIZER_ONLY(py::detail::obj_attr_accessor);
|
|
212
|
+
|
|
213
|
+
#undef MAKE_NLJSON_SERIALIZER
|
|
214
|
+
#undef MAKE_NLJSON_SERIALIZER_ONLY
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// pybind11 caster
|
|
218
|
+
namespace pybind11
|
|
219
|
+
{
|
|
220
|
+
namespace detail
|
|
221
|
+
{
|
|
222
|
+
template <> struct type_caster<nl::json>
|
|
223
|
+
{
|
|
224
|
+
public:
|
|
225
|
+
PYBIND11_TYPE_CASTER(nl::json, _("json"));
|
|
226
|
+
|
|
227
|
+
bool load(handle src, bool)
|
|
228
|
+
{
|
|
229
|
+
try
|
|
230
|
+
{
|
|
231
|
+
value = pyjson::to_json(src);
|
|
232
|
+
return true;
|
|
233
|
+
}
|
|
234
|
+
catch (...)
|
|
235
|
+
{
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
static handle cast(nl::json src, return_value_policy /* policy */, handle /* parent */)
|
|
241
|
+
{
|
|
242
|
+
object obj = pyjson::from_json(src);
|
|
243
|
+
return obj.release();
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
#endif
|
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: PyOpenMagnetics
|
|
3
|
+
Version: 1.1.3
|
|
4
|
+
Summary: Python wrapper for OpenMagnetics
|
|
5
|
+
Author-Email: Alfonso Martinez <Alfonso_VII@hotmail.com>
|
|
6
|
+
Classifier: Development Status :: 4 - Beta
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Operating System :: Microsoft :: Windows :: Windows 11
|
|
9
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
10
|
+
Classifier: Programming Language :: C++
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Project-URL: Homepage, https://openmagnetics.com
|
|
13
|
+
Project-URL: Repository, https://github.com/OpenMagnetics/PyOpenMagnetics
|
|
14
|
+
Project-URL: Contact, https://www.linkedin.com/in/alfonso-martinez-de-la-torre/
|
|
15
|
+
Requires-Python: >=3.8
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# PyOpenMagnetics - Python Wrapper for OpenMagnetics
|
|
19
|
+
|
|
20
|
+
[](https://www.python.org/downloads/)
|
|
21
|
+
[](https://opensource.org/licenses/MIT)
|
|
22
|
+
|
|
23
|
+
**PyOpenMagnetics** is a Python wrapper for [MKF (Magnetics Knowledge Foundation)](https://github.com/OpenMagnetics/MKF), the simulation engine of [OpenMagnetics](https://github.com/OpenMagnetics), providing a comprehensive toolkit for designing and analyzing magnetic components such as transformers and inductors.
|
|
24
|
+
|
|
25
|
+
## Features
|
|
26
|
+
|
|
27
|
+
- 🧲 **Core Database**: Access to extensive database of core shapes, materials, and manufacturers
|
|
28
|
+
- 🔌 **Winding Design**: Automatic winding calculations with support for various wire types (round, litz, rectangular, planar)
|
|
29
|
+
- 📊 **Loss Calculations**: Core losses (Steinmetz), winding losses (DC, skin effect, proximity effect)
|
|
30
|
+
- 🎯 **Design Adviser**: Automated recommendations for optimal magnetic designs
|
|
31
|
+
- 📈 **Signal Processing**: Harmonic analysis, waveform processing
|
|
32
|
+
- 🖼️ **Visualization**: SVG plotting of cores, windings, magnetic fields
|
|
33
|
+
- 🔧 **SPICE Export**: Export magnetic components as SPICE subcircuits
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
### From PyPI (recommended)
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install PyOpenMagnetics
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### From Source
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
git clone https://github.com/OpenMagnetics/PyOpenMagnetics.git
|
|
47
|
+
cd PyOpenMagnetics
|
|
48
|
+
pip install .
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Quick Start
|
|
52
|
+
|
|
53
|
+
### Basic Example: Creating a Core
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
import PyOpenMagnetics
|
|
57
|
+
|
|
58
|
+
# Find a core shape by name
|
|
59
|
+
shape = PyOpenMagnetics.find_core_shape_by_name("E 42/21/15")
|
|
60
|
+
|
|
61
|
+
# Find a core material by name
|
|
62
|
+
material = PyOpenMagnetics.find_core_material_by_name("3C95")
|
|
63
|
+
|
|
64
|
+
# Create a core with gapping
|
|
65
|
+
core_data = {
|
|
66
|
+
"functionalDescription": {
|
|
67
|
+
"shape": shape,
|
|
68
|
+
"material": material,
|
|
69
|
+
"gapping": [{"type": "subtractive", "length": 0.001}], # 1mm gap
|
|
70
|
+
"numberStacks": 1
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
# Calculate complete core data
|
|
75
|
+
core = PyOpenMagnetics.calculate_core_data(core_data, False)
|
|
76
|
+
print(f"Effective area: {core['processedDescription']['effectiveParameters']['effectiveArea']} m²")
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Design Adviser: Get Magnetic Recommendations
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
import PyOpenMagnetics
|
|
83
|
+
|
|
84
|
+
# Define design requirements
|
|
85
|
+
inputs = {
|
|
86
|
+
"designRequirements": {
|
|
87
|
+
"magnetizingInductance": {
|
|
88
|
+
"minimum": 100e-6, # 100 µH minimum
|
|
89
|
+
"nominal": 110e-6 # 110 µH nominal
|
|
90
|
+
},
|
|
91
|
+
"turnsRatios": [{"nominal": 5.0}] # 5:1 turns ratio
|
|
92
|
+
},
|
|
93
|
+
"operatingPoints": [
|
|
94
|
+
{
|
|
95
|
+
"name": "Nominal",
|
|
96
|
+
"conditions": {"ambientTemperature": 25},
|
|
97
|
+
"excitationsPerWinding": [
|
|
98
|
+
{
|
|
99
|
+
"name": "Primary",
|
|
100
|
+
"frequency": 100000, # 100 kHz
|
|
101
|
+
"current": {
|
|
102
|
+
"waveform": {
|
|
103
|
+
"data": [0, 1.0, 0],
|
|
104
|
+
"time": [0, 5e-6, 10e-6]
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"voltage": {
|
|
108
|
+
"waveform": {
|
|
109
|
+
"data": [50, 50, -50, -50],
|
|
110
|
+
"time": [0, 5e-6, 5e-6, 10e-6]
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
# Process inputs (adds harmonics and validation)
|
|
120
|
+
processed_inputs = PyOpenMagnetics.process_inputs(inputs)
|
|
121
|
+
|
|
122
|
+
# Get magnetic recommendations
|
|
123
|
+
# core_mode: "available cores" (stock cores) or "standard cores" (all standard shapes)
|
|
124
|
+
magnetics = PyOpenMagnetics.calculate_advised_magnetics(processed_inputs, 5, "standard cores")
|
|
125
|
+
|
|
126
|
+
for i, mag in enumerate(magnetics):
|
|
127
|
+
if "magnetic" in mag:
|
|
128
|
+
core = mag["magnetic"]["core"]["functionalDescription"]
|
|
129
|
+
print(f"{i+1}. {core['shape']['name']} - {core['material']['name']}")
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Calculate Core Losses
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
import PyOpenMagnetics
|
|
136
|
+
|
|
137
|
+
# Define core and operating point
|
|
138
|
+
core_data = {...} # Your core definition
|
|
139
|
+
operating_point = {
|
|
140
|
+
"name": "Nominal",
|
|
141
|
+
"conditions": {"ambientTemperature": 25},
|
|
142
|
+
"excitationsPerWinding": [
|
|
143
|
+
{
|
|
144
|
+
"frequency": 100000,
|
|
145
|
+
"magneticFluxDensity": {
|
|
146
|
+
"processed": {
|
|
147
|
+
"peakToPeak": 0.2, # 200 mT peak-to-peak
|
|
148
|
+
"offset": 0
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
losses = PyOpenMagnetics.calculate_core_losses(core_data, operating_point, "IGSE")
|
|
156
|
+
print(f"Core losses: {losses['coreLosses']} W")
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Winding a Coil
|
|
160
|
+
|
|
161
|
+
```python
|
|
162
|
+
import PyOpenMagnetics
|
|
163
|
+
|
|
164
|
+
# Define coil requirements
|
|
165
|
+
coil_functional_description = [
|
|
166
|
+
{
|
|
167
|
+
"name": "Primary",
|
|
168
|
+
"numberTurns": 50,
|
|
169
|
+
"numberParallels": 1,
|
|
170
|
+
"wire": "Round 0.5 - Grade 1"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"name": "Secondary",
|
|
174
|
+
"numberTurns": 10,
|
|
175
|
+
"numberParallels": 3,
|
|
176
|
+
"wire": "Round 1.0 - Grade 1"
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
|
|
180
|
+
# Wind the coil on the core
|
|
181
|
+
result = PyOpenMagnetics.wind(core_data, coil_functional_description, bobbin_data, [1, 1], [])
|
|
182
|
+
print(f"Winding successful: {result.get('windingResult', 'unknown')}")
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Flyback Converter Wizard
|
|
186
|
+
|
|
187
|
+
PyOpenMagnetics includes a complete flyback converter design wizard. See `flyback.py` for a full example:
|
|
188
|
+
|
|
189
|
+
```python
|
|
190
|
+
from flyback import design_flyback, create_mas_inputs, get_advised_magnetics
|
|
191
|
+
|
|
192
|
+
# Define flyback specifications
|
|
193
|
+
specs = {
|
|
194
|
+
"input_voltage_min": 90,
|
|
195
|
+
"input_voltage_max": 375,
|
|
196
|
+
"outputs": [{"voltage": 12, "current": 2, "diode_drop": 0.5}],
|
|
197
|
+
"switching_frequency": 100000,
|
|
198
|
+
"max_duty_cycle": 0.45,
|
|
199
|
+
"efficiency": 0.85,
|
|
200
|
+
"current_ripple_ratio": 0.4,
|
|
201
|
+
"force_dcm": False,
|
|
202
|
+
"safety_margin": 0.85,
|
|
203
|
+
"ambient_temperature": 40,
|
|
204
|
+
"max_drain_source_voltage": None,
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
# Calculate magnetic requirements
|
|
208
|
+
design = design_flyback(specs)
|
|
209
|
+
print(f"Required inductance: {design['min_inductance']*1e6:.1f} µH")
|
|
210
|
+
print(f"Turns ratio: {design['turns_ratios'][0]:.2f}")
|
|
211
|
+
|
|
212
|
+
# Create inputs for PyOpenMagnetics
|
|
213
|
+
inputs = create_mas_inputs(specs, design)
|
|
214
|
+
|
|
215
|
+
# Get recommended magnetics
|
|
216
|
+
magnetics = get_advised_magnetics(inputs, max_results=5)
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## API Reference
|
|
220
|
+
|
|
221
|
+
### Database Access
|
|
222
|
+
|
|
223
|
+
| Function | Description |
|
|
224
|
+
|----------|-------------|
|
|
225
|
+
| `get_core_materials()` | Get all available core materials |
|
|
226
|
+
| `get_core_shapes()` | Get all available core shapes |
|
|
227
|
+
| `get_wires()` | Get all available wires |
|
|
228
|
+
| `get_bobbins()` | Get all available bobbins |
|
|
229
|
+
| `find_core_material_by_name(name)` | Find core material by name |
|
|
230
|
+
| `find_core_shape_by_name(name)` | Find core shape by name |
|
|
231
|
+
| `find_wire_by_name(name)` | Find wire by name |
|
|
232
|
+
|
|
233
|
+
### Core Calculations
|
|
234
|
+
|
|
235
|
+
| Function | Description |
|
|
236
|
+
|----------|-------------|
|
|
237
|
+
| `calculate_core_data(core, process)` | Calculate complete core data |
|
|
238
|
+
| `calculate_core_gapping(core, gapping)` | Calculate gapping configuration |
|
|
239
|
+
| `calculate_inductance_from_number_turns_and_gapping(...)` | Calculate inductance |
|
|
240
|
+
| `calculate_core_losses(core, operating_point, model)` | Calculate core losses |
|
|
241
|
+
|
|
242
|
+
### Winding Functions
|
|
243
|
+
|
|
244
|
+
| Function | Description |
|
|
245
|
+
|----------|-------------|
|
|
246
|
+
| `wind(core, coil, bobbin, pattern, layers)` | Wind coils on a core |
|
|
247
|
+
| `calculate_winding_losses(...)` | Calculate total winding losses |
|
|
248
|
+
| `calculate_ohmic_losses(...)` | Calculate DC losses |
|
|
249
|
+
| `calculate_skin_effect_losses(...)` | Calculate skin effect losses |
|
|
250
|
+
| `calculate_proximity_effect_losses(...)` | Calculate proximity effect losses |
|
|
251
|
+
|
|
252
|
+
### Design Adviser
|
|
253
|
+
|
|
254
|
+
| Function | Description |
|
|
255
|
+
|----------|-------------|
|
|
256
|
+
| `calculate_advised_cores(inputs, max_results)` | Get recommended cores |
|
|
257
|
+
| `calculate_advised_magnetics(inputs, max, mode)` | Get complete designs |
|
|
258
|
+
| `process_inputs(inputs)` | Process and validate inputs |
|
|
259
|
+
|
|
260
|
+
### Visualization
|
|
261
|
+
|
|
262
|
+
| Function | Description |
|
|
263
|
+
|----------|-------------|
|
|
264
|
+
| `plot_core(core, ...)` | Generate SVG of core |
|
|
265
|
+
| `plot_sections(magnetic, ...)` | Plot winding sections |
|
|
266
|
+
| `plot_layers(magnetic, ...)` | Plot winding layers |
|
|
267
|
+
| `plot_turns(magnetic, ...)` | Plot individual turns |
|
|
268
|
+
| `plot_field(magnetic, ...)` | Plot magnetic field |
|
|
269
|
+
|
|
270
|
+
### Settings
|
|
271
|
+
|
|
272
|
+
| Function | Description |
|
|
273
|
+
|----------|-------------|
|
|
274
|
+
| `get_settings()` | Get current settings |
|
|
275
|
+
| `set_settings(settings)` | Configure settings |
|
|
276
|
+
| `reset_settings()` | Reset to defaults |
|
|
277
|
+
|
|
278
|
+
### SPICE Export
|
|
279
|
+
|
|
280
|
+
| Function | Description |
|
|
281
|
+
|----------|-------------|
|
|
282
|
+
| `export_magnetic_as_subcircuit(magnetic, ...)` | Export as SPICE model |
|
|
283
|
+
|
|
284
|
+
## Core Materials
|
|
285
|
+
|
|
286
|
+
PyOpenMagnetics includes materials from major manufacturers:
|
|
287
|
+
|
|
288
|
+
- **TDK/EPCOS**: N27, N49, N87, N95, N97, etc.
|
|
289
|
+
- **Ferroxcube**: 3C90, 3C94, 3C95, 3F3, 3F4, etc.
|
|
290
|
+
- **Fair-Rite**: Various ferrite materials
|
|
291
|
+
- **Magnetics Inc.**: Powder cores (MPP, High Flux, Kool Mu)
|
|
292
|
+
- **Micrometals**: Iron powder cores
|
|
293
|
+
|
|
294
|
+
## Core Shapes
|
|
295
|
+
|
|
296
|
+
Supported shape families include:
|
|
297
|
+
|
|
298
|
+
- **E cores**: E, EI, EFD, EQ, ER
|
|
299
|
+
- **ETD/EC cores**: ETD, EC
|
|
300
|
+
- **PQ/PM cores**: PQ, PM
|
|
301
|
+
- **RM cores**: RM, RM/ILP
|
|
302
|
+
- **Toroidal**: Various sizes
|
|
303
|
+
- **Pot cores**: P, PT
|
|
304
|
+
- **U/UI cores**: U, UI, UR
|
|
305
|
+
- **Planar**: E-LP, EQ-LP, etc.
|
|
306
|
+
|
|
307
|
+
## Wire Types
|
|
308
|
+
|
|
309
|
+
- **Round enamelled wire**: Various AWG and IEC sizes
|
|
310
|
+
- **Litz wire**: Multiple strand configurations
|
|
311
|
+
- **Rectangular wire**: For high-current applications
|
|
312
|
+
- **Foil**: For planar magnetics
|
|
313
|
+
- **Planar PCB**: For integrated designs
|
|
314
|
+
|
|
315
|
+
## Configuration
|
|
316
|
+
|
|
317
|
+
Use `set_settings()` to configure:
|
|
318
|
+
|
|
319
|
+
```python
|
|
320
|
+
settings = PyOpenMagnetics.get_settings()
|
|
321
|
+
settings["coilAllowMarginTape"] = True
|
|
322
|
+
settings["coilWindEvenIfNotFit"] = False
|
|
323
|
+
settings["painterNumberPointsX"] = 50
|
|
324
|
+
PyOpenMagnetics.set_settings(settings)
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
## Contributing
|
|
328
|
+
|
|
329
|
+
Contributions are welcome! Please see the [OpenMagnetics](https://github.com/OpenMagnetics) organization for contribution guidelines.
|
|
330
|
+
|
|
331
|
+
## Documentation
|
|
332
|
+
|
|
333
|
+
### Quick Start
|
|
334
|
+
- **[llms.txt](llms.txt)** - Comprehensive API reference optimized for AI assistants and quick lookup
|
|
335
|
+
- **[examples/](examples/)** - Practical example scripts for common design workflows
|
|
336
|
+
- **[PyOpenMagnetics.pyi](PyOpenMagnetics.pyi)** - Type stubs for IDE autocompletion
|
|
337
|
+
|
|
338
|
+
### Tutorials
|
|
339
|
+
- **[notebooks/](notebooks/)** - Interactive Jupyter notebook tutorials with visualizations
|
|
340
|
+
- [Getting Started](notebooks/01_getting_started.ipynb) - Introduction to PyOpenMagnetics
|
|
341
|
+
- [Buck Inductor](notebooks/02_buck_inductor.ipynb) - Complete inductor design workflow
|
|
342
|
+
- [Core Losses](notebooks/03_core_losses.ipynb) - In-depth core loss analysis
|
|
343
|
+
|
|
344
|
+
### Reference
|
|
345
|
+
- **[docs/errors.md](docs/errors.md)** - Common errors and solutions
|
|
346
|
+
- **[docs/performance.md](docs/performance.md)** - Performance optimization guide
|
|
347
|
+
- **[docs/compatibility.md](docs/compatibility.md)** - Python/platform version compatibility
|
|
348
|
+
|
|
349
|
+
### Validation
|
|
350
|
+
- **[api/validation.py](api/validation.py)** - Runtime JSON schema validation for inputs
|
|
351
|
+
|
|
352
|
+
## License
|
|
353
|
+
|
|
354
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
355
|
+
|
|
356
|
+
## Related Projects
|
|
357
|
+
|
|
358
|
+
- [MKF](https://github.com/OpenMagnetics/MKF) - C++ magnetics library
|
|
359
|
+
- [MAS](https://github.com/OpenMagnetics/MAS) - Magnetic Agnostic Structure schema
|
|
360
|
+
- [OpenMagnetics Web](https://openmagnetics.com) - Online design tool
|
|
361
|
+
|
|
362
|
+
## References
|
|
363
|
+
|
|
364
|
+
- Maniktala, S. "Switching Power Supplies A-Z", 2nd Edition
|
|
365
|
+
- Basso, C. "Switch-Mode Power Supplies", 2nd Edition
|
|
366
|
+
- McLyman, C. "Transformer and Inductor Design Handbook"
|
|
367
|
+
|
|
368
|
+
## Support
|
|
369
|
+
|
|
370
|
+
For questions and support:
|
|
371
|
+
- 🐛 [GitHub Issues](https://github.com/OpenMagnetics/PyOpenMagnetics/issues)
|
|
372
|
+
- 💬 [Discussions](https://github.com/OpenMagnetics/PyOpenMagnetics/discussions)
|
|
373
|
+
- 📧 Contact the maintainers
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
PyOpenMagnetics.cpython-310-darwin.so,sha256=_Prx4y8JiMs8PUYbWY02AN4ADmfCyCzwI5H1e6OwwTw,29267072
|
|
2
|
+
pyopenmagnetics.dylibs/libpng16.16.dylib,sha256=PKTMLJB5nhuMWAXGDoDJb04d7hsl1a720CW-1VeNXaY,209392
|
|
3
|
+
pyopenmagnetics.dylibs/liblzma.5.dylib,sha256=WUQMJZUJ95PUsHRdxHjqBTQVV7aEwQXl5NStpTe3-fE,185472
|
|
4
|
+
pyopenmagnetics.dylibs/libjpeg.8.3.2.dylib,sha256=B8NZfka9OLQNih2PCLjLelY9gppVKka9FaG8uBRUo6k,489424
|
|
5
|
+
pyopenmagnetics.dylibs/libtiff.6.dylib,sha256=89qxPErtwaA8xtZNgD0FdCDBf4TE3FiJkl2iNje9YVc,543344
|
|
6
|
+
pyopenmagnetics.dylibs/libzstd.1.5.7.dylib,sha256=FckjmykziBlkf2GdyqXCBxlbkvcZ94ADN6KfhZDw3dM,654000
|
|
7
|
+
include/pybind11_json/pybind11_json.hpp,sha256=NI_gDql47RcAh6ijNH7UHFWh4sPo7zFekYIxNP9vvxU,7846
|
|
8
|
+
pyopenmagnetics-1.1.3.dist-info/RECORD,,
|
|
9
|
+
pyopenmagnetics-1.1.3.dist-info/WHEEL,sha256=dW_gvJ2oEbepMSUoruEXHl6Gx7jRi15KAMJvdn3iYBc,114
|
|
10
|
+
pyopenmagnetics-1.1.3.dist-info/METADATA,sha256=QOgfLXN7Vpi39kS4a2WJYh49nBu0yEJbYXc8P1AOeUM,12141
|
|
11
|
+
pyopenmagnetics-1.1.3.dist-info/licenses/LICENSE,sha256=14pjMKc33b3Lf1KpFjN2jvTmybYzo0YtexHxJuz8WXg,1070
|
|
12
|
+
share/pkgconfig/pybind11_json.pc,sha256=8bQYhoPB1uG_JpaQcn4-qMmaRx0R3btUsGpWg_Bx33M,140
|
|
13
|
+
share/cmake/pybind11_json/pybind11_jsonConfigVersion.cmake,sha256=5d_2PCe7NyoLRxVdl80W4oGPWwI-nXpuG6A6ICsOpXs,1403
|
|
14
|
+
share/cmake/pybind11_json/pybind11_jsonConfig.cmake,sha256=AshYDMxYqwktb90mgTvR9UvrTFIfJyF-QClfEAaRk1I,2006
|
|
15
|
+
share/cmake/pybind11_json/pybind11_jsonTargets.cmake,sha256=pSxJMJbBiK84Ti6HznHvALDnfE_dfHi7q9B-bFnxUxU,4121
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 OpenMagnetics
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
############################################################################
|
|
2
|
+
# Copyright (c) 2019, Martin Renou #
|
|
3
|
+
# #
|
|
4
|
+
# Distributed under the terms of the BSD 3-Clause License. #
|
|
5
|
+
# #
|
|
6
|
+
# The full license is in the file LICENSE, distributed with this software. #
|
|
7
|
+
############################################################################
|
|
8
|
+
|
|
9
|
+
# pybind11_json cmake module
|
|
10
|
+
# This module sets the following variables in your project::
|
|
11
|
+
#
|
|
12
|
+
# pybind11_json_FOUND - true if pybind11_json found on the system
|
|
13
|
+
# pybind11_json_INCLUDE_DIRS - the directory containing pybind11_json headers
|
|
14
|
+
# pybind11_json_LIBRARY - empty
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
|
|
18
|
+
####### Any changes to this file will be overwritten by the next CMake run ####
|
|
19
|
+
####### The input file was pybind11_jsonConfig.cmake.in ########
|
|
20
|
+
|
|
21
|
+
get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
|
|
22
|
+
|
|
23
|
+
macro(set_and_check _var _file)
|
|
24
|
+
set(${_var} "${_file}")
|
|
25
|
+
if(NOT EXISTS "${_file}")
|
|
26
|
+
message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
|
|
27
|
+
endif()
|
|
28
|
+
endmacro()
|
|
29
|
+
|
|
30
|
+
macro(check_required_components _NAME)
|
|
31
|
+
foreach(comp ${${_NAME}_FIND_COMPONENTS})
|
|
32
|
+
if(NOT ${_NAME}_${comp}_FOUND)
|
|
33
|
+
if(${_NAME}_FIND_REQUIRED_${comp})
|
|
34
|
+
set(${_NAME}_FOUND FALSE)
|
|
35
|
+
endif()
|
|
36
|
+
endif()
|
|
37
|
+
endforeach()
|
|
38
|
+
endmacro()
|
|
39
|
+
|
|
40
|
+
####################################################################################
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
include(CMakeFindDependencyMacro)
|
|
45
|
+
find_dependency(pybind11 2.2.4)
|
|
46
|
+
find_dependency(nlohmann_json 3.2.0)
|
|
47
|
+
|
|
48
|
+
if(NOT TARGET pybind11_json)
|
|
49
|
+
include("${CMAKE_CURRENT_LIST_DIR}/pybind11_jsonTargets.cmake")
|
|
50
|
+
|
|
51
|
+
get_target_property(pybind11_json_INCLUDE_DIRS pybind11_json INTERFACE_INCLUDE_DIRECTORIES)
|
|
52
|
+
endif()
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# This is a basic version file for the Config-mode of find_package().
|
|
2
|
+
# It is used by write_basic_package_version_file() as input file for configure_file()
|
|
3
|
+
# to create a version-file which can be installed along a config.cmake file.
|
|
4
|
+
#
|
|
5
|
+
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
|
|
6
|
+
# the requested version string are exactly the same and it sets
|
|
7
|
+
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version.
|
|
8
|
+
# The variable CVF_VERSION must be set before calling configure_file().
|
|
9
|
+
|
|
10
|
+
set(PACKAGE_VERSION "0.2.15")
|
|
11
|
+
|
|
12
|
+
if (PACKAGE_FIND_VERSION_RANGE)
|
|
13
|
+
# Package version must be in the requested version range
|
|
14
|
+
if ((PACKAGE_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MIN)
|
|
15
|
+
OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_GREATER PACKAGE_FIND_VERSION_MAX)
|
|
16
|
+
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION_MAX)))
|
|
17
|
+
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
|
18
|
+
else()
|
|
19
|
+
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
|
20
|
+
endif()
|
|
21
|
+
else()
|
|
22
|
+
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
|
23
|
+
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
|
24
|
+
else()
|
|
25
|
+
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
|
26
|
+
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
|
|
27
|
+
set(PACKAGE_VERSION_EXACT TRUE)
|
|
28
|
+
endif()
|
|
29
|
+
endif()
|
|
30
|
+
endif()
|
|
31
|
+
|
|
32
|
+
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Generated by CMake
|
|
2
|
+
|
|
3
|
+
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8)
|
|
4
|
+
message(FATAL_ERROR "CMake >= 3.0.0 required")
|
|
5
|
+
endif()
|
|
6
|
+
if(CMAKE_VERSION VERSION_LESS "3.0.0")
|
|
7
|
+
message(FATAL_ERROR "CMake >= 3.0.0 required")
|
|
8
|
+
endif()
|
|
9
|
+
cmake_policy(PUSH)
|
|
10
|
+
cmake_policy(VERSION 3.0.0...4.0)
|
|
11
|
+
#----------------------------------------------------------------
|
|
12
|
+
# Generated CMake target import file.
|
|
13
|
+
#----------------------------------------------------------------
|
|
14
|
+
|
|
15
|
+
# Commands may need to know the format version.
|
|
16
|
+
set(CMAKE_IMPORT_FILE_VERSION 1)
|
|
17
|
+
|
|
18
|
+
# Protect against multiple inclusion, which would fail when already imported targets are added once more.
|
|
19
|
+
set(_cmake_targets_defined "")
|
|
20
|
+
set(_cmake_targets_not_defined "")
|
|
21
|
+
set(_cmake_expected_targets "")
|
|
22
|
+
foreach(_cmake_expected_target IN ITEMS pybind11_json)
|
|
23
|
+
list(APPEND _cmake_expected_targets "${_cmake_expected_target}")
|
|
24
|
+
if(TARGET "${_cmake_expected_target}")
|
|
25
|
+
list(APPEND _cmake_targets_defined "${_cmake_expected_target}")
|
|
26
|
+
else()
|
|
27
|
+
list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}")
|
|
28
|
+
endif()
|
|
29
|
+
endforeach()
|
|
30
|
+
unset(_cmake_expected_target)
|
|
31
|
+
if(_cmake_targets_defined STREQUAL _cmake_expected_targets)
|
|
32
|
+
unset(_cmake_targets_defined)
|
|
33
|
+
unset(_cmake_targets_not_defined)
|
|
34
|
+
unset(_cmake_expected_targets)
|
|
35
|
+
unset(CMAKE_IMPORT_FILE_VERSION)
|
|
36
|
+
cmake_policy(POP)
|
|
37
|
+
return()
|
|
38
|
+
endif()
|
|
39
|
+
if(NOT _cmake_targets_defined STREQUAL "")
|
|
40
|
+
string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}")
|
|
41
|
+
string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}")
|
|
42
|
+
message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n")
|
|
43
|
+
endif()
|
|
44
|
+
unset(_cmake_targets_defined)
|
|
45
|
+
unset(_cmake_targets_not_defined)
|
|
46
|
+
unset(_cmake_expected_targets)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# Compute the installation prefix relative to this file.
|
|
50
|
+
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
|
51
|
+
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
|
52
|
+
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
|
53
|
+
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
|
54
|
+
if(_IMPORT_PREFIX STREQUAL "/")
|
|
55
|
+
set(_IMPORT_PREFIX "")
|
|
56
|
+
endif()
|
|
57
|
+
|
|
58
|
+
# Create imported target pybind11_json
|
|
59
|
+
add_library(pybind11_json INTERFACE IMPORTED)
|
|
60
|
+
|
|
61
|
+
set_target_properties(pybind11_json PROPERTIES
|
|
62
|
+
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
# Load information for each installed configuration.
|
|
66
|
+
file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/pybind11_jsonTargets-*.cmake")
|
|
67
|
+
foreach(_cmake_config_file IN LISTS _cmake_config_files)
|
|
68
|
+
include("${_cmake_config_file}")
|
|
69
|
+
endforeach()
|
|
70
|
+
unset(_cmake_config_file)
|
|
71
|
+
unset(_cmake_config_files)
|
|
72
|
+
|
|
73
|
+
# Cleanup temporary variables.
|
|
74
|
+
set(_IMPORT_PREFIX)
|
|
75
|
+
|
|
76
|
+
# Loop over all imported files and verify that they actually exist
|
|
77
|
+
foreach(_cmake_target IN LISTS _cmake_import_check_targets)
|
|
78
|
+
if(CMAKE_VERSION VERSION_LESS "3.28"
|
|
79
|
+
OR NOT DEFINED _cmake_import_check_xcframework_for_${_cmake_target}
|
|
80
|
+
OR NOT IS_DIRECTORY "${_cmake_import_check_xcframework_for_${_cmake_target}}")
|
|
81
|
+
foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
|
|
82
|
+
if(NOT EXISTS "${_cmake_file}")
|
|
83
|
+
message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
|
|
84
|
+
\"${_cmake_file}\"
|
|
85
|
+
but this file does not exist. Possible reasons include:
|
|
86
|
+
* The file was deleted, renamed, or moved to another location.
|
|
87
|
+
* An install or uninstall procedure did not complete successfully.
|
|
88
|
+
* The installation package was faulty and contained
|
|
89
|
+
\"${CMAKE_CURRENT_LIST_FILE}\"
|
|
90
|
+
but not all the files it references.
|
|
91
|
+
")
|
|
92
|
+
endif()
|
|
93
|
+
endforeach()
|
|
94
|
+
endif()
|
|
95
|
+
unset(_cmake_file)
|
|
96
|
+
unset("_cmake_import_check_files_for_${_cmake_target}")
|
|
97
|
+
endforeach()
|
|
98
|
+
unset(_cmake_target)
|
|
99
|
+
unset(_cmake_import_check_targets)
|
|
100
|
+
|
|
101
|
+
# This file does not depend on other imported targets which have
|
|
102
|
+
# been exported from the same project but in a separate export set.
|
|
103
|
+
|
|
104
|
+
# Commands beyond this point should not need to know the version.
|
|
105
|
+
set(CMAKE_IMPORT_FILE_VERSION)
|
|
106
|
+
cmake_policy(POP)
|