Skip to content

experiment_result

ExperimentResult

ExperimentResult(
    thetas, phis, polarizations, frequency, parent=None
)

Bases: QObject

Results from an experiment.

This class contains the data from running an experiment. It can be appended to, have calibrations applied to it, and provides methods to get particular subsets of the data like particular cuts or data from a particular frequency.

Attributes:

  • dataAppended (PySide6.QtCore.Signal) –

    PyQt signal emitted when a data append operation has completed

Parameters:

  • thetas (np.ndarray) –

    Array of theta locations (in degrees)

  • phis (np.ndarray) –

    Array of phi locations (in degrees)

  • polarizations (list[str]) –

    List of (name, a, b), where a, b are port numbers representing which S parameters correspond to the polarization.

  • frequency (skrf.frequency.Frequency) –

    The frequency range of this measurement

calibrated_data property

calibrated_data: skrf.NetworkSet

The subset of this result that has been calibrated

created property

created: str

The time this result object was created

f property

f: np.ndarray

An array of all frequency points in this result

frequency property

frequency: skrf.Frequency

The frequency range of this result.

has_calibrated_data property

has_calibrated_data: bool

Whether or not this result contains calibrated data

params property

params: list | None

The parameter names in this result

phis property

phis: np.ndarray

A list of phis in this result

polarizations property

polarizations: list[str]

A list of polarizations in this result

raw_data property

raw_data: skrf.NetworkSet

The subset of this result that has not been calibrated

thetas property

thetas: np.ndarray

A list of thetas in this result

uuid property

uuid: str

This result's unique identifier.

append

append(ntwk, calibration=None)

Append a data point to the result.

This command locks the internal QReadWriteLock, which really only matters when running in a QApplication.

Parameters:

  • ntwk (skrf.network.Network) –

    The data to append

  • calibration (Calibration | None) –

    If a calibration is passed, the raw data and the data after applying the calibration will be appended to the result

apply_calibration

apply_calibration(calibration)

Applies a calibration to this result.

This method applies the calibration to this result and appends the calibrated data. In other words, after this method, the result will contain both raw and calibrated data.

Parameters:

  • calibration (Calibration) –

    The calibration to apply to this result

Raises:

  • ValueError

    Raised if the calibration does not contain data for any of the polarizations in this result

get_3d_data

get_3d_data(polarization, frequency, calibrated=False)

Get a subset of data for all thetas and phis at the specified frequency.

Parameters:

  • polarization (str) –

    The name of the polarization you want data for

  • frequency (float) –

    What frequency you want data for

  • calibrated (bool) –

    Pass True to request calibrated data

Returns:

  • np.ndarray

    A 2D numpy array of the requested data

get_over_freq_vals

get_over_freq_vals(
    polarization, theta, phi, calibrated=False
)

Get a subset of data for all frequencies at the specified theta and phi.

Parameters:

  • polarization (str) –

    The name of the polarization you want data for

  • theta (float) –

    The theta value you want a phi cut for

  • phi (float) –

    The phi value you want a theta cut for

  • calibrated (bool) –

    Pass True to request calibrated data

Returns:

  • np.ndarray

    A numpy array of the requested data

get_phi_cut

get_phi_cut(
    polarization, frequency, theta, calibrated=False
)

Get a subset of data for all phis and a specific theta.

Parameters:

  • polarization (str) –

    The name of the polarization you want data for

  • frequency (float) –

    What frequency you want data for

  • theta (float) –

    The theta value you want a phi cut for

  • calibrated (bool) –

    Pass True to request calibrated data

Returns:

  • np.ndarray

    A numpy array of the requested data

get_theta_cut

get_theta_cut(
    polarization, frequency, phi, calibrated=False
)

Get a subset of data for all thetas and a specific phi.

Parameters:

  • polarization (str) –

    The name of the polarization you want data for

  • frequency (float) –

    What frequency you want data for

  • phi (float) –

    The phi value you want a theta cut for

  • calibrated (bool) –

    Pass True to request calibrated data

Returns:

  • np.ndarray

    A numpy array of the requested data

get_unique_param_vals

get_unique_param_vals(param)

Get a list of unique values for the specified parameter.

This is mostly useful internally, but as an example, consider a result with 4 data points (skrf.Network) with the following params:

[
    {
        'theta': 0,
        'phi': 0,
        'polarization': 'Vertical',
        'calibrated': False,
    },
    {
        'theta': 0,
        'phi': 0,
        'polarization': 'Horizontal',
        'calibrated': False,
    },
    {
        'theta': 0,
        'phi': 5,
        'polarization': 'Vertical',
        'calibrated': False,
    },
    {
        'theta': 0,
        'phi': 5,
        'polarization': 'Horizontal',
        'calibrated': False,
    },
]

calling get_unique_param_vals('phi') would return [0, 5]

Parameters:

  • param (str) –

    The parameter of interest.

Returns:

  • list[Any]

    list[Any]: List of unique values associated with the specified parameter.

load classmethod

load(path)

Load an experiment result from a file.

This loads an .mdif file and attempts to construct an ExperimentResult from it.

Parameters:

Returns:

Raises:

save

save(path)

Save the result to a file.

Saves this result to a .mdif file. This is a text-based file format.

Parameters:

InvalidFileError

Bases: Exception

Exception raised when an attempt to load a result file fails.

If a valid .mdif file was passed, this error was likely the result of the file not containing all the requisite data (thetas, phis, etc).