Analysis Tasks Documentation
In this documentation there is a full explanation of all the tasks and their parameters that can be executed through the pipeline in the YAML configuration file.
Note: all the tasks have a context argument that contains all the analysis data and is constantly updated during the execution, but it must not be specified in the pipeline.
Calibration
Perform the calibration of the detector using pulse data at fixed voltages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
Context
|
The context object containing the pulse data in |
required |
charge_conversion
|
bool
|
Whether to convert the calibration to charge (fC) or leave it in voltage (mV). Default is True. |
charge_conversion
|
show
|
bool
|
Whether to generate and show the plots of the calibration process. Default is True. |
show
|
Returns:
| Name | Type | Description |
|---|---|---|
context |
Context
|
The updated context object containing the calibration results in
|
Source code in src/analysis/tasks.py
Spectral fitting
Perform the fitting of a spectral emission line in the source data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
Context
|
The context object containing the source data in |
required |
target
|
str
|
The name of the fitting target. |
required |
model_class
|
AbstractFitModel
|
The class of the model to use for fitting the spectral line. Default is Gaussian. |
required |
xmin
|
float
|
The minimum x value to consider for the fit range. Default is -inf. |
xmin
|
xmax
|
float
|
The maximum x value to consider for the fit range. Default is inf. |
xmax
|
num_sigma_left
|
float
|
The number of sigmas to extend the fit range to the left of the peak. Default is 1.5. |
num_sigma_left
|
num_sigma_right
|
float
|
The number of sigmas to extend the fit range to the right of the peak. Default is 1.5. |
num_sigma_right
|
absolute_sigma
|
bool
|
Whether to use absolute sigma values for the fit. Default is True. |
absolute_sigma
|
Returns:
| Name | Type | Description |
|---|---|---|
context |
Context
|
The updated context object containing the fit results. |
Source code in src/analysis/tasks.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | |
Gain estimate
Calculate the gain of the detector vs the back voltage using the fit results obtained from the source data of multiple files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
Context
|
The context object containing the fit results. |
required |
target
|
str
|
The name of the fitting subtask to use for gain calculation. |
required |
w
|
float
|
The W-value of the gas inside the detector. Default is 26.0 eV (Ar). |
w
|
energy
|
float
|
The energy of the emission line used for gain calculation. Default is 5.895 keV (Fe-55 Kα). |
energy
|
fit
|
bool
|
Whether to fit the gain trend with an exponential model. Default is True. |
fit
|
show
|
bool
|
Whether to show the plots of the gain trend. Default is True. |
show
|
Returns:
| Name | Type | Description |
|---|---|---|
context |
Context
|
The updated context object containing the gain results. |
Source code in src/analysis/tasks.py
Gain time trend
Calculate the gain of the detector vs time using the fit results obtained from the source data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
Context
|
The context object containing the fit results. |
required |
target
|
str
|
The name of the fitting subtask to use for gain calculation. If None, no calculation is performed. Default is None. |
required |
w
|
float
|
The W-value of the gas inside the detector. Default is 26.0 eV (Ar). |
w
|
energy
|
float
|
The energy of the emission line used for gain calculation. Default is 5.895 keV (Fe-55 Kα). |
energy
|
subtasks
|
list[str]
|
The list of fitting subtasks to fit the gain trend. If None, no fitting is performed. Default is None. |
None
|
show
|
bool
|
Whether to display the plot. Default is True. |
show
|
Returns:
| Name | Type | Description |
|---|---|---|
context |
Context
|
The updated context object containing the gain trend and fit results. |
Source code in src/analysis/tasks.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | |
Gain compare between folders
Compare the gain of multiple folders vs voltage using the fit results obtained from the source data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
FoldersContext
|
The context object containing the fit results. |
required |
target
|
str
|
The name of the spectral line fitting subtask to use for gain comparison. |
required |
combine
|
list[str]
|
List of folder names to combine for gain comparison. Default is an empty list. |
combine
|
show
|
bool
|
Whether to show the plots of the gain comparison. Default is True. |
show
|
Returns:
| Name | Type | Description |
|---|---|---|
context |
FoldersContext
|
The updated context object containing the gain comparison results. |
Source code in src/analysis/tasks.py
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 | |
Drift varying
Calculate the gain and rate of the detector vs the drift voltage using the fit results obtained from the source data of multiple files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
Context
|
The context object containing the fit results. |
required |
target
|
str
|
The name of the fitting subtask to use for gain calculation. If None, no calculation is performed. Default is None. |
required |
w
|
float
|
The W-value of the gas inside the detector. Default is 26.0 eV (Ar). |
w
|
energy
|
float
|
The energy of the emission line used for gain calculation. Default is 5.895 keV (Fe-55 Kα). |
energy
|
threshold
|
float
|
The energy threshold (in keV) above which to calculate the rate. Default is 1.5 keV. |
threshold
|
show
|
bool
|
Whether to show the plots of the gain vs drift voltage. Default is True. |
show
|
rate
|
bool
|
Whether to plot the rate on a secondary y-axis. Default is False. |
rate
|
label
|
str
|
The label for the gain trend plot. Default is None. |
label
|
yscale
|
str
|
The y-axis scale for the gain trend plot. Can be "linear" or "log". Default is "linear". |
yscale
|
Returns:
| Name | Type | Description |
|---|---|---|
context |
Context
|
The updated context object containing the drift results. |
Source code in src/analysis/tasks.py
695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 | |
Resolution estimate
Calculate the energy resolution of the detector using the fit results obtained from the source data. This estimate is based on the position and the width of the target spectral line.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
Context
|
The context object containing the fit results. |
required |
target
|
str
|
The name of the fitting subtask to use for resolution calculation. If None, no calculation is performed. Default is None. |
required |
show
|
bool
|
Whether to show the plots of the resolution trend. Default is True. |
show
|
Returns:
| Name | Type | Description |
|---|---|---|
context |
Context
|
The updated context object containing the resolution results. |
Source code in src/analysis/tasks.py
Resolution estimate with escape peak
Calculate the energy resolution of the detector using the fit results obtained from the source data. This calculation is based on the position and width of the main spectral line and the position of the escape peak.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
Context
|
The context object containing the fit results. |
required |
target_main
|
str
|
The name of the fitting subtask corresponding to the main spectral line. If None, no calculation is performed. Default is None. |
required |
target_escape
|
str
|
The name of the fitting subtask corresponding to the escape peak. If None, no calculation is performed. Default is None. |
required |
show
|
bool
|
Whether to show the plots of the resolution trend. Default is True. |
show
|
Returns:
| Name | Type | Description |
|---|---|---|
context |
Context
|
The updated context object containing the resolution results. |
Source code in src/analysis/tasks.py
Resolution compare between folders
Plot the spectrum
Plot the spectra from the source data and overlay the fitted models for the specified targets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
Context
|
The context object containing the source data the fit results. |
required |
targets
|
list[str]
|
The list of fitting subtask names to plot the fitted models for. If None, no models are plotted. Default is None. |
None
|
title
|
str
|
The title for the plot. Default is None. |
title
|
label
|
str
|
The label for the plot legend. Default is None. |
label
|
task_labels
|
list[str]
|
The list of task names to use for generating the labels of the fitted models. If None, no labels are generated. Default is None. |
task_labels
|
loc
|
str
|
The location of the legend in the plot. Default is "best". |
loc
|
xrange
|
list[float]
|
The x-axis range for the plot. If None, the range is automatically calculated based on the data and fitted models. Default is None. |
xrange
|
xmin_factor
|
float
|
The factor to apply to the minimum x value when automatically calculating the xrange. Default is 1.0. |
xmin_factor
|
xmax_factor
|
float
|
The factor to apply to the maximum x value when automatically calculating the xrange. Default is 1.0. |
xmax_factor
|
voltage
|
bool
|
Whether to include the voltage information in the legend. Default is False. |
voltage
|
show
|
bool
|
Whether to show the plots after creation. Default is True. |
show
|
Returns:
| Name | Type | Description |
|---|---|---|
context |
Context
|
The context object (in future it will be updated with the figures). |
Source code in src/analysis/tasks.py
786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 | |