pygammaspec.visualization module

pygammaspec.visualization.plot_calibration(calibration)

Plot the calibration points together with the fitting curve.

Parameters:

calibration (Calibration) – The calibration object to plot.

Return type:

None

pygammaspec.visualization.plot_spectrum(sample, background=None, xlog=False, ylog=False, chrange=None, enrange=None, yrange=None, smoothing_size=10, prominence=None, filename=None, external_calibration=None, nuclide=None, branching_ratio_threshold=0.05)

The function plots the gamma spectrum of the sample. If a background spetrum is given, the function automatically computes the difference of the two spectra and also displays the difference between the two spectra. If calibration has been applied to the given spectra the plot will automatically show energy as the x-scale.

Parameters:
  • sample (GammaSpectrum) – The gamma spectrum recorded for the sample.

  • background (Optional[GammaSpectrum]) – The gamma spectrum of the background.

  • xlog (bool) – If set to True will set the x-scale to logarithmic form (default: False).

  • ylog (bool) – If set to True will set the y-scale to logarithmic form (default: False).

  • chrange (Optional[Tuple[float, float]]) – The tuple of float values setting the left and right limits of the x-scale based on channel index. If set to None (default) will apply automatic scaling of the x-axis.

  • enrange (Optional[Tuple[float, float]]) – The tuple of float values setting the left and right limits of the x-scale based on energy values (in keV). If set to None (default) will apply automatic scaling of the x-axis.

  • yrange (Optional[Tuple[float, float]]) – The tuple of float values setting the bottom and top of the y-scale. If set to None (default) will apply automatic scaling of the y-axis.

  • smoothing_size (int) – Size of the averaging window used to smooth out the difference spectrum (default: 10)

  • prominence (Optional[float]) – If set to a value different from None (default), will automatically apply the peak_search function from the pygammaspec.analysis to mark the main peaks using the user defined prominence value.

  • filename (Optional[str]) – If not None, will indicate the path of the generated image file.

  • external_calibration (Optional[Calibration]) – If not None, will apply energy scale to the x-axis. If a calibration is applied to the spectra the new calibration will override it during plotting.

  • nuclide (Optional[str]) – If a nuclide is provided, the plotter will add on the spectrum a marker on the theoretical location of the main gamma lines associated to the decay products of the specified nuclide. This option will work only in the case of calibrated spectra.

  • branching_ratio_threshold (float) – The brancing ratio threshold used to search for decay products of the target nuclide. (default 0.05)

Raises:

RuntimeError – Exception raised if the x-axis range is specified with enrange without a valid calibration.