From 8b009db1f1c13366706ba68089b5ad90f3c00425 Mon Sep 17 00:00:00 2001 From: hstewart93 Date: Mon, 1 Jul 2024 14:38:21 +0100 Subject: [PATCH] update readme. --- README.md | 1 + continunet/finder.py | 5 +++-- continunet/image/processing.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a969115..baa7dab 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # ContinUNet [![Pytest](https://github.com/hstewart93/continunet/actions/workflows/pytest.yml/badge.svg)](https://github.com/hstewart93/continunet/actions/workflows/pytest.yml) + Source finding package for radio continuum data powered by U-Net segmentation algorithm. ## Installation diff --git a/continunet/finder.py b/continunet/finder.py index 06e471f..fc4a56d 100644 --- a/continunet/finder.py +++ b/continunet/finder.py @@ -31,6 +31,7 @@ def __init__(self, image: str, layers: int = 4): if layers != 4: raise ValueError("Number of layers must be 4.") self.layers = layers + self.image_object = None self.sources = None self.reconstructed_image = None self.post_processor = None @@ -43,10 +44,10 @@ def find(self, generate_maps=False, use_raw=False): """Find sources in a continuum image.""" start_time = time.time() # Load image - image_object = ImageSquare(self.image) + self.image_object = ImageSquare(self.image) # Pre-process image - pre_processor = PreProcessor(image_object, self.layers) + pre_processor = PreProcessor(self.image_object, self.layers) data = pre_processor.process() # Run U-Net diff --git a/continunet/image/processing.py b/continunet/image/processing.py index 3941708..7cd296f 100644 --- a/continunet/image/processing.py +++ b/continunet/image/processing.py @@ -325,6 +325,7 @@ def get_model_map(self, use_raw=False): def get_residuals(self, use_raw=False): """Calculate the residuals from the input image and the model map.""" - self.get_model_map(use_raw) + if self.model_map is None: + self.get_model_map(use_raw) self.residuals = self.cutout_object.data - self.model_map return self.residuals