6161- **Chapter Wrap Up**: Summarize the completion of Chapter 1 and its applications to real astronomy.
6262"""
6363
64- # from autoconf import setup_notebook; setup_notebook()
64+ # from autoconf import setup_notebook; setup_notebook()
6565
66- from os import path
6766import numpy as np
6867import matplotlib .pyplot as plt
6968from scipy import signal
@@ -109,15 +108,15 @@ def plot_grid(grid, title=None):
109108The noise-map has a few strange off-centre features which are an artefact of the telescope. Don't worry about these
110109features.
111110"""
112- dataset_path = path . join ("dataset" , "howtofit" , "chapter_1" , "astro" , "simple" )
111+ dataset_path = Path ("dataset" ) / "howtofit" / "chapter_1" / "astro" / "simple"
113112
114113"""
115114__Dataset Auto-Simulation__
116115
117116If the dataset does not already exist on your system, it will be created by running the corresponding
118117simulator script. This ensures that all example scripts can be run without manually simulating data first.
119118"""
120- if not path .exists (dataset_path ):
119+ if not Path ( dataset_path ) .exists ():
121120 import subprocess
122121 import sys
123122
@@ -126,10 +125,10 @@ def plot_grid(grid, title=None):
126125 check = True ,
127126 )
128127
129- data = np .load (file = path . join (dataset_path , "data.npy" ) )
128+ data = np .load (file = Path (dataset_path ) / "data.npy" )
130129plot_array (array = data , title = "Image of Galaxy" )
131130
132- noise_map = np .load (file = path . join (dataset_path , "noise_map.npy" ) )
131+ noise_map = np .load (file = Path (dataset_path ) / "noise_map.npy" )
133132plot_array (array = noise_map , title = "Noise Map of Galaxy" )
134133
135134"""
@@ -143,7 +142,7 @@ def plot_grid(grid, title=None):
143142We load and plot the mask below to show you how it is applied to the data, and we will use it in
144143the `log_likelihood_function` below to ensure these regions are not fitted.
145144"""
146- mask = np .load (file = path . join (dataset_path , "mask.npy" ) )
145+ mask = np .load (file = Path (dataset_path ) / "mask.npy" )
147146plot_array (array = mask , title = "Mask of Galaxy" )
148147
149148"""
@@ -160,7 +159,7 @@ def plot_grid(grid, title=None):
160159When fitting the data and in the `log_likelihood_function` below, the PSF is used to create the model data. This
161160demonstrates how an `Analysis` class can be extended to include additional steps in the model fitting process.
162161"""
163- psf = np .load (file = path . join (dataset_path , "psf.npy" ) )
162+ psf = np .load (file = Path (dataset_path ) / "psf.npy" )
164163plot_array (array = psf , title = "Point Spread Function of Galaxy ?" )
165164
166165"""
@@ -174,7 +173,7 @@ def plot_grid(grid, title=None):
174173This grid includes only (y,x) coordinates within the circular mask applied to the data, as we only need to perform
175174calculations within this masked region.
176175"""
177- grid = np .load (file = path . join (dataset_path , "grid.npy" ) )
176+ grid = np .load (file = Path (dataset_path ) / "grid.npy" )
178177
179178plot_grid (
180179 grid = grid ,
@@ -779,6 +778,7 @@ def model_data_from_instance(self, instance):
779778
780779This illustrates why we perform model-fitting, we can take complex data and infer simple, interpretable properties
781780from it which provide insight into the physical processes generating the data. This is the core goal of the scientific
781+ from pathlib import Path
782782method and the use of models to explain observations.
783783"""
784784print (result .info )
0 commit comments