bath_mapper.SpinBRNoiseOperator
- class bath_mapper.SpinBRNoiseOperator(frequencies)
A general struct encoding a spectral function coupled to a spin system.
Can be used for many cases where a continuous function is coupled to a PauliOperator by up to two spin operators.
Examples include:
The Bloch-Redfield spectral function
The effective temperature of a spectral function#[pyclass(name = "SpinBRNoiseOperator", module = "bath_mapper")]
- Parameters:
frequencies (List[float]) -- The frequencies on which the spectral functions are defined
- __init__()
Methods
__init__()Returns the current version of the bath-mapper-py library .
Get the frequencies the spectral function is defined for.
Convert the bincode representation of the SpinBRNoiseOperator to a SpinBRNoiseOperator using the [bincode] crate.
Convert the json representation of a SpinBRNoiseOperator to a SpinBRNoiseOperator.
get()Get the spectral function for a pair of PauliProducts.
get_imag()Get the imaginary part of the spectral function for a pair of PauliProducts.
get_real()Get the real part of the spectral function for a pair of PauliProducts.
get_spectral_function_matrix(number_spins)Get the matrix of the spectral function of a spin-system at a specific energy index.
Return the JsonSchema for the json serialisation of the class.
Return the minimum version of bath-mapper-py that supports this object.
resample()Resample the SpinBRNoiseOperator on a new set of frequencies.
Resample the SpinBRNoiseOperator on a new set of frequencies by linear interpolation.
set(spectral_function, /)Set the value of a spectral function for the input frequencies and a set of PauliProducts.
set_imag(spectral_function, /)Set the imaginary part of the value of a spectral function for the input frequencies and a set of PauliProducts.
set_real(spectral_function, /)Set the real part of the value of a spectral function for the input frequencies and a set of PauliProducts.
Return the bincode representation of the SpinBRNoiseOperator using the [bincode] crate.
to_json()Return the json representation of the SpinBRNoiseOperator.
- static current_version()
Returns the current version of the bath-mapper-py library .
- Returns:
The current version of the library.
- Return type:
str
- frequencies()
Get the frequencies the spectral function is defined for.
- Returns:
The start and end points of the frequencies.
- Return type:
List[float]
- from_bincode()
Convert the bincode representation of the SpinBRNoiseOperator to a SpinBRNoiseOperator using the [bincode] crate.
- Parameters:
input (ByteArray) -- The serialized SpinBRNoiseOperator (in [bincode] form).
- Returns:
The deserialized SpinBRNoiseOperator.
- Return type:
- Raises:
TypeError -- Input cannot be converted to byte array.
ValueError -- Input cannot be deserialized to SpinBRNoiseOperator.
- from_json()
Convert the json representation of a SpinBRNoiseOperator to a SpinBRNoiseOperator.
- Parameters:
input (str) -- The serialized SpinBRNoiseOperator in json form.
- Returns:
The deserialized SpinBRNoiseOperator.
- Return type:
- Raises:
ValueError -- Input cannot be deserialized to SpinBRNoiseOperator.
- get()
Get the spectral function for a pair of PauliProducts.
- Parameters:
key (string, string) -- The string representation of the pair of PauliProducts for which to get the spectral function.
- Returns:
The spectral function functionum for the input key.
- Return type:
List[complex]
- Raises:
ValueError -- Could not convert left key input to PauliProduct.
ValueError -- Could not convert right key input to PauliProduct.
- get_imag()
Get the imaginary part of the spectral function for a pair of PauliProducts.
- Parameters:
key (string, string) -- The string representation of the pair of PauliProducts for which to get the spectral function.
- Returns:
The imaginary part of the spectral function for the input key.
- Return type:
List[float]
- Raises:
ValueError -- Could not convert left key input to PauliProduct.
ValueError -- Could not convert right key input to PauliProduct.
- get_real()
Get the real part of the spectral function for a pair of PauliProducts.
- Parameters:
key (string, string) -- The string representation of the pair of PauliProducts for which to get the spectral function.
- Returns:
The real part of the spectral function for the input key.
- Return type:
List[float]
- Raises:
ValueError -- Could not convert left key input to PauliProduct.
ValueError -- Could not convert right key input to PauliProduct.
- get_spectral_function_matrix(number_spins)
Get the matrix of the spectral function of a spin-system at a specific energy index.
Assumes that the SpinBRNoiseOperator represents the spectral function coupled to a spin system. A real spectral function needs to be symmetric in the coupling indices. The method will fail if the SpinBRNoiseOperator is not symmetric.
- Parameters:
spectral_function_index (int) -- The frequency index for which the matrix is returned
number_spins (int) -- The number of spins in the system.
- Returns:
the resulting complex matrix representation of the spectral function at the specified energy index.
- Return type:
np.ndarray
- Raises:
ValueError -- Spectral function matrix is not symmetric.
- static json_schema()
Return the JsonSchema for the json serialisation of the class.
- Returns:
The json schema serialized to json.
- Return type:
str
- min_supported_version()
Return the minimum version of bath-mapper-py that supports this object.
- Returns:
The minimum version of the bath-mapper-py library to deserialize this object.
- Return type:
str
- resample()
Resample the SpinBRNoiseOperator on a new set of frequencies.
The function makes the base assumption that the spectra are flat within each bin corresponding to the original frequencies. To resample the original function is integrated and interpolated at the new frequencies.
- Parameters:
frequencies (List[float]) -- The new frequencies for which every datapoint in the spectral function is defined.
- Returns:
The resampled SpinBRNoiseOperator.
- Return type:
- Raises:
ValueError -- Cannot use resample_interpolate to extrapolate. Current minimum frequency is larger than new minimum frequency.
- resample_interpolate()
Resample the SpinBRNoiseOperator on a new set of frequencies by linear interpolation.
- Parameters:
frequencies (List[float]) -- The new frequencies for which every datapoint in the spectral function is defined.
- Returns:
The resampled SpinBRNoiseOperator.
- Return type:
- Raises:
ValueError -- Cannot use resample_interpolate to extrapolate. Current minimum frequency is larger than new minimum frequency.
- set(spectral_function, /)
Set the value of a spectral function for the input frequencies and a set of PauliProducts.
- Parameters:
key (string, string) -- The string representation of the pair of PauliProducts for which to set the spectral function.
spectral_function (List[float]) -- The frequency resolved spectral function as a vector of complex numbers.
- Raises:
ValueError -- Could not convert left key input to PauliProduct.
ValueError -- Could not convert right key input to PauliProduct.
ValueError -- Spectral function must define a value for each frequency.
- set_imag(spectral_function, /)
Set the imaginary part of the value of a spectral function for the input frequencies and a set of PauliProducts.
- Parameters:
key (string, string) -- The string representation of the pair of PauliProducts for which to set the spectral function.
spectral_function (List[float]) -- The frequency resolved spectral function as a vector of complex numbers.
- Raises:
ValueError -- Could not convert left key input to PauliProduct.
ValueError -- Could not convert right key input to PauliProduct.
ValueError -- Spectral function must define a value for each frequency.
- set_real(spectral_function, /)
Set the real part of the value of a spectral function for the input frequencies and a set of PauliProducts.
- Parameters:
key (string, string) -- The string representation of the pair of PauliProducts for which to set the spectral function.
spectral_function (List[float]) -- The frequency resolved spectral function as a vector of complex numbers.
- Raises:
ValueError -- Could not convert left key input to PauliProduct.
ValueError -- Could not convert right key input to PauliProduct.
ValueError -- Spectral function must define a value for each frequency.
- to_bincode()
Return the bincode representation of the SpinBRNoiseOperator using the [bincode] crate.
- Returns:
The serialized SpinBRNoiseOperator (in [bincode] form).
- Return type:
ByteArray
- Raises:
ValueError -- Cannot serialize SpinBRNoiseOperator to bytes.
- to_json()
Return the json representation of the SpinBRNoiseOperator.
- Returns:
The serialized form of SpinBRNoiseOperator.
- Return type:
str
- Raises:
ValueError -- Cannot serialize SpinBRNoiseOperator to json.