DataModel¶
- class photonforge.DataModel(s_matrix=None, s_array=None, frequencies=None, ports=None, interpolation_method='linear', interpolation_coords='mag_phase', poleresidue_kwargs={})[source]¶
Model based on existing S matrix data.
- Parameters:
s_matrix (SMatrix | None) – Model data as an
SMatrixinstance.s_array (Sequence[Sequence[Sequence[complex]]] | None) – Complex array with dimensions
(F, N, N), in whichNis the number of ports.frequencies (Sequence[Annotated[float, minimum=0, units='Hz']] | None) – Frequency array with length
F.ports (Sequence[str] | None) – List of port names. If not set, the sorted list of port components is used.
interpolation_method (Literal['linear', 'barycentric', 'cubicspline', 'pchip', 'akima', 'makima', 'poleresidue']) – Interpolation method used for sampling frequencies. See table below for options.
interpolation_coords (Literal['real_imag', 'mag_phase']) – Coordinate system used for interpolation. One of
"mag_phase"or"real_imag". Not used for"poleresidue"interpolation.poleresidue_kwargs (Annotated[dict[str, Any], _]) – Keyword arguments to
pole_residue_fit()used when using"poleresidue"interpolation.
When
s_matrixis provided,s_array,frequencies, andportsshould beNone, otherwise onlyportsis optional.Interpolation method
Description
"linear"Linear interpolation between neighboring points
"poleresidue"Pole-residue fitting
"barycentric"Barycentric Lagrange interpolation
"cubicspline"Cubic spline interpolation
"pchip"Piecewise cubic Hermite interpolating polynomial
"akima"Akima interpolation
"makima"Modified Akima interpolation
Important
Use of any interpolation method other than
"linear"or"poleresidue"requires scipy >= 1.7, and"makima"requires scipy >= 1.13.Note
The conversion from array to dictionary for
s_datais equivalent tos_dict[(ports[i], ports[j])] = s_array[:, j, i].See also
Methods
black_box_component([port_spec, technology, ...])Create a black-box component using this model for testing.
estimate_cost(*args, **kwargs)Estimate the cost for S matrix computation.
from_bytes(byte_repr)De-serialize this model.
s_matrix(component, frequencies[, ...])Compute the S matrix for a component using this model.
setup_time_stepper(component, time_step[, ...])Obtain a time stepper for a component using this model.
start(component, frequencies, **kwargs)Start computing the S matrix response from a component.
update(*args, **kwargs)Update this model.
Attributes
parametric_functionFunction used to update a parametric component.
parametric_kwargsKeyword arguments used to update a parametric component.
propertiesObject properties.
random_variablesRandom variables associated to this modles's parameters.
time_stepperTime stepper associated with this model.
- black_box_component(port_spec=None, technology=None, name=None)[source]¶
Create a black-box component using this model for testing.
- Parameters:
port_spec (str | PortSpec | Sequence[str | PortSpec] | None) – Port specification used in the component. If
None, look for"port_spec"inconfig.default_kwargs.technology (Technology | None) – Component technology. If
None, the default technology is used.name (str | None) – Component name. If
Nonea default is used.
- Returns:
Component with ports and model.
- Return type:
- classmethod from_bytes(byte_repr)[source]¶
De-serialize this model.
- Parameters:
byte_repr (bytes)
- Return type: