Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llms-full.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ AUTO-GENERATED by PyAutoHands — do not edit by hand; regenerate with generate.
- [Tutorial 3: Why Modeling Is Hard](scripts/chapter_2_lens_modeling/tutorial_3_why_modeling_is_hard.py): We now have the tools to build a lens model, run a search and inspect its results. However, a search finishing does not necessarily mean that it has found a satisfactory fit.
- Contents: Overview, Dataset and Mask, Model and Analysis, A Less Thorough Search, Inspecting the Result, Comparing Searches, Why Modeling Is Hard, Three Ways Forward, Prior Tuning, Profile Centres, Lens-Light Shape, Mass Shape, Lens-Light Size, Light Concentration, Einstein Radius, Source and Shear Priors, Inspecting the Tuned Model, Prior-Tuned Fit, Assessing the Improvement, Prior Tuning: Benefits and Limitations, Reducing Complexity, Linking Parameters, Inspecting the Simpler Model, Fitting the Simpler Model, Reducing Complexity: Benefits and Limitations, Search More Thoroughly, Original Model, More Thorough Search, Comparing the Approaches, Benefits and Weaknesses, Run Times, Model Mismatch, Wrap Up
- [Tutorial 4: Linear Profiles](scripts/chapter_2_lens_modeling/tutorial_4_linear_profiles.py): In the previous tutorial, we made a lens model easier to fit by tuning priors, linking parameters or searching more thoroughly. Each approach involved a trade-off between flexibility, assumptions and computation.
- Contents: Overview, Dataset and Mask, Linear Light Profiles, Why This Helps, Model, Search and Run Time, Result, Intensities, Visualisation, Basis, A First Gaussian Basis, Evaluating the Basis, Inspecting the Basis Fit, Lens MGE, Source MGE, Combined Model, Inspecting the Model, Model Fit, Multi-Gaussian Expansion Benefits, Benefits Have Costs, Positive Intensities, Other Basis Functions, Wrap Up
- Contents: Overview, Dataset and Mask, Linear Light Profiles, Why This Helps, Model, Search and Run Time, Result, Intensities, Visualisation, Basis, A First Gaussian Basis, Evaluating the Basis, Inspecting the Basis Fit, Lens MGE, Source MGE, Combined Model, Inspecting the Model, Model Fit, Result, Multi-Gaussian Expansion Benefits, Benefits Have Costs, Positive Intensities, Other Basis Functions, Wrap Up
- [Tutorial 6: Masking and Positions](scripts/chapter_2_lens_modeling/tutorial_6_masking_and_positions.py): We have learnt everything we need to know about non-linear searches to model a strong lens and infer a good lens model solution. Now, lets consider masking in more detail, something we have not given much consideration previously. We'll also learn a neat trick to improve the speed and accuracy of a non-linear search.
- Contents: Initial Setup, Dataset Auto-Simulation, Mask, Model + Analysis, Run Time, Search, Discussion, Positions Thresholding, Wrap Up
- [Tutorial 7: Results](scripts/chapter_2_lens_modeling/tutorial_7_results.py): In the previous tutorials, each search returned a `Result` object, which we used to plot the maximum log likelihood fit each model-fit. In this tutorial, we'll take a look at the result object in a little more detail.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,24 @@
"\n",
"__Contents__\n",
"\n",
"- **Overview**\n",
"- **Parameter Space**\n",
"- **Automated Exploration**\n",
"- **Deeper Background**\n",
"- **PyAutoFit**\n",
"- **Initial Setup**\n",
"- **Dataset Auto-Simulation**\n",
"- **Mask**\n",
"- **Model**\n",
"- **Priors**\n",
"- **Analysis**\n",
"- **Non-linear Search**\n",
"- **Search Settings**\n",
"- **Model Fit**\n",
"- **Result**\n",
"- **Inspecting the Fit**\n",
"- **Other Searches**\n",
"- **Wrap Up**"
"- **Overview:** Introduce the experiment and the results to inspect.\n",
"- **Parameter Space:** Understand how free parameters define the models a search can explore.\n",
"- **Automated Exploration:** Use a non-linear search to explore possible model parameters.\n",
"- **Deeper Background:** Find further explanations of likelihoods and Bayesian inference.\n",
"- **PyAutoFit:** Introduce the tools used to define models, priors and searches.\n",
"- **Initial Setup:** Introduce the simulated imaging dataset.\n",
"- **Dataset Auto-Simulation:** Create missing simulated data and load the imaging files.\n",
"- **Mask:** Select the image pixels used in the fit.\n",
"- **Model:** Define the components and free parameters of the model.\n",
"- **Priors:** Describe the allowed values of each free parameter.\n",
"- **Analysis:** Connect model predictions to the data and evaluate their likelihood.\n",
"- **Non-linear Search:** Introduce the search used to explore the model parameters.\n",
"- **Search Settings:** Choose live-point, batching and output settings.\n",
"- **Model Fit:** Run the search using the model and analysis.\n",
"- **Result:** Inspect the inferred parameters and fitted image.\n",
"- **Inspecting the Fit:** Compare the predicted image with the data and residuals.\n",
"- **Other Searches:** Find the optional optimisation and MCMC examples.\n",
"- **Wrap Up:** Review the lesson and its connection to the next topic."
]
},
{
Expand Down
42 changes: 21 additions & 21 deletions notebooks/chapter_2_lens_modeling/tutorial_2_practicalities.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,27 @@
"\n",
"__Contents__\n",
"\n",
"- **Dataset**\n",
"- **Mask**\n",
"- **Model**\n",
"- **Analysis**\n",
"- **Search**\n",
"- **Search Settings**\n",
"- **Output Updates**\n",
"- **VRAM Use**\n",
"- **Run Times**\n",
"- **Notebooks and Scripts**\n",
"- **Model Fit**\n",
"- **Result Info**\n",
"- **Output Folder**\n",
"- **Unique Identifier**\n",
"- **Resuming and Loading**\n",
"- **Output Folder Contents**\n",
"- **Parameter Uncertainties**\n",
"- **Plot Labels**\n",
"- **Configuration**\n",
"- **Further Results**\n",
"- **Wrap Up**"
"- **Dataset:** Load and inspect the simulated imaging data.\n",
"- **Mask:** Select the image pixels used in the fit.\n",
"- **Model:** Define the components and free parameters of the model.\n",
"- **Analysis:** Connect model predictions to the data and evaluate their likelihood.\n",
"- **Search:** Configure Nautilus and the location of its saved output.\n",
"- **Search Settings:** Choose live-point, batching and output settings.\n",
"- **Output Updates:** Follow the best-fitting model while the search runs.\n",
"- **VRAM Use:** Estimate memory requirements and adjust the batch size.\n",
"- **Run Times:** Understand the costs that determine how long a fit takes.\n",
"- **Notebooks and Scripts:** Choose how to run a fit and inspect its progress.\n",
"- **Model Fit:** Run the search using the model and analysis.\n",
"- **Result Info:** Read the inferred parameter values and uncertainties.\n",
"- **Output Folder:** Locate saved models, results, figures and search checkpoints.\n",
"- **Unique Identifier:** Understand how model and search settings identify saved fits.\n",
"- **Resuming and Loading:** Resume an interrupted search or load its completed result.\n",
"- **Output Folder Contents:** Inspect the files used to assess and reload a fit.\n",
"- **Parameter Uncertainties:** Read parameter ranges and relationships in corner plots.\n",
"- **Plot Labels:** Interpret abbreviated and latent-parameter labels.\n",
"- **Configuration:** Find the settings controlling searches, plotting and output.\n",
"- **Further Results:** Find the workspace guides for more detailed result analysis.\n",
"- **Wrap Up:** Review the lesson and its connection to the next topic."
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,39 +22,39 @@
"\n",
"__Contents__\n",
"\n",
"- **Overview**\n",
"- **Dataset and Mask**\n",
"- **Model and Analysis**\n",
"- **A Less Thorough Search**\n",
"- **Inspecting the Result**\n",
"- **Comparing Searches**\n",
"- **Why Modeling Is Hard**\n",
"- **Three Ways Forward**\n",
"- **Prior Tuning**\n",
"- **Profile Centres**\n",
"- **Lens-Light Shape**\n",
"- **Mass Shape**\n",
"- **Lens-Light Size**\n",
"- **Light Concentration**\n",
"- **Einstein Radius**\n",
"- **Source and Shear Priors**\n",
"- **Inspecting the Tuned Model**\n",
"- **Prior-Tuned Fit**\n",
"- **Assessing the Improvement**\n",
"- **Prior Tuning: Benefits and Limitations**\n",
"- **Reducing Complexity**\n",
"- **Linking Parameters**\n",
"- **Inspecting the Simpler Model**\n",
"- **Fitting the Simpler Model**\n",
"- **Reducing Complexity: Benefits and Limitations**\n",
"- **Search More Thoroughly**\n",
"- **Original Model**\n",
"- **More Thorough Search**\n",
"- **Comparing the Approaches**\n",
"- **Benefits and Weaknesses**\n",
"- **Run Times**\n",
"- **Model Mismatch**\n",
"- **Wrap Up**"
"- **Overview:** Introduce the experiment and the results to inspect.\n",
"- **Dataset and Mask:** Load the imaging data and select the region to fit.\n",
"- **Model and Analysis:** Reconstruct the reference model and its likelihood calculation.\n",
"- **A Less Thorough Search:** Explore the model with a deliberately small live-point population.\n",
"- **Inspecting the Result:** Inspect the result summary, fitted image and residuals.\n",
"- **Comparing Searches:** Compare the small search with the reference fit.\n",
"- **Why Modeling Is Hard:** Understand why different parameter combinations can explain similar images.\n",
"- **Three Ways Forward:** Introduce prior tuning, simpler models and more thorough searches.\n",
"- **Prior Tuning:** Use the image and justified assumptions to narrow the priors.\n",
"- **Profile Centres:** Use the observed light centre to motivate centre priors.\n",
"- **Lens-Light Shape:** Estimate the lens-light ellipticity from the image.\n",
"- **Mass Shape:** Distinguish an assumed mass shape from the directly observed light.\n",
"- **Lens-Light Size:** Use the visible extent of the light to guide its size prior.\n",
"- **Light Concentration:** Motivate a prior for the Sersic index.\n",
"- **Einstein Radius:** Use the arc separation to guide the Einstein-radius prior.\n",
"- **Source and Shear Priors:** Explain why the source and shear priors remain unchanged.\n",
"- **Inspecting the Tuned Model:** Check the revised priors before fitting.\n",
"- **Prior-Tuned Fit:** Fit the model with the revised priors.\n",
"- **Assessing the Improvement:** Compare the tuned fit with the initial result.\n",
"- **Prior Tuning: Benefits and Limitations:** Assess the benefits and risks of narrowing priors.\n",
"- **Reducing Complexity:** Consider which model parameters could be linked.\n",
"- **Linking Parameters:** Link light and mass centres and elliptical components.\n",
"- **Inspecting the Simpler Model:** Check the reduced number of independent parameters.\n",
"- **Fitting the Simpler Model:** Fit the reduced-complexity model.\n",
"- **Reducing Complexity: Benefits and Limitations:** Balance easier exploration against restrictive assumptions.\n",
"- **Search More Thoroughly:** Return to the original model and give the search more resources.\n",
"- **Original Model:** Restore independent model components and their default priors.\n",
"- **More Thorough Search:** Run the original model with more live points.\n",
"- **Comparing the Approaches:** Compare the fitted images and residuals across experiments.\n",
"- **Benefits and Weaknesses:** Compare the practical trade-offs of the three approaches.\n",
"- **Run Times:** Understand the costs that determine how long a fit takes.\n",
"- **Model Mismatch:** Distinguish insufficient exploration from an inadequate model.\n",
"- **Wrap Up:** Review the lesson and its connection to the next topic."
]
},
{
Expand Down
47 changes: 24 additions & 23 deletions notebooks/chapter_2_lens_modeling/tutorial_4_linear_profiles.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,30 @@
"\n",
"__Contents__\n",
"\n",
"- **Overview**\n",
"- **Dataset and Mask**\n",
"- **Linear Light Profiles**\n",
"- **Why This Helps**\n",
"- **Model**\n",
"- **Search and Run Time**\n",
"- **Result**\n",
"- **Intensities**\n",
"- **Visualisation**\n",
"- **Basis**\n",
"- **A First Gaussian Basis**\n",
"- **Evaluating the Basis**\n",
"- **Inspecting the Basis Fit**\n",
"- **Lens MGE**\n",
"- **Source MGE**\n",
"- **Combined Model**\n",
"- **Inspecting the Model**\n",
"- **Model Fit**\n",
"- **Multi-Gaussian Expansion Benefits**\n",
"- **Benefits Have Costs**\n",
"- **Positive Intensities**\n",
"- **Other Basis Functions**\n",
"- **Wrap Up**"
"- **Overview:** Introduce the experiment and the results to inspect.\n",
"- **Dataset and Mask:** Load the imaging data and select the region to fit.\n",
"- **Linear Light Profiles:** Solve intensities linearly for a given profile geometry.\n",
"- **Why This Helps:** Remove intensities from the non-linear parameter search.\n",
"- **Model:** Define the components and free parameters of the model.\n",
"- **Search and Run Time:** Configure the linear-profile fit and examine its computational cost.\n",
"- **Result:** Inspect the inferred parameters and fitted image.\n",
"- **Intensities:** Retrieve the solved intensities from the fitted profiles.\n",
"- **Visualisation:** Plot profiles with their solved intensities and inspect the fit.\n",
"- **Basis:** Combine Gaussian profiles into a flexible light model.\n",
"- **A First Gaussian Basis:** Build a fixed-geometry Gaussian basis before fitting its shape.\n",
"- **Evaluating the Basis:** Solve the basis intensities at fixed geometry without a new search.\n",
"- **Inspecting the Basis Fit:** Assess the residual structure left by circular Gaussians.\n",
"- **Lens MGE:** Fit shared geometry for the lens galaxy\u2019s Gaussian profiles.\n",
"- **Source MGE:** Give the source an independent Gaussian light model.\n",
"- **Combined Model:** Combine lens light, mass, shear and source light.\n",
"- **Inspecting the Model:** Check the free parameters and linked Gaussian geometry.\n",
"- **Model Fit:** Run the search using the model and analysis.\n",
"- **Result:** Inspect the inferred parameters and fitted image.\n",
"- **Multi-Gaussian Expansion Benefits:** Explain the flexibility gained from Gaussian light profiles.\n",
"- **Benefits Have Costs:** Consider computational cost, interpretation and geometric limits.\n",
"- **Positive Intensities:** Require light profiles to contribute non-negative brightness.\n",
"- **Other Basis Functions:** Find other ways to expand a galaxy\u2019s light distribution.\n",
"- **Wrap Up:** Review the lesson and its connection to the next topic."
]
},
{
Expand Down
37 changes: 19 additions & 18 deletions scripts/chapter_2_lens_modeling/tutorial_1_non_linear_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,25 @@

__Contents__

- **Overview**
- **Parameter Space**
- **Automated Exploration**
- **Deeper Background**
- **PyAutoFit**
- **Initial Setup**
- **Dataset Auto-Simulation**
- **Mask**
- **Model**
- **Priors**
- **Analysis**
- **Non-linear Search**
- **Search Settings**
- **Model Fit**
- **Result**
- **Inspecting the Fit**
- **Other Searches**
- **Wrap Up**
- **Overview:** Introduce the experiment and the results to inspect.
- **Parameter Space:** Understand how free parameters define the models a search can explore.
- **Automated Exploration:** Use a non-linear search to explore possible model parameters.
- **Deeper Background:** Find further explanations of likelihoods and Bayesian inference.
- **PyAutoFit:** Introduce the tools used to define models, priors and searches.
- **Initial Setup:** Introduce the simulated imaging dataset.
- **Dataset Auto-Simulation:** Create missing simulated data and load the imaging files.
- **Mask:** Select the image pixels used in the fit.
- **Model:** Define the components and free parameters of the model.
- **Priors:** Describe the allowed values of each free parameter.
- **Analysis:** Connect model predictions to the data and evaluate their likelihood.
- **Non-linear Search:** Introduce the search used to explore the model parameters.
- **Search Settings:** Choose live-point, batching and output settings.
- **Model Fit:** Run the search using the model and analysis.
- **Result:** Inspect the inferred parameters and fitted image.
- **Inspecting the Fit:** Compare the predicted image with the data and residuals.
- **Other Searches:** Find the optional optimisation and MCMC examples.
- **Wrap Up:** Review the lesson and its connection to the next topic.

"""

"""
Expand Down
43 changes: 22 additions & 21 deletions scripts/chapter_2_lens_modeling/tutorial_2_practicalities.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,28 @@

__Contents__

- **Dataset**
- **Mask**
- **Model**
- **Analysis**
- **Search**
- **Search Settings**
- **Output Updates**
- **VRAM Use**
- **Run Times**
- **Notebooks and Scripts**
- **Model Fit**
- **Result Info**
- **Output Folder**
- **Unique Identifier**
- **Resuming and Loading**
- **Output Folder Contents**
- **Parameter Uncertainties**
- **Plot Labels**
- **Configuration**
- **Further Results**
- **Wrap Up**
- **Dataset:** Load and inspect the simulated imaging data.
- **Mask:** Select the image pixels used in the fit.
- **Model:** Define the components and free parameters of the model.
- **Analysis:** Connect model predictions to the data and evaluate their likelihood.
- **Search:** Configure Nautilus and the location of its saved output.
- **Search Settings:** Choose live-point, batching and output settings.
- **Output Updates:** Follow the best-fitting model while the search runs.
- **VRAM Use:** Estimate memory requirements and adjust the batch size.
- **Run Times:** Understand the costs that determine how long a fit takes.
- **Notebooks and Scripts:** Choose how to run a fit and inspect its progress.
- **Model Fit:** Run the search using the model and analysis.
- **Result Info:** Read the inferred parameter values and uncertainties.
- **Output Folder:** Locate saved models, results, figures and search checkpoints.
- **Unique Identifier:** Understand how model and search settings identify saved fits.
- **Resuming and Loading:** Resume an interrupted search or load its completed result.
- **Output Folder Contents:** Inspect the files used to assess and reload a fit.
- **Parameter Uncertainties:** Read parameter ranges and relationships in corner plots.
- **Plot Labels:** Interpret abbreviated and latent-parameter labels.
- **Configuration:** Find the settings controlling searches, plotting and output.
- **Further Results:** Find the workspace guides for more detailed result analysis.
- **Wrap Up:** Review the lesson and its connection to the next topic.

"""

"""
Expand Down
Loading
Loading