# Data Model
A Data model is used in component for which the S parameters are already known. They data might come from previous simulations, or, more commonly, from experimental measurements or have been provided as a part of a PDK.
This data, loaded in a Data model, can be used as part of a larger Circuit model simulation when used in a subcomponent of the circuit.
# Touchstone file
The most common format for storing S matrix data is in Touchstone files.
These are text files usually with extensions .snp (for a generic model with n ports), .s1p (1-port model), .s2p (2-port model), etc.
A Touchstone file can be imported to a Data model using the Import SNP button. Once loaded, the file data will be displayed in the remaining fields of the Data model for inspection and editing, if desired.
# Number of ports
The number of ports in a Data model indicates the number of elements in the S matrix of the corresponding component. For that reason, the number of ports in the component to which the model is added must match the number of ports in the model itself. An error will be generated otherwise.
# Port Names
The port names section can be used to order the component ports to match the ordering of elements in the loaded data.
By default, PhotonForge uses the ports sorted by name.
For example, if a 2-port component has ports P0 and P1, by default, S matrix coefficient S₁₁ will be associated with the reflection at port P0, and S₂₁ with the transmission from P0 to P1.
That is, the matrix indices are associated to the ports in sorted order: 1-P0, 2-P1.
If we want to change this association we can set the association order under Port Names in the Data model settings dialog.
# Interpolation
Data points loaded into a Data model may not exactly match the simulation frequencies defined in the project configuration.
For those cases, the data is interpolated to the desired frequency values using a specific method.
More information about each method can be found in scipy.interpolate (opens new window).
Besides the interpolation method, the user can also choose the interpolation coordinates. In most cases, interpolating over magnitude and phase yields the expected results (smooth variation between interpolating points), but it is also possible to interpolate real and imaginary parts instead, if so desired.