CFA Background Extraction script

rbarbout

Member
Hello,

I wrote a script to perform Background Extraction on CFA images.
The goal was to remove gradient on each calibrated sub and still use Bayer Drizzle as integration method.
The script is very straightforward, it starts with a SplitCFA then applies a BackgroundExtraction (ABE or DBE) on each CFA channel, then re-create a CFA image with MergeCFA and finally replace the original CFA image with the new one in order to keep its FITS header.
The script applies an ABE by default but one can select an ABE or DBE process icon to use for background extraction.
The script can process a single view or multiple images if fed by an Image Container.

This is my first script, it surely needs some correction and/or optimisation.

Many thanks to Roberto Sartori and its "Introduction To PixInsight Scripting" video without which I would never have been able to write this script.
CFA_BE.JPG
 

Attachments

  • CFA_BE.zip
    3.5 KB · Views: 156
This is interesting.

Do I understand it correctly that the purpose is to execute DBE on the calibrated flats, between calibration and debayering ?
 
This is interesting.

Do I understand it correctly that the purpose is to execute DBE on the calibrated flats, between calibration and debayering ?
Hi Pieter,

No, the purpose is to execute DBE or ABE on calibrated frames (i.e. on images calibrated with Darks, Offsets and Flats) so, between calibration and debayering .
However, if you think that your flats show some linear gradient (for instance because you took them by shooting at an uneven part of sky), you may try to remove this gradient with the script.
In this case, I would recommend to use an ABE with Function degree = 1. Any higher function would try to "flatten" the flats leading to worse calibrated frames.
That been said, I never tried the script on flats, use it at your own risk ;) !
 
sorry... I of course meant the calibrated LIGHTS, after calibration, but BEFORE integration. I mistyped the word flats (as I am fighting already several days with my flats)
I understand from your reply that that is what you meant...


a friend of mine suggested that technique, never tried it.
 
sorry... I of course meant the calibrated LIGHTS, after calibration, but BEFORE integration. I mistyped the word flats (as I am fighting already several days with my flats)
I understand from your reply that that is what you meant...


a friend of mine suggested that technique, never tried it.
Ah OK, it makes more sense.
In fact, I wrote this script as a proof of concept without knowing if it would work.
The fact is that it removed quite well the complexe gradient I had due to light pollution at different angles from different sessions.
I tried an integration with ABE degree 1 and one with ABE degree 4. The bayer drizzle result with ABE4 is nearly free of any gradient.
 
@rbarbout , thanks for sharing! This is a useful script.

I've tried it with 5 hours of M51 data which I've collected yesterday and it works great. The calibrated frames obviously contain some light gradient from the Moon. It is visible in the integrated image 1. Then I've applied the CFA_BE script on all calibrated frames and integrated them again using ABE with function degree 1 to remove the Moon gradient (on a rather small field of view the gradient should be practically linear). The result is image 2 and it looks like it was taken on a moonless night :) Image 3 is the ABE background model of image 1.

Over a few sessions the Moon gradient in the integrated image would be more complex and therefore probably a bit more difficult to remove. But in every single frame the gradient is rather simple.

CFA_BE.png


Best regards,
Vitali
 
@rbarbout , thanks for sharing! This is a useful script.

I've tried it with 5 hours of M51 data which I've collected yesterday and it works great. The calibrated frames obviously contain some light gradient from the Moon. It is visible in the integrated image 1. Then I've applied the CFA_BE script on all calibrated frames and integrated them again using ABE with function degree 1 to remove the Moon gradient (on a rather small field of view the gradient should be practically linear). The result is image 2 and it looks like it was taken on a moonless night :) Image 3 is the ABE background model of image 1.

Over a few sessions the Moon gradient in the integrated image would be more complex and therefore probably a bit more difficult to remove. But in every single frame the gradient is rather simple.

View attachment 10894

Best regards,
Vitali
Hi Vitali,

Glad to see that the script was helpful and worked well on your images (which look very nice by the way !)
On my subs, I had a very complex gradient from moon on one side and street light on an other.
An ABE with degree 4 did the job very well (credit goes to Pixinsight process of course).
 
Last edited:
Back
Top