extract_filter_function_arrays

The Boulder Opal Toolkits are currently in beta phase of development. Breaking changes may be introduced.

extract_filter_function_arrays(samples)

Convert the output samples of a filter function calculation into NumPy arrays.

Each sample contains a frequency value and the corresponding inverse power, inverse power uncertainty, and frequency domain noise operator. The four returned NumPy arrays are the frequencies, inverse powers, inverse power uncertainties, and the frequency domain noise operators. If any of the values is None this function returns None rather than the corresponding NumPy array.

Parameters

samples (list[qctrl.types.filter_function.Sample]) – The samples of a qctrl.functions.calculate_filter_function result.

Returns

  • np.ndarray or None – The 1D NumPy array of frequencies. Returns None if any of the frequencies are None.

  • np.ndarray or None – The 1D NumPy array of inverse powers. Returns None if any of the inverse powers are None.

  • np.ndarray or None – The 1D NumPy array of inverse power uncertainties. Returns None if any of the inverse power uncertainties are None.

  • np.ndarray or None – The 3D NumPy array of frequency domain noise operators. Returns None if any of the frequency domain noise operators are None.

Return type

Tuple[Optional[numpy.ndarray], ..]

See also

calculate_filter_function()

Calculate a heuristic for robustness of the controls against noise.

Examples

>>> samples = [
        Sample(
            frequency=0.06283185307179587,
            inverse_power=2.469046857168369,
            inverse_power_uncertainty=0.0016463055859327047,
            frequency_domain_noise_operator=None,
        ),
        ...,
        Sample(
            frequency=6283185.307179586,
            inverse_power=0.004755084538721049,
            inverse_power_uncertainty=6.537825035071768e-05,
            frequency_domain_noise_operator=None,
        )
    ]
>>> qctrl.utils.extract_filter_function_arrays(samples)
    (
        array([6.28318531e-02, ..., 6.28318531e+06]),
        array([2.46904686e+00, ..., 4.75508454e-03]),
        array([1.64630559e-03, ..., 6.53782504e-05]),
        None,
    )