diff --git a/markdown/chapter_1_introduction/tutorial_5_results_and_samples.md b/markdown/chapter_1_introduction/tutorial_5_results_and_samples.md index db2f4c3..bc38c57 100644 --- a/markdown/chapter_1_introduction/tutorial_5_results_and_samples.md +++ b/markdown/chapter_1_introduction/tutorial_5_results_and_samples.md @@ -333,655 +333,583 @@ print("The search has finished run - you may now continue the notebook.") folder for live output of the results. This Jupyter notebook cell with progress once the search has completed - this could take a few minutes! - 2026-07-11 16:29:32,999 - autofit.non_linear.search.abstract_search - INFO - Starting non-linear search with 1 cores. + 2026-07-11 18:13:35,792 - autofit.non_linear.search.abstract_search - INFO - Starting non-linear search with 1 cores. - 2026-07-11 16:29:33,011 - tutorial_5_results_and_samples - INFO - The output path of this fit is HowToFit/output/chapter_1_introduction/tutorial_5_results_and_samples/f7b96c133609a46d15a374506304464c + 2026-07-11 18:13:35,802 - tutorial_5_results_and_samples - INFO - The output path of this fit is HowToFit/output/chapter_1_introduction/tutorial_5_results_and_samples/f7b96c133609a46d15a374506304464c - 2026-07-11 16:29:33,012 - tutorial_5_results_and_samples - INFO - Outputting pre-fit files (e.g. model.info, visualization). + 2026-07-11 18:13:35,802 - tutorial_5_results_and_samples - INFO - Outputting pre-fit files (e.g. model.info, visualization). - 2026-07-11 16:29:33,575 - autofit.non_linear.initializer - INFO - Generating initial samples of model using JAX LH Function cores + 2026-07-11 18:13:36,280 - autofit.non_linear.initializer - INFO - Generating initial samples of model using JAX LH Function cores - 2026-07-11 16:29:33,597 - autofit.non_linear.initializer - INFO - Initial samples generated, starting non-linear search + 2026-07-11 18:13:36,298 - autofit.non_linear.initializer - INFO - Initial samples generated, starting non-linear search - 2026-07-11 16:29:33,598 - tutorial_5_results_and_samples - INFO - Visualizing Starting Point Model in image_start folder. + 2026-07-11 18:13:36,299 - tutorial_5_results_and_samples - INFO - Visualizing Starting Point Model in image_start folder. - 2026-07-11 16:29:34,071 - tutorial_5_results_and_samples - INFO - Starting new Emcee non-linear search (no previous samples found). + 2026-07-11 18:13:36,700 - tutorial_5_results_and_samples - INFO - Starting new Emcee non-linear search (no previous samples found). 0%| | 0/2000 [00:00 normalization): - 0.11335924010781939 + 71.10567165730815 Sample 0's third parameter value (Gaussian -> sigma) - 3099.028904610647 + 19.041078224688448 @@ -1115,9 +1043,9 @@ print(samples.weight_list[0]) ``` log(likelihood), log(prior), log(posterior) and weight of the first sample. - 68.35981822308696 - -1.7760622584685666 - 66.58375596461839 + 181.55217157376288 + -6.882365196642858 + 174.66980637712 1.0 @@ -1144,14 +1072,14 @@ print("Sigma = ", max_lh_instance.exponential.rate, "\n") ``` Max Log Likelihood `Gaussian` Instance: - Centre = -2.9410156136578074e+17 - Normalization = 523915696.11279744 - Sigma = -3.023887584844618e+16 + Centre = 49.93679305733673 + Normalization = 22.316040613432797 + Sigma = 10.154534833581186 Max Log Likelihood Exponential Instance: - Centre = 50.2399798087453 - Normalization = 51.65027804241896 - Sigma = 0.0623539817262462 + Centre = 50.246449585900606 + Normalization = 41.21960028703172 + Sigma = 0.05184778273594719 @@ -1168,7 +1096,7 @@ print(max_lh_vector, "\n\n") Max Log Likelihood Model Parameters: - [-2.9410156136578074e+17, 523915696.11279744, -3.023887584844618e+16, 50.2399798087453, 51.65027804241896, 0.0623539817262462] + [49.93679305733673, 22.316040613432797, 10.154534833581186, 50.246449585900606, 41.21960028703172, 0.05184778273594719] @@ -1230,14 +1158,14 @@ print("Sigma = ", median_pdf_instance.exponential.rate, "\n") ``` Max Log Likelihood `Gaussian` Instance: - Centre = 50.13507900894478 - Normalization = 8.730203550030652 - Sigma = 10.797678770589716 + Centre = 50.11700527756945 + Normalization = 41.400469983078125 + Sigma = 14.142197776206366 Max Log Likelihood Exponential Instance: - Centre = 50.1016222399324 - Normalization = 51.74042118842236 - Sigma = 0.06213782821625456 + Centre = 49.8412364067728 + Normalization = 29.08945386035243 + Sigma = 0.06288372193481495 @@ -1295,14 +1223,14 @@ print("Sigma = ", errors_at_lower_sigma_instance.gaussian.sigma, "\n") ``` Upper Error values of Gaussian (at 3.0 sigma confidence): - Centre = 1.9035565111885748e+16 - Normalization = 876330725.5982871 - Sigma = 1954631025976492.2 + Centre = 43.05174582345312 + Normalization = 50.462490200940366 + Sigma = 44.6052208883872 lower Error values of Gaussian (at 3.0 sigma confidence): - Centre = 6.468665924711259e+17 - Normalization = 8.730203390689214 - Sigma = 6.650671449666327e+16 + Centre = 13.918276635649953 + Normalization = 41.400075258873066 + Sigma = 8.005905398848578 @@ -1325,14 +1253,14 @@ print("Sigma = ", values_at_lower_sigma_instance.gaussian.sigma, "\n") ``` Upper Parameter values w/ error of Gaussian (at 3.0 sigma confidence): - Centre = 1.90355651118858e+16 - Normalization = 876330734.3284906 - Sigma = 1954631025976503.0 + Centre = 93.16875110102256 + Normalization = 91.86296018401849 + Sigma = 58.74741866459357 lower Parameter values w/ errors of Gaussian (at 3.0 sigma confidence): - Centre = -6.468665924711259e+17 - Normalization = 1.5934143739195753e-07 - Sigma = -6.650671449666326e+16 + Centre = 36.198728641919494 + Normalization = 0.0003947242050568983 + Sigma = 6.136292377357789 @@ -1346,54 +1274,24 @@ tool `corner.py`, which is wrapped via the `aplt.corner_cornerpy` function. aplt.corner_cornerpy(samples=result.samples) ``` - 2026-07-11 16:30:08,517 - root - WARNING - Too few points to create valid contours - - - 2026-07-11 16:30:08,545 - root - WARNING - Too few points to create valid contours - - - 2026-07-11 16:30:08,566 - root - WARNING - Too few points to create valid contours - - - 2026-07-11 16:30:08,593 - root - WARNING - Too few points to create valid contours + 2026-07-11 18:14:08,597 - root - WARNING - Too few points to create valid contours - 2026-07-11 16:30:08,613 - root - WARNING - Too few points to create valid contours + 2026-07-11 18:14:08,654 - root - WARNING - Too few points to create valid contours - 2026-07-11 16:30:08,633 - root - WARNING - Too few points to create valid contours + 2026-07-11 18:14:08,798 - root - WARNING - Too few points to create valid contours - 2026-07-11 16:30:08,663 - root - WARNING - Too few points to create valid contours + 2026-07-11 18:14:08,834 - root - WARNING - Too few points to create valid contours - 2026-07-11 16:30:08,682 - root - WARNING - Too few points to create valid contours - - - 2026-07-11 16:30:08,700 - root - WARNING - Too few points to create valid contours - - - 2026-07-11 16:30:08,717 - root - WARNING - Too few points to create valid contours - - - 2026-07-11 16:30:08,743 - root - WARNING - Too few points to create valid contours - - - 2026-07-11 16:30:08,763 - root - WARNING - Too few points to create valid contours - - - 2026-07-11 16:30:08,781 - root - WARNING - Too few points to create valid contours - - - 2026-07-11 16:30:08,802 - root - WARNING - Too few points to create valid contours - - - 2026-07-11 16:30:08,820 - root - WARNING - Too few points to create valid contours + 2026-07-11 18:14:08,853 - root - WARNING - Too few points to create valid contours -![png](tutorial_5_results_and_samples_files/tutorial_5_results_and_samples_33_15.png) +![png](tutorial_5_results_and_samples_files/tutorial_5_results_and_samples_33_5.png) @@ -1413,9 +1311,9 @@ print("Sigma = ", max_log_posterior_instance.gaussian.sigma, "\n") ``` Maximum Log Posterior Vector: - Centre = -24011277044876.77 - Normalization = 3125270.2307336275 - Sigma = -2387925142098.1606 + Centre = 49.93679305733673 + Normalization = 22.316040613432797 + Sigma = 10.154534833581186 @@ -1447,9 +1345,9 @@ print("Sigma = ", instance.gaussian.sigma, "\n") ``` Gaussian Instance of last sample - Centre = -2.5614444939533196e+16 - Normalization = 798.0401817263084 - Sigma = -2627054060301375.5 + Centre = 49.12110332539849 + Normalization = 22.855124856009187 + Sigma = 10.199451132678083 @@ -1506,7 +1404,7 @@ median_fwhm, lower_fwhm, upper_fwhm = af.marginalize( print(f"FWHM = {median_fwhm} ({upper_fwhm} {lower_fwhm}") ``` - FWHM = 25.4265904087898 (6898791711474904.0 -6.302666628080957e+17 + FWHM = 33.30233080420287 (141.4978563547001 14.097275235204755 __Samples Filtering__ @@ -1539,12 +1437,12 @@ print(samples.max_log_likelihood(as_instance=False)) Parameter paths in the model which are used for filtering: [('gaussian', 'centre'), ('gaussian', 'normalization'), ('gaussian', 'sigma'), ('exponential', 'centre'), ('exponential', 'normalization'), ('exponential', 'rate')] All parameters of the very first sample - [31513.97299772367, 0.11335924010781939, 3099.028904610647, 49.92329668729731, 52.104725511588285, 0.06232091297101713] + [48.65596967347352, 71.10567165730815, 19.041078224688448, 50.48493591145581, 13.710995372478395, 0.12390418007909251] All parameters of the very first sample (containing only the Gaussian centre. - [31513.97299772367] + [48.65596967347352] Maximum Log Likelihood Model Instances (containing only the Gaussian centre): - [-2.9410156136578074e+17] + [49.93679305733673] Above, we specified each path as a list of tuples of strings. @@ -1565,7 +1463,7 @@ print(samples.parameter_lists[0]) ``` All parameters of the very first sample (containing only the Gaussian centre). - [31513.97299772367] + [48.65596967347352] Above, we filtered the `Samples` but asking for all parameters which included the path ("gaussian", "centre"). @@ -1594,9 +1492,9 @@ print(samples.parameter_lists[0]) Parameter paths in the model which are used for filtering: [('gaussian', 'centre'), ('gaussian', 'normalization'), ('gaussian', 'sigma'), ('exponential', 'centre'), ('exponential', 'normalization'), ('exponential', 'rate')] All parameters of the very first sample - [31513.97299772367, 0.11335924010781939, 3099.028904610647, 49.92329668729731, 52.104725511588285, 0.06232091297101713] + [48.65596967347352, 71.10567165730815, 19.041078224688448, 50.48493591145581, 13.710995372478395, 0.12390418007909251] All parameters of the very first sample (containing only the Gaussian normalization and sigma). - [0.11335924010781939, 3099.028904610647, 49.92329668729731, 52.104725511588285, 0.06232091297101713] + [71.10567165730815, 19.041078224688448, 50.48493591145581, 13.710995372478395, 0.12390418007909251] __Latex__ @@ -1626,10 +1524,14 @@ latex = af.text.Samples.latex( print(latex) ``` - Example Prefix $x^{\rm{g}} = 50.14^{+19035565111885748.00}_{-646866592471125888.00}$ & $norm^{\rm{g}} = 8.73^{+876330725.60}_{-8.73}$ & $\sigma^{\rm{g}} = 10.80^{+1954631025976492.25}_{-66506714496663272.00}$ & $x^{\rm{e}} = 50.10^{+106.98}_{-0.50}$ & $norm^{\rm{e}} = 51.74^{+2.33}_{-51.37}$ & $\lambda^{\rm{e}} = 0.06^{+1.09}_{-0.01}$ \[-2pt] + Example Prefix $x^{\rm{g}} = 50.12^{+43.05}_{-13.92}$ & $norm^{\rm{g}} = 41.40^{+50.46}_{-41.40}$ & $\sigma^{\rm{g}} = 14.14^{+44.61}_{-8.01}$ & $x^{\rm{e}} = 49.84^{+0.97}_{-40.91}$ & $norm^{\rm{e}} = 29.09^{+23.51}_{-28.84}$ & $\lambda^{\rm{e}} = 0.06^{+3.84}_{-0.04}$ \[-2pt] + +__Wrap Up__ -Finish. +This tutorial showed how to inspect the results of a model-fit: the maximum log likelihood instance, the full set of +samples, parameter estimates with errors at a given confidence, and how to output quantities to a LaTeX table. These +tools are the foundation for interpreting every model-fit you perform with **PyAutoFit**. ```python diff --git a/markdown/chapter_1_introduction/tutorial_5_results_and_samples_files/tutorial_5_results_and_samples_27_0.png b/markdown/chapter_1_introduction/tutorial_5_results_and_samples_files/tutorial_5_results_and_samples_27_0.png index 4660c06..46d8889 100644 Binary files a/markdown/chapter_1_introduction/tutorial_5_results_and_samples_files/tutorial_5_results_and_samples_27_0.png and b/markdown/chapter_1_introduction/tutorial_5_results_and_samples_files/tutorial_5_results_and_samples_27_0.png differ diff --git a/markdown/chapter_1_introduction/tutorial_5_results_and_samples_files/tutorial_5_results_and_samples_33_15.png b/markdown/chapter_1_introduction/tutorial_5_results_and_samples_files/tutorial_5_results_and_samples_33_15.png deleted file mode 100644 index 44d7091..0000000 Binary files a/markdown/chapter_1_introduction/tutorial_5_results_and_samples_files/tutorial_5_results_and_samples_33_15.png and /dev/null differ diff --git a/markdown/chapter_1_introduction/tutorial_5_results_and_samples_files/tutorial_5_results_and_samples_33_5.png b/markdown/chapter_1_introduction/tutorial_5_results_and_samples_files/tutorial_5_results_and_samples_33_5.png new file mode 100644 index 0000000..689c400 Binary files /dev/null and b/markdown/chapter_1_introduction/tutorial_5_results_and_samples_files/tutorial_5_results_and_samples_33_5.png differ