diff --git a/notebooks/chapter_1_introduction/tutorial_4_why_modeling_is_hard.ipynb b/notebooks/chapter_1_introduction/tutorial_4_why_modeling_is_hard.ipynb index 1700b37..45d83bc 100644 --- a/notebooks/chapter_1_introduction/tutorial_4_why_modeling_is_hard.ipynb +++ b/notebooks/chapter_1_introduction/tutorial_4_why_modeling_is_hard.ipynb @@ -623,7 +623,7 @@ "plt.plot(xvalues, normalized_residual_map, color=\"k\")\n", "plt.title(f\"Normalized Residuals (log likelihood = {result.log_likelihood})\")\n", "plt.xlabel(\"x values of profile\")\n", - "plt.ylabel(\"Normalized Residuals ($\\sigma$)\")\n", + "plt.ylabel(r\"Normalized Residuals ($\\sigma$)\")\n", "plt.show()\n", "plt.clf()\n", "plt.close()" @@ -834,7 +834,7 @@ "plt.plot(xvalues, normalized_residual_map, color=\"k\")\n", "plt.title(f\"Normalized Residuals (log likelihood = {result.log_likelihood})\")\n", "plt.xlabel(\"x values of profile\")\n", - "plt.ylabel(\"Normalized Residuals ($\\sigma$)\")\n", + "plt.ylabel(r\"Normalized Residuals ($\\sigma$)\")\n", "plt.show()\n", "plt.clf()\n", "plt.close()" @@ -986,7 +986,7 @@ "plt.plot(xvalues, normalized_residual_map, color=\"k\")\n", "plt.title(f\"Normalized Residuals (log likelihood = {result.log_likelihood})\")\n", "plt.xlabel(\"x values of profile\")\n", - "plt.ylabel(\"Normalized Residuals ($\\sigma$)\")\n", + "plt.ylabel(r\"Normalized Residuals ($\\sigma$)\")\n", "plt.show()\n", "plt.clf()\n", "plt.close()" @@ -1148,7 +1148,7 @@ "plt.plot(xvalues, normalized_residual_map, color=\"k\")\n", "plt.title(f\"Normalized Residuals (log likelihood = {result.log_likelihood})\")\n", "plt.xlabel(\"x values of profile\")\n", - "plt.ylabel(\"Normalized Residuals ($\\sigma$)\")\n", + "plt.ylabel(r\"Normalized Residuals ($\\sigma$)\")\n", "plt.show()\n", "plt.clf()\n", "plt.close()" diff --git a/scripts/chapter_1_introduction/tutorial_1_models.py b/scripts/chapter_1_introduction/tutorial_1_models.py index ee92d05..815e4a5 100644 --- a/scripts/chapter_1_introduction/tutorial_1_models.py +++ b/scripts/chapter_1_introduction/tutorial_1_models.py @@ -76,7 +76,7 @@ import autofit as af -""" +r""" __Paths__ PyAutoFit assumes the current working directory is /path/to/HowToFit/ on your hard-disk (or in Colab). @@ -288,7 +288,7 @@ def model_data_from(self, xvalues: np.ndarray) -> np.ndarray: plt.show() plt.clf() -""" +r""" __Complex Models__ The code above may seem like a lot of steps just to create an instance of the `Gaussian` class. Couldn't we have diff --git a/scripts/chapter_1_introduction/tutorial_2_fitting_data.py b/scripts/chapter_1_introduction/tutorial_2_fitting_data.py index 4be9b87..7ae5250 100644 --- a/scripts/chapter_1_introduction/tutorial_2_fitting_data.py +++ b/scripts/chapter_1_introduction/tutorial_2_fitting_data.py @@ -286,7 +286,7 @@ def model_data_from(self, xvalues: np.ndarray) -> np.ndarray: plt.show() plt.clf() -""" +r""" __Normalized Residuals__ Another method to quantify and visualize the quality of the fit is using the normalized residual map, also known as @@ -312,7 +312,7 @@ def model_data_from(self, xvalues: np.ndarray) -> np.ndarray: plt.show() plt.clf() -""" +r""" __Chi Squared__ Next, we define the `chi_squared_map`, which is obtained by squaring the `normalized_residual_map` and serves as a @@ -335,7 +335,7 @@ def model_data_from(self, xvalues: np.ndarray) -> np.ndarray: plt.show() plt.clf() -""" +r""" Now, we consolidate all the information in our `chi_squared_map` into a single measure of goodness-of-fit called `chi_squared`. @@ -350,7 +350,7 @@ def model_data_from(self, xvalues: np.ndarray) -> np.ndarray: chi_squared = np.sum(chi_squared_map) print("Chi-squared = ", chi_squared) -""" +r""" The lower the `chi_squared`, the fewer residuals exist between the model's fit and the data, indicating a better overall fit! @@ -375,7 +375,7 @@ def model_data_from(self, xvalues: np.ndarray) -> np.ndarray: """ noise_normalization = np.sum(np.log(2 * np.pi * noise_map**2.0)) -""" +r""" __Likelihood__ From the `chi_squared` and `noise_normalization`, we can define a final goodness-of-fit measure known as diff --git a/scripts/chapter_1_introduction/tutorial_3_non_linear_search.py b/scripts/chapter_1_introduction/tutorial_3_non_linear_search.py index 316dd78..b4b7bf3 100644 --- a/scripts/chapter_1_introduction/tutorial_3_non_linear_search.py +++ b/scripts/chapter_1_introduction/tutorial_3_non_linear_search.py @@ -1,4 +1,4 @@ -""" +r""" Tutorial 3: Non Linear Search ============================= diff --git a/scripts/chapter_1_introduction/tutorial_4_why_modeling_is_hard.py b/scripts/chapter_1_introduction/tutorial_4_why_modeling_is_hard.py index 88d2b84..03bb035 100644 --- a/scripts/chapter_1_introduction/tutorial_4_why_modeling_is_hard.py +++ b/scripts/chapter_1_introduction/tutorial_4_why_modeling_is_hard.py @@ -434,7 +434,7 @@ def model_data_from_instance(self, instance): plt.plot(xvalues, normalized_residual_map, color="k") plt.title(f"Normalized Residuals (log likelihood = {result.log_likelihood})") plt.xlabel("x values of profile") -plt.ylabel("Normalized Residuals ($\sigma$)") +plt.ylabel(r"Normalized Residuals ($\sigma$)") plt.show() plt.clf() plt.close() @@ -601,7 +601,7 @@ def model_data_from_instance(self, instance): plt.plot(xvalues, normalized_residual_map, color="k") plt.title(f"Normalized Residuals (log likelihood = {result.log_likelihood})") plt.xlabel("x values of profile") -plt.ylabel("Normalized Residuals ($\sigma$)") +plt.ylabel(r"Normalized Residuals ($\sigma$)") plt.show() plt.clf() plt.close() @@ -709,7 +709,7 @@ def model_data_from_instance(self, instance): plt.plot(xvalues, normalized_residual_map, color="k") plt.title(f"Normalized Residuals (log likelihood = {result.log_likelihood})") plt.xlabel("x values of profile") -plt.ylabel("Normalized Residuals ($\sigma$)") +plt.ylabel(r"Normalized Residuals ($\sigma$)") plt.show() plt.clf() plt.close() @@ -817,12 +817,12 @@ def model_data_from_instance(self, instance): plt.plot(xvalues, normalized_residual_map, color="k") plt.title(f"Normalized Residuals (log likelihood = {result.log_likelihood})") plt.xlabel("x values of profile") -plt.ylabel("Normalized Residuals ($\sigma$)") +plt.ylabel(r"Normalized Residuals ($\sigma$)") plt.show() plt.clf() plt.close() -""" +r""" If you repeat the fit multiple times, you will find that the model-fit is more likely to produce a good fit than previously.