Adapters
metasurface_py.adapters
Adapters for external solver data and validation.
compare_models(surface_a, state_a, surface_b, state_b, freq, angles)
Compare two models over a frequency/angle grid.
Useful for comparing reduced-order predictions against full-wave solver outputs or measured data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
surface_a
|
Metasurface
|
First model surface. |
required |
state_a
|
SurfaceState
|
First model state. |
required |
surface_b
|
Metasurface
|
Second model surface. |
required |
state_b
|
SurfaceState
|
Second model state. |
required |
freq
|
float
|
Frequency [Hz]. |
required |
angles
|
AngleGrid
|
Observation angle grid. |
required |
Returns:
| Type | Description |
|---|---|
Dataset
|
xr.Dataset with magnitude_error_db, phase_error_deg, |
Dataset
|
and aggregate metrics as attributes. |
import_lookup_table(path, format='auto', **kwargs)
Import a lookup table from file, auto-detecting format.
Dispatches to LookupTableCell.from_csv() or .from_hdf5() based on file extension.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Path to data file (.csv, .h5, .hdf5, .nc). |
required |
format
|
str
|
"auto", "csv", or "hdf5". |
'auto'
|
**kwargs
|
Any
|
Passed to the underlying loader. |
{}
|
Returns:
| Type | Description |
|---|---|
LookupTableCell
|
LookupTableCell ready for use. |
validate_lookup_table(cell)
Validate a lookup table for physical consistency.
Checks: - Passivity: |response| <= 1 for all entries - Frequency and angle coverage - Number of states
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
LookupTableCell
|
LookupTableCell to validate. |
required |
Returns:
| Type | Description |
|---|---|
ValidationReport
|
ValidationReport with findings. |