pygammaspec.analysis module

pygammaspec.analysis.fit_peak(spectrum, emin, emax, baseline_order=1, maxfev=1000000)

The function perform a Gaussian fit of a single photopeak using a polynomial baseline of variable order.

Parameters:
  • spectrum (GammaSpectrum) – The spectrum object containing the data to be fitted. The spectrum must contain an energy calibration.

  • emin (float) – The minimum energy defining the region to fit.

  • emax (float) – The maximum energy defining the region to fit.

  • baseline_order (int) – The order of the baseline function to be used.

  • maxfev (int) – The maximum number of functon evaluation during optimization.

Raises:

RuntimeError – Exception raised if the given spectrum has no energy calibration.

Returns:

  • List[float] – The optimized fitting parameters. The array lists in order the height of the gaussian, its center and its standard deviation and it ends with the coefficients of the baseline polynomial listed in ascending order. The lenght of the list is 3 + b + 1 where b is the basline_order.

  • List[float] – The list of energy datapoints used in the fitting.

  • List[float] – The list of counts associated with the fitted function.

  • List[float] – The list of counts associated with the baseline function.

  • float – The estimated efficiency for the peak as 100*FWHM(E)/E.

Return type:

Tuple[List[float], List[float], List[float], List[float], float]

Function running the scipy.signal.find_peaks funciton to detect peaks in the gamma spectrum.

Parameters:
  • prominence (float) – The prominence threshold to be used in the peak search (default: 0.01). The prominence of a peak measures how much a peak stands out from the surrounding baseline of the signal and is defined as the vertical distance between the peak and its lowest contour line.

  • spectrum (GammaSpectrum) –

Returns:

The dictionary containing the index of the peak as the key and the tuple containing the channel, intensity energy (in keV) as the value. If the spectrum is not calibrated the energy field will be filled with None.

Return type:

Dict[int, Tuple[float, float, Optional[float]]]

pygammaspec.analysis.unitary_height_gaussian(x, x0, sigma)

Unitary height Gaussian function centered in x0 and having a standar deviation of sigma

Parameters:
  • x (float) – The point in which the function must be evaluated.

  • x0 (float) – The center of the Gaussian function.

  • sigma (float) – The standard deviation of the Gaussian.

  • Retruns

  • -------

  • float – The value of the funciont in x.

Return type:

float