Jeremy Likness
Jeremy Likness Astrophotographer Jeremy Likness has always been interested in the mysteries of deep space, but only recently began to explore them through astrophotography.
📅February 04, 2023 💬1035 words ⌛4 minutes to read

How do I stack comets in PixInsight?

How do I stack comets in PixInsight?

This post will dive straight into the solution. Everything covered here is shown in the video, How to Process a Comet in PixInsight.

Weighted Batch Preprocessing

This step will calibrate, debayer, star-align and integrate your data. You can also do this manually. If you’re not familiar with calibration, read my quick and dirty intro to calibration frames for astrophotography. If you go the manual route, you’ll do something like this depending on what data you have.

  1. Integrate bias frames to create a master bias per ISO/Gain.
  2. Integrate dark frames for a master dark per exposure and ISO/Gain.
  3. Subtract the master bias from the master dark to calibrate it.
  4. Subtract the calibrated master dark from the dark flats to calibrate them.
  5. Integrate the dark flats into a master dark flat.
  6. Subtract the master dark flat from the flat frames to calibrate them.
  7. Integrate the flat frames into a master flat.
  8. Subtract the master dark from the lights to calibrate them.
  9. Divide the lights by the master flat to calibrate them.
  10. Optionally apply cosmetic calibration to the lights.
  11. Debayer (de-mosaic) the lights.
  12. Star align (register) the lights.
  13. Integrate the the registered lights.

At the end of the process you should have an image with perfect stars but a seriously smeared comet. We’ll call this one star-integrated.

Star extraction

The next step is to steal the stars. The stack came from the star-aligned frames. The resulting stars will align perfectly. We can use that to ignore the stars and focus on what changes, i.e. the data for the comet. If you have StarXTerminator run that and use the option to generate a star image and unscreen the stars. An alternative is to run StarNet++. Save the stars to a fits or xisf and call it stars.

TIP If you notice some of the comet came along for the ride due to its bright core, use the CloneStamp tool to remove it by cloning the background over it. We just want stars here.

Comet alignment

Now you can run the CometAlignment process. The steps here are:

  1. Load the registered frames (these are the same ones that were integrated in the first step).
  2. Click on the nucleus/core of the comet in the first frame. You can either double-click on the first file in the list or use the button to load it, then stretch it and click.
  3. Repeat the step for the comet in the last frame. The alignment tool will use the distance between these two points to compute the comets position in the other frames based on their timestamp. You can also manually update other frames.
  4. Here is the key that most people miss. In the subtract section you can specify the stars file you saved earlier and pick stars aligned as the type. The result is that the stars will be subtracted from each frame, essentially leaving just the comet behind. The residual star “ghosts” will be averaged out by the stacking algorithm. This is how to a void star trails and streaks.
  5. Align!

Comet integration

Now run ImageIntegration on the comet-aligned frames. You should get the comet and some noise along the edges where comet alignment had to crop the frame.

You might be tempted to crop out the noise, but not yet. To finish the integration, we need to put the stars back. Using some simple PixelMath we’ll blend the inverse of the two images and then invert the result. This makes for a smooth integration. If you used something besides stars for your stars file, replace it in the following equation. This equation can be dropped onto the integrated comet (which will serve as the target, or $T in the formula) to integrate the stars.



Now we can process it like any other deep sky object. The process I usually follow is this:

  1. Dynamic Crop
  2. Automatic Background Extraction
  3. Dynamic Background Extraction
  4. ImageSolver if not already plate-solved
  5. SpectrophotometricColorCalibration
  6. BlurXTerminator
  7. EZ Soft Stretch
  8. Miscellaneous tweaking of curves, noise, and generation of masks to help bring out the comet detail.


Post categories: