pyms.Simulator

Table of Contents

Provides functions for simulation of GCMS data.

Functions:

add_gaussc_noise(im, scale)

Adds noise to an IntensityMatrix object.

add_gaussc_noise_ic(ic, scale)

Adds noise drawn from a normal distribution with constant scale to an ion chromatogram.

add_gaussv_noise(im, scale, cutoff, prop)

Adds noise to an IntensityMatrix object.

add_gaussv_noise_ic(ic, scale, cutoff, prop)

Adds noise to an ic.

chromatogram(n_scan, x_zero, sigma, peak_scale)

Returns a simulated ion chromatogram of a pure component.

gaussian(point, mean, sigma, scale)

Calculates a point on a gaussian density function.

gcms_sim(time_list, mass_list, peak_list)

Simulator of GCMS data.

add_gaussc_noise(im, scale)[source]

Adds noise to an IntensityMatrix object.

Parameters
  • im (BaseIntensityMatrix) – the intensity matrix object

  • scale (float) – the scale of the normal distribution from which the noise is drawn

Author

Sean O’Callaghan

add_gaussc_noise_ic(ic, scale)[source]

Adds noise drawn from a normal distribution with constant scale to an ion chromatogram.

Parameters
  • ic (IonChromatogram) – The ion Chromatogram.

  • scale (float) – The scale of the normal distribution.

Author

Sean O’Callaghan

add_gaussv_noise(im, scale, cutoff, prop)[source]

Adds noise to an IntensityMatrix object.

Parameters
  • im (BaseIntensityMatrix) – the intensity matrix object

  • scale (int) – the scale of the normal distribution from which the noise is drawn

  • cutoff (int) – The level below which the intensity of the ic at that point has no effect on the scale of the noise distribution

  • scale – The scale of the normal distribution for ic values

  • prop (float) – For intensity values above the cutoff, the scale is multiplied by the ic value multiplied by prop.

Author

Sean O’Callaghan

add_gaussv_noise_ic(ic, scale, cutoff, prop)[source]

Adds noise to an ic. The noise value is drawn from a normal distribution, the scale of this distribution depends on the value of the ic at the point where the noise is being added

Parameters
  • ic (IonChromatogram) – The IonChromatogram

  • cutoff (int) – The level below which the intensity of the ic at that point has no effect on the scale of the noise distribution

  • scale (int) – The scale of the normal distribution for ic values below the cutoff is modified for values above the cutoff

  • prop (float) – For ic values above the cutoff, the scale is multiplied by the ic value multiplied by prop.

Author

Sean O’Callaghan

chromatogram(n_scan, x_zero, sigma, peak_scale)[source]

Returns a simulated ion chromatogram of a pure component.

The ion chromatogram contains a single gaussian peak.

Parameters
  • n_scan (int) – the number of scans

  • x_zero (int) – The apex of the peak

  • sigma (float) – The standard deviation of the distribution

  • peak_scale (float) – the intensity of the peak at the apex

Author

Sean O’Callaghan

Return type

ndarray

gaussian(point, mean, sigma, scale)[source]

Calculates a point on a gaussian density function.

f = s*exp(-((x-x0)^2)/(2*w^2))

Parameters
  • point (float) – The point currently being computed

  • mean (int) – The apex of the peak

  • sigma (float) – The standard deviation of the gaussian

  • scale (float) – The height of the apex

Return type

float

Returns

a single value from a normal distribution

Author

Sean O’Callaghan

gcms_sim(time_list, mass_list, peak_list)[source]

Simulator of GCMS data.

Parameters
  • time_list (List[float]) – the list of scan times

  • mass_list (List[float]) – the list of m/z channels

  • peak_list (List[Peak]) – A list of peaks

Return type

IntensityMatrix

Returns

A simulated Intensity Matrix object

Author

Sean O’Callaghan