bath_mapper.FermionBRNoiseOperator

class bath_mapper.FermionBRNoiseOperator(frequencies)

A general struct encoding a spectral function coupled to a fermion system.

Can be used for many cases where a continuous function is coupled to a FermionOperator by up to two fermion operators.

Examples include:

  • The Bloch-Redfield spectral function

  • The effective temperature of a spectral function

Parameters:

frequencies (List[float]) -- The frequencies on which the spectral functions are defined

__init__()

Methods

__init__()

current_version()

Returns the current version of the bath-mapper-py library .

frequencies()

Get the frequencies the spectral function is defined for.

from_bincode(input)

Convert the bincode representation of the FermionBRNoiseOperator to a FermionBRNoiseOperator using the [bincode] crate.

from_json(input)

Convert the json representation of a FermionBRNoiseOperator to a FermionBRNoiseOperator.

get()

Get the spectral function for a pair of FermionProducts.

get_imag()

Get the imaginary part of the spectral function for a pair of FermionProducts.

get_real()

Get the real part of the spectral function for a pair of FermionProducts.

get_spectral_function_matrix(number_fermions)

Get the matrix of the spectral function of a fermion-system at a specific energy index.

json_schema()

Return the JsonSchema for the json serialisation of the class.

min_supported_version()

Return the minimum version of bath-mapper-py that supports this object.

resample()

Resample the FermionBRNoiseOperator on a new set of frequencies.

resample_interpolate()

Resample the FermionBRNoiseOperator 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 FermionProduct.

set_imag(spectral_function, /)

Set the imaginary part of the value of a spectral function for the input frequencies and a set of FermionProducts.

set_real(spectral_function, /)

Set the real part of the value of a spectral function for the input frequencies and a set of FermionProducts.

to_bincode()

Return the bincode representation of the FermionBRNoiseOperator using the [bincode] crate.

to_json()

Return the json representation of the FermionBRNoiseOperator.

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]

static from_bincode(input)

Convert the bincode representation of the FermionBRNoiseOperator to a FermionBRNoiseOperator using the [bincode] crate.

Parameters:

input (ByteArray) -- The serialized FermionBRNoiseOperator (in [bincode] form).

Returns:

The deserialized FermionBRNoiseOperator.

Return type:

FermionBRNoiseOperator

Raises:
  • TypeError -- Input cannot be converted to byte array.

  • ValueError -- Input cannot be deserialized to FermionBRNoiseOperator.

static from_json(input)

Convert the json representation of a FermionBRNoiseOperator to a FermionBRNoiseOperator.

Parameters:

input (str) -- The serialized FermionBRNoiseOperator in json form.

Returns:

The deserialized FermionBRNoiseOperator.

Return type:

FermionBRNoiseOperator

Raises:

ValueError -- Input cannot be deserialized to FermionBRNoiseOperator.

get()

Get the spectral function for a pair of FermionProducts.

Parameters:

key (string, string) -- The string representation of the pair of FermionProducts for which to get the spectral function.

Returns:

The spectral function for the input key.

Return type:

List[complex]

Raises:
  • ValueError -- Could not convert left key input to FermionProduct.

  • ValueError -- Could not convert right key input to FermionProduct.

get_imag()

Get the imaginary part of the spectral function for a pair of FermionProducts.

Parameters:

key (string, string) -- The string representation of the pair of FermionProducts 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 FermionProduct.

  • ValueError -- Could not convert right key input to FermionProduct.

get_real()

Get the real part of the spectral function for a pair of FermionProducts.

Parameters:

key (string, string) -- The string representation of the pair of FermionProducts 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 FermionProduct.

  • ValueError -- Could not convert right key input to FermionProduct.

get_spectral_function_matrix(number_fermions)

Get the matrix of the spectral function of a fermion-system at a specific energy index.

Assumes that the FermionBRNoiseOperator represents the spectral function coupled to a fermion system. A real spectral function needs to be symmetric in the coupling indices. The method will fail if the FermionBRNoiseOperator is not symmetric.

Parameters:
  • spectral_function_index (int) -- The frequency index for which the matrix is returned

  • number_fermions (int) -- The number of fermions 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 FermionBRNoiseOperator 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 FermionBRNoiseOperator.

Return type:

FermionBRNoiseOperator

Raises:

ValueError -- Cannot use resample_interpolate to extrapolate. Current minimum frequency is larger than new minimum frequency.

resample_interpolate()

Resample the FermionBRNoiseOperator 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 FermionBRNoiseOperator.

Return type:

FermionBRNoiseOperator

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 FermionProduct.

Parameters:
  • key (string, string) -- The string representation of the pair of FermionProducts 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 FermionProduct.

  • ValueError -- Could not convert right key input to FermionProduct.

  • 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 FermionProducts.

Parameters:
  • key (string, string) -- The string representation of the pair of FermionProducts 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 FermionProduct.

  • ValueError -- Could not convert right key input to FermionProduct.

  • 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 FermionProducts.

Parameters:
  • key (string, string) -- The string representation of the pair of FermionProducts 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 FermionProduct.

  • ValueError -- Could not convert right key input to FermionProduct.

  • ValueError -- Spectral function must define a value for each frequency.

to_bincode()

Return the bincode representation of the FermionBRNoiseOperator using the [bincode] crate.

Returns:

The serialized FermionBRNoiseOperator (in [bincode] form).

Return type:

ByteArray

Raises:

ValueError -- Cannot serialize FermionBRNoiseOperator to bytes.

to_json()

Return the json representation of the FermionBRNoiseOperator.

Returns:

The serialized form of FermionBRNoiseOperator.

Return type:

str

Raises:

ValueError -- Cannot serialize FermionBRNoiseOperator to json.