diff --git a/tools/extra_galaxies_centres_gui.py b/tools/extra_galaxies_centres_gui.py index b76f4b1..9fac412 100644 --- a/tools/extra_galaxies_centres_gui.py +++ b/tools/extra_galaxies_centres_gui.py @@ -161,7 +161,7 @@ info = {} -if os.path.exists(dataset_main_path / "info.json"): +if Path(dataset_main_path / "info.json").exists(): try: with open(dataset_main_path / "info.json") as json_file: info = json.load(json_file) diff --git a/tools/psf_size.py b/tools/psf_size.py index 352a95a..7e3d043 100644 --- a/tools/psf_size.py +++ b/tools/psf_size.py @@ -19,10 +19,10 @@ import os import json -from os import path import autolens as al import autolens.plot as aplt import numpy as np +from pathlib import Path """ __Dataset__ @@ -32,10 +32,10 @@ """ dataset_name = "102019586_NEG564463213499964061" -dataset_path = path.join("dataset", dataset_name) +dataset_path = Path("dataset") / dataset_name psf_full = al.Convolver.from_fits( - file_path=path.join(dataset_path, "psf_full.fits"), hdu=0, pixel_scales=0.1 + file_path=Path(dataset_path) / "psf_full.fits", hdu=0, pixel_scales=0.1 ) print("PSF Shape Before Trimming:") @@ -48,7 +48,7 @@ psf = psf_full.resized_from(new_shape=new_shape) -psf.output_to_fits(file_path=path.join(dataset_path, "psf.fits"), overwrite=True) +psf.output_to_fits(file_path=Path(dataset_path) / "psf.fits", overwrite=True) """ diff --git a/workflow/csv_make.py b/workflow/csv_make.py index 80239d6..49da52e 100644 --- a/workflow/csv_make.py +++ b/workflow/csv_make.py @@ -43,7 +43,6 @@ # print(f"Working Directory has been set to `{workspace_path}`") from pathlib import Path -from os import path import autofit as af import autolens as al @@ -89,7 +88,7 @@ """ from autofit.aggregator.aggregator import Aggregator -agg = Aggregator.from_directory(directory=path.join("output"), completed_only=True) +agg = Aggregator.from_directory(directory=Path("output"), completed_only=True) """ Use a query on the aggregator to only get results for the `mass_total[1]` model-fit, which contains the final lens diff --git a/workflow/example/csv/lens_mass.py b/workflow/example/csv/lens_mass.py index 3a43c39..5f2f906 100644 --- a/workflow/example/csv/lens_mass.py +++ b/workflow/example/csv/lens_mass.py @@ -16,7 +16,6 @@ # print(f"Working Directory has been set to `{workspace_path}`") from pathlib import Path -from os import path import autofit as af import autolens as al @@ -64,7 +63,7 @@ """ from autofit.aggregator.aggregator import Aggregator -agg = Aggregator.from_directory(directory=path.join("output"), completed_only=True) +agg = Aggregator.from_directory(directory=Path("output"), completed_only=True) """ Use a query on the aggregator to only get results for the `mass_total[1]` model-fit, which contains the final lens diff --git a/workflow/example/csv/magnitudes.py b/workflow/example/csv/magnitudes.py index aaf37a2..3a98a14 100644 --- a/workflow/example/csv/magnitudes.py +++ b/workflow/example/csv/magnitudes.py @@ -16,7 +16,6 @@ # print(f"Working Directory has been set to `{workspace_path}`") from pathlib import Path -from os import path import autofit as af import autolens as al @@ -64,7 +63,7 @@ """ from autofit.aggregator.aggregator import Aggregator -agg = Aggregator.from_directory(directory=path.join("output"), completed_only=True) +agg = Aggregator.from_directory(directory=Path("output"), completed_only=True) """ Use a query on the aggregator to only get results for the `mass_total[1]` model-fit, which contains the final lens diff --git a/workflow/example/png/mge_inspect.py b/workflow/example/png/mge_inspect.py index 15ae203..7c78511 100644 --- a/workflow/example/png/mge_inspect.py +++ b/workflow/example/png/mge_inspect.py @@ -19,7 +19,6 @@ # print(f"Working Directory has been set to `{workspace_path}`") from pathlib import Path -from os import path import autofit as af import autolens as al @@ -65,7 +64,7 @@ """ from autofit.aggregator.aggregator import Aggregator -agg = Aggregator.from_directory(directory=path.join("output"), completed_only=True) +agg = Aggregator.from_directory(directory=Path("output"), completed_only=True) """ Use a query on the aggregator to only get results for the `mass_total[1]` model-fit, which contains the final lens diff --git a/workflow/fits_make.py b/workflow/fits_make.py index 3ff1d51..b66b5e2 100644 --- a/workflow/fits_make.py +++ b/workflow/fits_make.py @@ -46,7 +46,6 @@ # %cd $workspace_path # print(f"Working Directory has been set to `{workspace_path}`") -from os import path from pathlib import Path import autofit as af @@ -93,7 +92,7 @@ """ from autofit.aggregator.aggregator import Aggregator -agg = Aggregator.from_directory(directory=path.join("output"), completed_only=True) +agg = Aggregator.from_directory(directory=Path("output"), completed_only=True) """ Use a query on the aggregator to only get results for the `mass_total[1]` model-fit, which contains the final lens @@ -195,7 +194,7 @@ When we add a single .png, we cannot extract or make it, it simply gets added to the subplot. """ -# image_rgb = Image.open(path.join(dataset_path, "rgb.png")) +# image_rgb = Image.open(Path(dataset_path) / "rgb.png") # # image = agg_fits.extract_fits( # al.agg.subplot_dataset.data, diff --git a/workflow/png_make.py b/workflow/png_make.py index 9eeaae5..bcb5c7c 100644 --- a/workflow/png_make.py +++ b/workflow/png_make.py @@ -49,7 +49,6 @@ # print(f"Working Directory has been set to `{workspace_path}`") from pathlib import Path -from os import path import autofit as af import autolens as al @@ -95,7 +94,7 @@ """ from autofit.aggregator.aggregator import Aggregator -agg = Aggregator.from_directory(directory=path.join("output"), completed_only=True) +agg = Aggregator.from_directory(directory=Path("output"), completed_only=True) """ Use a query on the aggregator to only get results for the `mass_total[1]` model-fit, which contains the final lens