Learning PixInsight – Create and Use a Synthetic Flat

I have been going through some of my old data practicing with different tools and processing in PixInsight. I had a stack of 18 x 300 seconds of the Leo Triplet which I captured in early April 2024. There were a lot of issues with the stack which could have been corrected with a flat, but I did not take one at the time. I ended up cropping the image significantly and was not able to bring out much detail due to the dust motes and other artifacts. I started googling around to see how PixInsight might be able to help and I found this process for creating and applying a synthetic flat frame.

Flats are kind of a pain, but the best practice would be to capture flat frames with the same image train and at the same focus as the light frames. If that is not possible then this appears to be a pretty decent alternative. I made a few adjustments to original workflow from Westwood Astro and I was able to get some very decent results. I was able to repeat this process for a stack of the Leo Triplet and also for a stack of a Headphone planetary nebula.

This is where I started with this original stack of 18 x 300 second exposures with no flat frames applied. The PixInsight STF autostretch is applied.
Leo Triplet - Original Stack with no Flat Frames
There are several dust motes. There is a weird reflection artifact in the bottom right corner. There is a bit of vignetting, especially moving from the center to the upper left corner.

Let’s see if we can fix it. This process should be done prior to any cropping, background extraction, denoising, or other processing.
To start duplicate the original image twice to create two Views. Change the View Identifier on one of the new Views to pre and change the other View Identifier to flat.
Duplicate the original creating 2 views - pre and flat
The flat View will end up becoming the synthetic flat.

Use StarNet to remove the stars from the flat View. Use a stride setting of 128.
Run StarNet to remove the stars from the flat View.

Use the CloneStamp tool to “paint” over galaxies or nebula remaining after StarNet star removal.
Use CloneStamp to remove galaxies and nebula from starless image.
Do not mess with the dust motes or other artifacts which need to be calibrated out using the synthetic flat.
Starless image ready to blur.
This may take a bit of practice to get right depending on the amount of stuff which needs to be removed from the starless flat. Make sure to click the green check when you are done to apply the CloneStamp to the image.

Run the MultiscaleMedianTransform process to blur the flat. You may need to play with the number of layers to produce results which work best. For this image 4 layers seemed to give me the best final result. Disable all the layers except the Residual Layer.
Multiscale Median Transform to blur the synthetic flat.
Now PixelMath is used to “calibrate” the pre View using the newly created synthetic flat.
PixelMath expression: pre * mean(flat) / flat (make sure to select the Use a single RGB/K expression checkbox)
PixelMath - Apply synthetic flat
After using the synthetic flat I followed my processing workflow and here are the results. The Leo Triplet which includes Messier 65 (up and left of center), Messier 66 (down and left of center), and NGC 3628 (down and right of center).
Leo Triplet Processed After Creating a Synthetic Flat
I think it came out pretty decent, especially based on what I started with. It is not perfect but it was much easier get more detail out of the galaxies without the dust motes, vignetting, and other artifacts from the original stack.

I ran the same process above on some data from the Headphone Nebula (Jones-Emberson 1) again with great results.
Synthetic Flat applied to the Headphone Nebula stack.
After applying the synthetic flat the dust motes are gone and there is virtually no vignetting.

I processed the Headphone Nebula stack after applying the synthetic flat using my workflow and here are the results.
Head Phone Nebula processed after applying synthetic flat
Not perfect, but not bad at all. It was definitely much easier to work with after applying the synthetic flat.

Definitely provides a great way to work with data from the past without any available flat frames and no real way to capture flat frames that would work.

It is suppose to be clear and cool tonight, but it is a school night and the Moon will be bright and nearly full. Probably will not do any long exposure captures but might put the SeeStar out in the driveway. Clear skies…

Leave a Reply

Your email address will not be published. Required fields are marked *

19 − five =