diff --git a/src/pint_pal/lite_utils.py b/src/pint_pal/lite_utils.py index f329691..96e8c88 100644 --- a/src/pint_pal/lite_utils.py +++ b/src/pint_pal/lite_utils.py @@ -1484,20 +1484,38 @@ def check_convergence(fitter): Parameters ========== fitter: `pint.fitter` object + + Returns + ======= + output_val: string object that corresponds to the printed outputs of the checker """ chi2_decrease = fitter.resids_init.chi2-fitter.resids.chi2 - print(f"chi-squared decreased during fit by {chi2_decrease}") + message = str(f"chi-squared decreased during fit by {chi2_decrease}") + print(message) + output_val = [] + output_val.append(message) if hasattr(fitter, "converged") and fitter.converged: - print("Fitter has converged") + message = "Fitter has converged" + print(message) + output_val.append(message) else: if abs(chi2_decrease)<0.01: - print("Fitter has probably converged") + message = "Fitter has probably converged" + print(message) + output_val.append(message) elif chi2_decrease<0: - log.warning("Fitter has increased chi2!") + message = "Fitter has increased chi2!" + log.warning(message) + output_val.append(message) else: - log.warning("Fitter may not have converged") + message = "Fitter may not have converged" + log.warning(message) + output_val.append(message) if chi2_decrease > 0.01: - log.warning("Input par file is not fully fitted") + message = "Input par file is not fully fitted" + log.warning(message) + output_val.append(message) + return output_val def file_look(filenm, plot_type = 'profile'): """ Plots profile, GTpd, or YFp for a single file