MDMC.resolution package

Submodules

MDMC.resolution.from_file module

A Resolution subclass for vanadium run resolutions from file.

class MDMC.resolution.from_file.FileResolution(file_name: str, file_type: str, file_reader: str, dt: float)[source]

Bases: Resolution

A Resolution subclass for applying resolution from file.

apply(FQt, t, Q)[source]

Apply resolution to an FQt array.

Parameters:
  • FQt (ndarray) – the FQt array to which resolution is applied.

  • t (ndarray) – the time points for the FQt array.

  • Q (ndarray) – the momentum points for the FQt array.

Returns:

The array with the resolution function applied to it.

Return type:

ndarray

MDMC.resolution.gaussian module

The Gaussian resolution subclass

class MDMC.resolution.gaussian.GaussianResolution(e_res: float)[source]

Bases: Resolution

A class for applying a Gaussian resolution to an Observable.

apply(FQt, t, Q)[source]

Apply resolution to an FQt array.

Parameters:
  • FQt (ndarray) – the FQt array to which resolution is applied.

  • t (ndarray) – the time points for the FQt array.

  • Q (ndarray) – the momentum points for the FQt array.

Returns:

The array with the resolution function applied to it.

Return type:

ndarray

window_in_t(t: ndarray) ndarray[source]

Calculate the Gaussian window function in time space.

Parameters:

t (ndarray) – An array of time points.

Returns:

The Gaussian window over the times in the array t.

Return type:

ndarray

window_in_w(w: ndarray, mu: float = 0.0, norm: bool = True) ndarray[source]

Calculate the Gaussian window function in frequency space.

Parameters:
  • w (ndarray) – An array of frequency points.

  • mu (float) – The offset of the function (defaults to 0).

  • norm (bool) – If True, normalises the distribution to unity.

Returns:

The window function in frequency space (i.e. the Gaussian with FWHM self.e_res, centred on 0) over the frequency array w.

Return type:

ndarray

MDMC.resolution.lorentzian module

The Lorentzian resolution subclass

class MDMC.resolution.lorentzian.LorentzianResolution(e_res: float)[source]

Bases: Resolution

A class for applying a Lorentzian resolution to an Observable.

apply(FQt, t, Q)[source]

Apply resolution to an FQt array.

Parameters:
  • FQt (ndarray) – the FQt array to which resolution is applied.

  • t (ndarray) – the time points for the FQt array.

  • Q (ndarray) – the momentum points for the FQt array.

Returns:

The array with the resolution function applied to it.

Return type:

ndarray

window_in_t(t: ndarray) ndarray[source]

Calculate the Lorentzian window function in time space.

Parameters:

t (ndarray) – An array of time points.

Returns:

The Lorentzian window over the time array t.

Return type:

ndarray

window_in_w(w: ndarray) ndarray[source]

Calculate the Lorentzian window function in frequency space.

Parameters:

w (ndarray) – An array of frequencies.

Returns:

The Lorentzian window over the frequency array w.

Return type:

ndarray

MDMC.resolution.null module

A class for the null object for Resolution classes.

class MDMC.resolution.null.NullResolution(*ignore: Any)[source]

Bases: Resolution

The null object for the Resolution class. Used when there is no resolution to apply.

apply(FQt, t, Q)[source]

Apply resolution to an FQt array.

Parameters:
  • FQt (ndarray) – the FQt array to which resolution is applied.

  • t (ndarray) – the time points for the FQt array.

  • Q (ndarray) – the momentum points for the FQt array.

Returns:

The array with the resolution function applied to it.

Return type:

ndarray

MDMC.resolution.resolution module

The Resolution abstract base class.

class MDMC.resolution.resolution.Resolution[source]

Bases: ABC

An abstract base class for resolution functions.

abstract apply(FQt: np.ndarray, t: np.ndarray, Q: np.ndarray) np.ndarray[source]

Apply resolution to an FQt array.

Parameters:
  • FQt (ndarray) – the FQt array to which resolution is applied.

  • t (ndarray) – the time points for the FQt array.

  • Q (ndarray) – the momentum points for the FQt array.

Returns:

The array with the resolution function applied to it.

Return type:

ndarray

MDMC.resolution.resolution_factory module

A factory pattern for instantiating Resolution objects.

class MDMC.resolution.resolution_factory.ResolutionFactory[source]

Bases: object

Factory class for resolution window functions. Any function in resolution_windows.py can be instantiated using this factory.

create_instance(resolution: dict | float | str, *args: Any) Resolution[source]

Create a Resolution object from a dictionary.

Parameters:

resolution (dict, float, or str) – A parameter specifying the resolution. Should be a one-line dict giving the resolution type and parameters, e.g. a Lorentzian resolution with FWHM of 3 is specified {‘lorentzian’: 3.0}. If a float is given, resolution is assumed to be Gaussian with FWHM of that float. If a str is given, the string is assumed to be a file path to a vanadium run used to define a resolution.

Returns:

A resolution object with the desired properties.

Return type:

Resolution

resolutions = {}

Module contents

Contains functions for applying resolution functions to data, and a factory used to get them.