Comet profile#

Important

under construction

from prose import Sequence, FITSImage, blocks

image = FITSImage(
    "/Users/lgrcia/data/0073P/0073P/TRAPPS.2022-08-22T23_35_35.490_calibrated.fits"
)

s = Sequence(
    [
        blocks.Trim((20, 20)),  # trimming
        blocks.AutoSourceDetection(threshold=7),  # detection of all sources
        blocks.CentroidGaussian2D(cutout=31),
    ]
)

s.run(image, show_progress=False)
image.show()
../../_images/8c02f6910ed48a3987c4f338757603ced05c700812ebb33aa3caa949bc466fa9.png
from prose.core import source
import numpy as np

# finding the comet, extended object with largest area
area = [s.area if isinstance(s, source.ExtendedSource) else 0 for s in image.sources]
i = int(np.argmax(area))
print(i)
29
import matplotlib.pyplot as plt

plt.figure(figsize=(5, 6))

ax = plt.subplot(211, title="comet cutout")
cutout = image.cutout(image.sources[i].coords, (50, 100))
comet = cutout.sources[0]
cutout.show(sources=False, ax=ax)
plt.axline(*comet.vertexes, alpha=0.2, c="w")
plt.axline(*comet.co_vertexes, alpha=0.2, c="w")

ax2 = plt.subplot(212, xlabel="pixels", ylabel="ADU", title="major profile")
ax2.plot(*cutout._major_profile(comet))
plt.tight_layout()
../../_images/c087c67f2ddbb2dc8ab6bce81647873c914c25a909210d9fe0e49ce3ee4b41c8.png
ax = plt.subplot(111, xlabel="pixels", ylabel="ADU", title="symetric profile")
ax.plot(*cutout._symetric_profile(cutout.sources[0]))
[<matplotlib.lines.Line2D at 0x294e6a460>]
../../_images/70ebaa0ecab15abbc43e897f73e19971de425bba0119d896b8cacf19b0f72c5b.png