Analysis Tasks Documentation
In this documentation there is a full explanation of all the tasks that can be executed through the pipeline in the YAML configuration file and their parameters.
SourceConfig
Bases: AbstractConfig
Set the acquisition parameters of the source and the detector.
Attributes:
| Name | Type | Description |
|---|---|---|
energy |
float
|
The energy of the main emission line, expressed in keV. Default is K-alpha of Fe55 (5.9keV). |
w |
float
|
W-value of the gas used in the detector, expressed in eV. Default is 26.0 eV, which is the W-value of Argon. |
CalibrationConfig
Bases: AbstractConfig
Perform the detector calibration using pulse data at fixed voltages.
Attributes:
| Name | Type | Description |
|---|---|---|
task |
str
|
Name of the task, to perform it must be 'calibration'. |
charge_conversion |
(bool, optional)
|
Whether to convert the calibration to charge (fC) or leave it in voltage (mV). Default is True. |
show |
(bool, optional)
|
Whether to generate and show the plots of the calibration process. Default is False. |
NoiseConfig
Bases: AbstractConfig
Configure the noise fitting and subtraction for the spectrum fitting task. If enabled, the noise is fitted with the specified model and subtracted from the spectrum before fitting the peaks.
Attributes:
| Name | Type | Description |
|---|---|---|
task |
str
|
Name of the task, to perform it must be 'noise'. |
subtract |
(bool, optional)
|
Whether to perform the noise fitting and subtraction. Default is False. |
nbins |
(int, optional)
|
Number of bins to use for the noise fitting. By default, the first non-zero bin is set to zero. Default is 4. |
model |
(str, optional)
|
The model to use for the noise fitting. It must be a model defined in aptapy.models. Default is "Exponential". |
freeze |
(dict[str, float], optional)
|
A dictionary of the parameters to freeze during the noise fitting. Default is {}, meaning no parameters are frozen. |
FitSpecConfig
Bases: AbstractConfig
Perform the spectrum fitting for each source file using the model and the fit parameters defined in the fitting subtasks.
Attributes:
| Name | Type | Description |
|---|---|---|
task |
str
|
Name of the task, to perform it must be 'fit_spec'. |
subtasks |
list[FitSubtaskConfig]
|
List of fitting subtasks to perform. Each subtask defines the model and the fit parameters to use for the fit. |
FitSubtaskConfig
Bases: AbstractConfig
Define a subtask for fitting data.
Attributes:
| Name | Type | Description |
|---|---|---|
target |
str
|
Assign a name to the fitting subtask. The target name can then be used to use the fit results in other tasks (e.g. plot or gain). |
model |
str
|
The name of the model to use for the fit. If spectrum fitting is performed, the model must be one between Gaussian and Fe55Forest defined in aptapy.models. When fitting other data, any model or composite model defined in aptapy.models can be used. To specify a composite model, the syntax is "Model1 + Model2 + ...". |
fit_pars |
(FitPars, optional)
|
Fit parameters for the fitting subtask. Default values are defined in FitPars. |
GainConfig
Bases: AbstractConfig
Perform the gain calculation for each source file using the results of the fitting subtasks. The gain is calculated as the ratio between the inferred charge from the fit results and the expected number of electrons for the given peak energy.
Attributes:
| Name | Type | Description |
|---|---|---|
task |
str
|
Name of the task, to perform it must be 'gain'. |
target |
str
|
The target name of the fitting subtask to use for the gain calculation. |
xaxis |
(str, optional)
|
The x-axis to use for the gain plot. The choices are between 'back', 'drift', 'time' and 'pressure'. Default is 'back'. |
fit |
(bool, optional)
|
Whether to fit the gain values with an exponential function of the voltage. If a single source file is analyzed, the fit is not performed. Default is True. |
show |
(bool, optional)
|
Whether to generate and show the plot of the gain values as a function of the back voltage. If a single source file is analyzed, the plot is not generated. Default is True. |
ResolutionConfig
Bases: AbstractConfig
Perform the resolution calculation for each source file using the results of the fitting subtasks. The resolution is calculated using the charge calibrated spectra as the FWHM of the peak divided by the peak position.
Attributes:
| Name | Type | Description |
|---|---|---|
task |
str
|
Name of the task, to perform it must be 'resolution'. |
target |
str
|
The target name of the fitting subtask to use for the resolution calculation. |
xaxis |
(str, optional)
|
The x-axis to use for the resolution plot. The choices are between 'back', 'drift' 'time' and 'pressure'. Default is 'back'. |
show |
(bool, optional)
|
Whether to generate and show the plot of the resolution values as a function of the back voltage. If a single source file is analyzed, the plot is not generated. Default is True. |
ResolutionEscapeConfig
Bases: AbstractConfig
Perform the resolution escape calculation for each source file using the results of the fitting subtasks. The resolution escape is calculated as the FWHM of the main peak divided by the peak position, normalized to the ratio between the distance between the main peak and the escape peak and the energy difference between them. When using a charge calibrated spectrum, this estimate is equivalent to the previous one.
Attributes:
| Name | Type | Description |
|---|---|---|
task |
str
|
Name of the task, to perform it must be 'resolution_escape'. |
target_main |
str
|
The target name of the fitting subtask to use for the main peak. |
target_escape |
str
|
The target name of the fitting subtask to use for the escape peak. |
show |
(bool, optional)
|
Whether to generate and show the plot of the resolution escape values as a function of the back voltage. If a single source file is analyzed, the plot is not generated. Default is True. |
CompareConfig
Bases: AbstractConfig
Compare the specified quantity for multiple source folders. A task that calculates the specified quantity must be performed.
Attributes:
| Name | Type | Description |
|---|---|---|
task |
str
|
Name of the task, to perform it must be 'compare'. |
quantity |
str
|
The name of the quantity to compare. This must be the same as the target name of the fitting subtask used for the calculation of the quantity. |
target |
str
|
The target name of the fitting subtask to use for the calculation of the quantity. |
xaxis |
(str, optional)
|
The x-axis to use for the comparison plot. The choices are between 'back', 'drift', 'time' and 'pressure'. Default is 'back'. |
combine |
(list[str], optional)
|
List of folder names to combine in the same curve. If a folder name is not specified, another curve will be generated in the same plot. Default is an empty list, which means that no folders will be combined. |
subtasks |
list[FitSubtaskConfig] | None
|
Fitting subtask to perform on the combined data. If not specified, no fit will be performed on the combined data. Default is None. |
show |
(bool, optional)
|
Whether to generate and show the plot of the comparison. Default is True. |
DriftConfig
Bases: AbstractConfig
Perform the analysis of the gain as a function of drift voltage for each source file using the results of the fitting subtasks. The gain is calculated as the ratio between the inferred charge from the fit results and the expected number of electrons for the given peak energy. If specified, analyze the rate of events above a given energy threshold as a function of the drift voltage.
Attributes:
| Name | Type | Description |
|---|---|---|
task |
str
|
Name of the task, to perform it must be 'drift'. |
target |
str
|
The target name of the fitting subtask to use for the gain calculation. |
energy_threshold |
(float, optional)
|
Energy threshold to consider for the rate calculation. Default is 1.5 keV. |
show |
(bool, optional)
|
Whether to generate and show the plot of the gain and rate values as a function of the drift voltage. If a single source file is analyzed, the plot is not generated. Default is True. |
show_rate |
(bool, optional)
|
Whether to show the rate values as a function of the drift voltage on the same plot of the gain. Default is True. |
PlotConfig
Bases: AbstractConfig
Plot the spectra and the fit results for each source file. It is possible to specify different plotting options and choose which fit results to show.
Attributes:
| Name | Type | Description |
|---|---|---|
task |
str
|
Name of the task, to perform it must be 'plot'. |
targets |
list[str] | None
|
List of target names of the fitting subtasks to show in the plot. If None, the entire spectrum is shown, with no best-fit curve. Default is None. |
task_labels |
list[str] | None
|
List of analysis task result labels to show in the plot legend. If None, no result is shown in the legend. Default is None. |
voltage |
(bool, optional)
|
Whether to show the source voltage information in the plot legend. Default is False. |
xrange |
list[float] | None
|
Range of x values to show in the plot. If None, the range is automatically determined from the best-fit results, taking 5 sigma around the peak(s) position(s). Default is None. |
xmin_factor |
float
|
Factor to multiply the automatically determined minimum x value for the plot. Default is 1. |
xmax_factor |
float
|
Factor to multiply the automatically determined maximum x value for the plot. Default is 1. |
show |
(bool, optional)
|
Whether to show the generated plot. Default is True. |