Skip to content

Commit 6779e06

Browse files
Jammy2211Jammy2211claude
authored
docs(tutorial_5): correct stale parameter-filtering prose (#25)
The tutorial fits a two-component model (Gaussian + Exponential, 6 parameters), but the without_paths section still claimed that removing gaussian.centre leaves '2 parameters; the normalization and sigma' — text left over from when this tutorial fitted a Gaussian alone. The run prints 5 values. without_paths was always correct; the prose was not. Also in the same section: - 'in-profile_1d with the PyAutoFIT API' -> 'in-line with the PyAutoFit API' (a bad find/replace of 'line' -> 'profile_1d'; only occurrence) - closed an unclosed parenthesis in a print label Verified: script exits 0, printed counts now match the prose. Notebook regenerated. Co-authored-by: Jammy2211 <JNightingale2211@gmail.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent fcedb6b commit 6779e06

2 files changed

Lines changed: 16 additions & 8 deletions

File tree

notebooks/chapter_1_introduction/tutorial_5_results_and_samples.ipynb

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@
912912
"\n",
913913
"samples = samples.with_paths([(\"gaussian\", \"centre\")])\n",
914914
"\n",
915-
"print(\"All parameters of the very first sample (containing only the Gaussian centre.\")\n",
915+
"print(\"All parameters of the very first sample (containing only the Gaussian centre).\")\n",
916916
"print(samples.parameter_lists[0])\n",
917917
"\n",
918918
"print(\"Maximum Log Likelihood Model Instances (containing only the Gaussian centre):\\n\")\n",
@@ -928,7 +928,7 @@
928928
"Above, we specified each path as a list of tuples of strings. \n",
929929
"\n",
930930
"This is how the source code internally stores the path to different components of the model, but it is not \n",
931-
"in-profile_1d with the PyAutoFIT API used to compose a model.\n",
931+
"in-line with the PyAutoFit API used to compose a model.\n",
932932
"\n",
933933
"We can alternatively use the following API:"
934934
]
@@ -954,7 +954,11 @@
954954
"Above, we filtered the `Samples` but asking for all parameters which included the path (\"gaussian\", \"centre\").\n",
955955
"\n",
956956
"We can alternatively filter the `Samples` object by removing all parameters with a certain path. Below, we remove\n",
957-
"the Gaussian's `centre` to be left with 2 parameters; the `normalization` and `sigma`."
957+
"the Gaussian's `centre`.\n",
958+
"\n",
959+
"Recall that the model fitted in this tutorial has two components, a `Gaussian` and an `Exponential`, and therefore\n",
960+
"6 parameters in total. Removing one of them therefore leaves us with 5 parameters: the Gaussian's `normalization`\n",
961+
"and `sigma`, plus all three of the Exponential's parameters."
958962
]
959963
},
960964
{
@@ -972,7 +976,7 @@
972976
"samples = samples.without_paths([\"gaussian.centre\"])\n",
973977
"\n",
974978
"print(\n",
975-
" \"All parameters of the very first sample (containing only the Gaussian normalization and sigma).\"\n",
979+
" \"All parameters of the very first sample (with the Gaussian centre removed).\"\n",
976980
")\n",
977981
"print(samples.parameter_lists[0])"
978982
],

scripts/chapter_1_introduction/tutorial_5_results_and_samples.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ def model_data_from(self, xvalues: np.ndarray):
626626

627627
samples = samples.with_paths([("gaussian", "centre")])
628628

629-
print("All parameters of the very first sample (containing only the Gaussian centre.")
629+
print("All parameters of the very first sample (containing only the Gaussian centre).")
630630
print(samples.parameter_lists[0])
631631

632632
print("Maximum Log Likelihood Model Instances (containing only the Gaussian centre):\n")
@@ -636,7 +636,7 @@ def model_data_from(self, xvalues: np.ndarray):
636636
Above, we specified each path as a list of tuples of strings.
637637
638638
This is how the source code internally stores the path to different components of the model, but it is not
639-
in-profile_1d with the PyAutoFIT API used to compose a model.
639+
in-line with the PyAutoFit API used to compose a model.
640640
641641
We can alternatively use the following API:
642642
"""
@@ -651,7 +651,11 @@ def model_data_from(self, xvalues: np.ndarray):
651651
Above, we filtered the `Samples` but asking for all parameters which included the path ("gaussian", "centre").
652652
653653
We can alternatively filter the `Samples` object by removing all parameters with a certain path. Below, we remove
654-
the Gaussian's `centre` to be left with 2 parameters; the `normalization` and `sigma`.
654+
the Gaussian's `centre`.
655+
656+
Recall that the model fitted in this tutorial has two components, a `Gaussian` and an `Exponential`, and therefore
657+
6 parameters in total. Removing one of them therefore leaves us with 5 parameters: the Gaussian's `normalization`
658+
and `sigma`, plus all three of the Exponential's parameters.
655659
"""
656660
samples = result.samples
657661

@@ -664,7 +668,7 @@ def model_data_from(self, xvalues: np.ndarray):
664668
samples = samples.without_paths(["gaussian.centre"])
665669

666670
print(
667-
"All parameters of the very first sample (containing only the Gaussian normalization and sigma)."
671+
"All parameters of the very first sample (with the Gaussian centre removed)."
668672
)
669673
print(samples.parameter_lists[0])
670674

0 commit comments

Comments
 (0)