diff --git a/README.md b/README.md index 6460cc69..0636c3cd 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@

- *prose* is a Python package to build image processing pipelines for Astronomy. Beyond featuring the blocks to build pipelines from scratch, it provides pre-implemented ones to perform common tasks such as automated calibration, reduction and photometry. + *prose* is a Python package to build modular image processing pipelines for Astronomy. *powered by [astropy](https://www.astropy.org/) and [photutils](https://photutils.readthedocs.io)*! diff --git a/docs/index.md b/docs/index.md index c22cb5d9..a5025192 100644 --- a/docs/index.md +++ b/docs/index.md @@ -11,7 +11,7 @@ sd_hide_title: true +++ -A Python package to build image processing pipelines for Astronomy. Beyond featuring the blocks to build pipelines from scratch, it provides pre-implemented ones to perform common tasks such as automated calibration, reduction and photometry. +A Python package to build modular image processing pipelines for Astronomy. ```{admonition} Where to start? :class: tip diff --git a/docs/md/debug.md b/docs/md/debug.md index 94a0f355..70057365 100644 --- a/docs/md/debug.md +++ b/docs/md/debug.md @@ -2,9 +2,9 @@ Finding why a specific error is thrown when running a [Sequence](prose.Sequence) can be challenging. Here are a few steps to debug a [Sequence](prose.Sequence). -## 1. Find from which block the error come from +## 1. Find from which block the error comes from -The error might be on the [Sequence](prose.Sequence) `_run` function, but scrolling up will reveal in which block the error actually occurs. +The error might be on the [Sequence](prose.Sequence) `_run` function, but scrolling up will reveal in which block the error actually occurs (if not specified). For each block, the documentation (should) contain explanation for each possible exceptions being raised. If not, [open a Github issue](https://github.com/lgrcia/prose/issues/new/choose)! ## 2. Show the last image @@ -41,4 +41,4 @@ for block in sequence.blocks: This way, the error will be thrown on a specific block, and you can track the changes of each of them on your test image -And if you have any question, just [open a github issue](https://github.com/lgrcia/prose/issues/new/choose)! \ No newline at end of file +And if you have any question, just [open a Github issue](https://github.com/lgrcia/prose/issues/new/choose)! \ No newline at end of file diff --git a/prose/blocks/geometry.py b/prose/blocks/geometry.py index b086c035..789ddfa0 100644 --- a/prose/blocks/geometry.py +++ b/prose/blocks/geometry.py @@ -165,9 +165,14 @@ class ComputeTransformTwirl(Block): Parameters ---------- ref : Image - image containing detected sources + Image containing detected sources n : int, optional - number of stars to consider to compute transformation, by default 10 + Number of stars to consider to compute transformation, by default 10 + + Raises + ------ + SingularMatrix + Transformation matrix could not be computed. Check the sources in both the reference and input image. """ def __init__(self, reference_image: Image, n=10, rtol=0.02, **kwargs): diff --git a/prose/core/block.py b/prose/core/block.py index 246197c8..3db0f840 100644 --- a/prose/core/block.py +++ b/prose/core/block.py @@ -5,6 +5,21 @@ from prose.console_utils import warning from prose.core.image import Buffer, Image +import contextlib + + +@contextlib.contextmanager +def _exception_context(msg): + try: + yield + except Exception as ex: + if ex.args: + msg = f"[{msg}] {ex.args[0]}" + else: + str(msg) + ex.args = (msg,) + ex.args[1:] + raise + class Block(object): """Single unit of processing acting on the :py:class:`~prose.Image` object @@ -71,8 +86,9 @@ def _run(self, buffer): image = buffer else: raise ValueError("block must be run on a Buffer or an Image") - self._check_require(image) - self.run(image) + with _exception_context(self.__class__.__name__): + self._check_require(image) + self.run(image) self.processing_time += time() - t0 self.runs += 1 diff --git a/prose/fluxes.py b/prose/fluxes.py index 71827614..69a16142 100644 --- a/prose/fluxes.py +++ b/prose/fluxes.py @@ -496,6 +496,8 @@ def mask(self, array): _new.errors = self.errors[..., array] if self.time is not None: _new.time = self.time[array] + if self.apertures is not None: + _new.apertures = self.apertures[array, ...] return _new diff --git a/pyproject.toml b/pyproject.toml index f46ece5d..dc8000a3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "prose" -version = "3.2.6" +version = "3.2.7" description = "Modular image processing pipelines for Astronomy" authors = ["Lionel Garcia"] license = "MIT"