irradiapy.analysis.recoils module

Module for analyzing recoils and final ion positions.

irradiapy.analysis.recoils.depth_injected_ions_hist(recoilsdb, analysisdb, axis, nbins=100, p0=None, asymmetry=1.0)[source]

Calculate and store the injected-ion final-depth histogram and attempt to fit it.

Fit: asymmetric gaussian function. Tries to fit to Eq. (1) of Nuclear Instruments and Methods in Physics Research B 500-501 (2021) 52-56.

Parameters:
  • recoilsdb (RecoilsDB) – Recoils database.

  • analysisdb (AnalysisDB) – Database for storing results.

  • axis (str) – Axis along which to calculate depth (‘x’, ‘y’, or ‘z’).

  • nbins (int) – Number of depth nbins.

  • p0 (float | None) – Initial guess for Gaussian fit.

  • asymmetry (float) – Bound for the asymmetry fit parameter. Fit will be done in (-asymmetry, asymmetry).

Returns:

(depth_centers, hist)

Return type:

tuple[GenericAlias[double], GenericAlias[double]]

irradiapy.analysis.recoils.depth_injected_ions_hist_plot(analysisdb, axis, fit=False, show=False, plot_path=None, dpi=300)[source]

Plot the injected ions final depth histogram.

Parameters:
  • analysisdb (AnalysisDB) – Database. Must contain depth ions histogram data.

  • axis (str) – Axis along which to plot depth (‘x’, ‘y’, or ‘z’).

  • fit (bool) – Whether to plot the fit function.

  • show (bool) – Whether to show the plot.

  • plot_path (Path | None) – Output path for the plot.

  • dpi (int) – Dots per inch for the plot.

Return type:

None

irradiapy.analysis.recoils.depth_recoil_energy_hist_plot(recoilsdb, axis, depth_nbins=100, energy_nbins=100, max_recoil_energy=None, log=False, kev=False, plot_path=None, show=False, dpi=300)[source]

Plot the recoil energy vs depth histogram.

Parameters:
  • recoilsdb (RecoilsDB) – Recoils database.

  • axis (str) – Axis along which to calculate depth (‘x’, ‘y’, or ‘z’).

  • depth_nbins (int) – Number of nbins for depth histogram.

  • energy_nbins (int) – Number of nbins for recoil energy histogram.

  • max_recoil_energy (float | None) – Maximum recoil energy to consider, in eV. If None, all recoil energies are considered.

  • log (bool) – Whether to use a logarithmic scale for the color map.

  • kev (bool) – Whether to plot recoil energies in keV instead of eV.

  • plot_path (Path | None) – Output path for the plot.

  • show (bool) – Whether to show the plot.

  • dpi (int) – Dots per inch for the plot.

Returns:

(depth_edges, energy_edges, hist). Rows correspond to depth nbins, columns to recoil energy nbins.

Return type:

tuple[GenericAlias[double], GenericAlias[double], GenericAlias[double]]

irradiapy.analysis.recoils.recoil_energies_hist(recoilsdb, analysisdb, nbins=100, conditions='')[source]

Calculate and store the recoil energy histogram and attempt to fit it.

Fit: power law function.

Parameters:
  • recoilsdb (RecoilsDB) – Recoils database.

  • analysisdb (AnalysisDB) – Database for storing results.

  • nbins (int) – Number of recoil energy nbins.

  • conditions (str) – Conditions to filter recoils.

Returns:

(energy_centers, hist)

Return type:

tuple[GenericAlias[double], GenericAlias[double]]

irradiapy.analysis.recoils.recoil_energies_hist_plot(analysisdb, fit=False, show=False, plot_path=None, dpi=300)[source]

Plot the recoil energy histogram.

Parameters:
  • analysisdb (AnalysisDB) – Database. Must contain recoil energies histogram data.

  • fit (bool) – Whether to plot the fit function.

  • show (bool) – Whether to show the plot.

  • plot_path (Path | None) – Output path for the plot.

  • dpi (int) – Dots per inch for the plot.

Return type:

None

irradiapy.analysis.recoils.recoils_distances_hist_plot(recoilsdb, dist_nbins=100, energy_nbins=100, min_recoil_energy=5000.0, global_min_counts=1, log=False, show=False, plot_path=None, dpi=300)[source]

Plot the recoils pairwise distances vs sum of recoil energies histogram.

For each event, calculates the pairwise distances between all recoils with recoil energy >= min_recoil_energy, and the sum of their recoil energies. The histogram shows the counts of pairs per event as a function of distance and sum of recoil energies.

Parameters:
  • recoilsdb (RecoilsDB) – Recoils database.

  • dist_nbins (int) – Number of nbins for the distance histogram.

  • energy_nbins (int) – Number of nbins for the energy histogram.

  • min_recoil_energy (float) – Minimum recoil energy to consider, in eV. If set too low, the amount of pairs is so large that the calculation may fail due to lack of memory.

  • global_min_counts (int) – Minimum counts to show in the plot.

  • log (bool) – Whether to use a logarithmic scale for the color map.

  • show (bool) – Whether to show the plot.

  • plot_path (Path | None) – Output path for the plot.

  • dpi (int) – Dots per inch for the plot.

Returns:

(histogram, distance_edges, energy_edges). Rows correspond to distance nbins, columns to sum of recoil energy nbins.

Return type:

tuple[GenericAlias[double], GenericAlias[double], GenericAlias[double]]