Sources#

In prose, objects detected in astronomical images are represented by Source objects. To encompass the large variety of sources encountered in astronomical images, prose fatures three kinds of sources:

To demonstrate how to use these objects, we will work on the following example image:

from prose.simulations import source_example

im = source_example()
_ = im.show()
../_images/3871dbbd7189f04a7cde2b632336da4983300a554c77832250ecc86cdec7e438.png

Detection#

To detect these sources, detection blocks from the prose.blocks.detection module can be used:

from prose import blocks

im = blocks.detection.AutoSourceDetection(min_area=2.0)(im)
_ = im.show()
../_images/38aae4ad5161135e3f41cd2b3bf0c20328b972a74e380918784e2f430fe6ac76.png

Note

Source-specific detection blocks are also available, like the PointSourceDetection, as well as blocks with legacy detection algorithms such as DAOFindStars

From here, sources are located in the Image.sources object

im.sources
array([PointSource(a=7.27731607873119, b=7.13659101541078, orientation=0.2511845824904546, coords=array([24.97294478, 29.9760079 ]), peak=704.7791466048427, i=0, discarded=False),
       ExtendedSource(a=18.90216084088588, b=7.872387025388987, orientation=2.3362100451125793, coords=array([80.02963314, 29.92012386]), peak=606.2406241047279, i=1, discarded=False),
       TraceSource(a=29.271560543180488, b=0.8953476293811246, orientation=0.9288368364077698, coords=array([135.31755481,  30.43770383]), peak=520.144050123536, i=2, discarded=False)],
      dtype=object)

where we can identify the three types of sources, like an extended source at index 1

print(im.sources[1])
⬭ ExtendedSource 1
  ----------------
  coords   80.03   29.92
  a, b     18.90    7.87
  e         0.42

Sources properties#

Such sources contain useful properties and methods used throughout prose to perform image processing.

Apertures#

Apertures from the photutils.aperture module can easily be instantiated from a Source object

import matplotlib.pyplot as plt

source = im.sources[0]
aperture = source.circular_aperture(10, scale=False)

# plotted on top of the image
im.show(sources=False)
_ = aperture.plot(color="y")
../_images/232427814cc7565b57788be0d070f47f10a520e90b720d5e3d5d053e21fe221b.png

For automatic treatments, the Source.aperture method provides an aperture specific to each type of source

im.show(sources=False)

for source in im.sources:
    aperture = source.aperture()
    _ = aperture.plot(color="y")
../_images/35905a7815a3ce27ea245e78c9c718097973fc68c69790354f4a23ed454782dd.png

and associated annulus methods

im.show(sources=False)

for source in im.sources:
    aperture = source.annulus()
    _ = aperture.plot(color="y")
../_images/50fcb74d89f752b8dfa99d697504a04acd7e3537c11b53217c084df2f8c0ef95.png