Skip to content

CentroidGaussian2D crashing after AutoSourceDetection #147

@mathvdd

Description

@mathvdd

I have a simple Sequence with AutoSourceDetection followed by CentroidGaussian2D on which I run a cutout of my image centered on the astrometric solution for my moving target. I had the following crash:

[...]
  File "/home/Mathieu/prose/prose/core/sequence.py", line 111, in run
    self._run(loader=loader)
  File "/home/Mathieu/prose/prose/core/sequence.py", line 134, in _run
    block._run(buffer)
  File "/home/Mathieu/prose/prose/core/block.py", line 91, in _run
    self.run(image)
  File "/home/Mathieu/prose/prose/blocks/centroids.py", line 58, in run
    centroid_sources(
  File "/home/Mathieu/anaconda3/lib/python3.9/site-packages/photutils/centroids/core.py", line 391, in centroid_sources
    if (np.any(np.min(xpos) < 0) or np.any(np.min(ypos) < 0)
  File "/home/Mathieu/anaconda3/lib/python3.9/site-packages/numpy/core/fromnumeric.py", line 2953, in min
    return _wrapreduction(a, np.minimum, 'min', axis, None, out,
  File "/home/Mathieu/anaconda3/lib/python3.9/site-packages/numpy/core/fromnumeric.py", line 88, in _wrapreduction
    return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
ValueError: [CentroidGaussian2D] zero-size array to reduction operation minimum which has no identity

It looks like the crash was due to AutoSourceDetection giving a source with coordinates in x = 0. which _PhotutilsCentroid could not handle (it was returning x, y = [],[] in centroid.py line 53.

I solved it by simply modifying line 51 to accept sources with 0. coordinates (b5bca08).

I am not sure as I don't understand completely that part of the code but I don't think this modification affects anything else?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions