This concerns the following two functions:
- pygama.pargen.survival_fractions.energy_guess
- pygama.pargen.energy_cal.get_hpge_energy_peak_park_guess
There are cases where the gamma peak sigma estimation fails and get_hpge_energy_peak_park_guess returns an empty dictionary, see line 2009 in energy_cal.py. In those cases, the variable parguess in energy_guess is a dictionary (as opposed to a ValueView object), and iterating over it returns the dictionary keys, not their values. This causes np.isnan(guess) to return an error since guess is a string.
Ideally, this should be fixed by making sure get_hpge_energy_peak_park_guess always returns the same type. Alternatively, one could patch energy_guess.
This concerns the following two functions:
There are cases where the gamma peak sigma estimation fails and
get_hpge_energy_peak_park_guessreturns an empty dictionary, see line 2009 in energy_cal.py. In those cases, the variableparguessinenergy_guessis a dictionary (as opposed to a ValueView object), and iterating over it returns the dictionary keys, not their values. This causesnp.isnan(guess)to return an error sinceguessis a string.Ideally, this should be fixed by making sure
get_hpge_energy_peak_park_guessalways returns the same type. Alternatively, one could patchenergy_guess.