Author Topic: How to compare flats using Pixel math  (Read 3812 times)

Offline mmirot

  • PixInsight Padawan
  • ****
  • Posts: 881
How to compare flats using Pixel math
« on: 2010 March 28 12:36:18 »

I am trying to compare flats from various sessions and a flat box.  I want see how they differ.

I don't think a straight subtraction or divsion will work well since each flat will have different mean adu.

So I think I need to normalized the flats prior to subtraction.  How would accomplish this using pixel math?


Thanks

Max

Offline Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
Re: How to compare flats using Pixel math
« Reply #1 on: 2010 March 28 13:08:52 »
Max,

I'd have DSS create master darks and then load those in PI. Divide one by the other. That'll give you an impression of the difference. The master dark will have been bias subtracted so division works. Now interpreting the result can be tricky :) A simple subtraction can also tell which image is 'more'.
Best,

    Sander
---
Edge HD 1100
QHY-8 for imaging, IMG0H mono for guiding, video cameras for occulations
ASI224, QHY5L-IIc
HyperStar3
WO-M110ED+FR-III/TRF-2008
Takahashi EM-400
PIxInsight, DeepSkyStacker, PHD, Nebulosity

Offline Niall Saunders

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1456
  • We have cookies? Where ?
Re: How to compare flats using Pixel math
« Reply #2 on: 2010 March 28 15:43:00 »
Hi Max,

It is not that straightforward Max - as you may have deduced if you were following the thread that I became involved in over on the CCDAstro forum.

You also need to consider a few things first, namely, are your raw Flats and FlatDarks saved in 32-bit Float mode? If so, then PixInsight will NOT be able to process them in a 'straightforward' manner. Basically, as NONE of us are enjoying the luxury of a 32-bit CCD imager (yet ::)), then NONE of us should be 'saving' our raw data in 32-bit mode. If you can (and that excludes anybody working with Meade's Envisage program) then save your images in 16-bit Unsigned Integer mode (I am not wealthy enough to use any of the 'high-end' capture programs, but I checked with Nebulosity last night, and this basically means having 'none' of the boxes 'ticked' in the <File><Preferences><Output> section.

If you HAVE saved in 32-bit mode, then all is not lost, but you will need to convert back to 16-bit using a combination of an ImageContainer and the SampleFormatConversion process (I will explain on a follow-up, if needed).

Because these are all Flats and FlatDarks, you do not need to worry about Alignment.

You do need to run your FlatDarks through ImageIntegration, to create a MasterFlatDark (which will be suitable for all your sub-grouped Flats, assuming that you are taking groups of Flats at different orientations of your Lightbox with respect to your OTA). ImageIntegration does not have to be a sophisticated setup for this stage - you can get away with not much more than simple Averaging, with no normalisation or clipping.

You then need another ImageContainer or, rather, several of them - one for each sub-group of Flats. And you will need a PixelMath process set up as <$T - MasterFlatDark>. The PixelMath equation then gets applied to the ImageContainer (which should be set up to write the modified images either with a modified name or to a new directory - it's up to you). However you do things, you will end up with new groups of DarkCalFlats (again, one for each orientation of your Lightbox).

Then you use a new instance of ImageIntegration to combine each group of DarkCalFlats into a MasterCalFlat - and, again, ImageIntegration need be nothing more than a simple 'Average'.

Now you have your individual MasterCalFlats - and these need to be normalised. Inspect each with the Statistics process, and select the image with the highest 'Max' ADU. Either one-by-one, or by using an ImageContainer again, and with a PixelMath command set to <$T / maxADU> (where you will enter the 'discovered' number for 'maxADU'), you can now 'normalise' all of your MasterCalFlats such that they ALL have a maximum ADU of 1.0

A final use of an ImageContainer and PixelMath will allow you to pick any one of  your MasterNormCalFlats as a 'masterCAL', and you can then use either <$T / masterCal> or <$T - masterCal> to divide the masterCAL into every other image, or to subtract the masterCAL from every other image.

Now the tricky part. I have used the FFT process in AIP4WIN (in the absence of a similar process being available in PI) to look for 'residual patterns' when I did my lightbox examination. I have also used the 3-D plot feature here in PI as well.

As I am right in the middle of fabricating two new lightboxes (using EL sheet this time) I will also be looking to see what DBE does to the images - specifically looking at the 'extracted' background. Perhaps DBE can even help analyse an FFT image - I have only just thought about that.

Right now, without evidence available to the contrary I totally refuse to accept that a twilight flat will be 'better' than a lightbox flat. As I said over on the CCD forum, a simple 'claim' to that effect is not very helpful.

But - like you - I would also like to hear how others might 'analyse' a group of Flats to decide whether a lightbox was actually 'flat enough' (bearing in mind that, so long as it eliminates 'most' of the optical vignetting, and 'all' of the dust artifacts, then I believe that the DBE process is actually MORE than powerful enough to eliminate everything else)

Comments . . . . . ?

Cheers,
Cheers,
Niall Saunders
Clinterty Observatories
Aberdeen, UK

Altair Astro GSO 10" f/8 Ritchey Chrétien CF OTA on EQ8 mount with homebrew 3D Balance and Pier
Moonfish ED80 APO & Celestron Omni XLT 120
QHY10 CCD & QHY5L-II Colour
9mm TS-OAG and Meade DSI-IIC

Offline vicent_peris

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 988
    • http://www.astrofoto.es/
Re: How to compare flats using Pixel math
« Reply #3 on: 2010 March 28 16:05:55 »

I am trying to compare flats from various sessions and a flat box.  I want see how they differ.

I don't think a straight subtraction or divsion will work well since each flat will have different mean adu.

So I think I need to normalized the flats prior to subtraction.  How would accomplish this using pixel math?


Thanks

Max

Supose you have two flats, with identifiers flat1 and flat2. You are going to compare flat2 by putting it in a full image preview of flat1.

Flats are suposed to characterize multiplicative deffects in our image. Thus, what we must do to compare both flats, is to fit the both illumination levels by means of a multiplication.

To do this correctly, you must first substract the master bias to both flats. After this substraction, you can proceed to fit them. In PixelMath, we will match both illumination levels using the average pixel value of both images as the reference value:

flat2 * ( Avg($T) / Avg(flat2) )

Remember to uncheck the Rescale checkbox.

What I recommend is to do an automatic adjustment of the STF prior to applying the PixelMath instance. As the illumination level of flat2 will be fitted to the illumination level of flat1, the same STF will work for flat2.

Of course, you can apply the formula directly to the flat2 image, replacing $T by flat1. If you do this, you can compare both flats by means of a division or a substraction between them. I. e., you can then make a division between both flats in the flat1 preview:

flat1 * 2 / flat2

If you disable the Rescale checkbox, you will have the unity proportion between both flats in 0.5 pixel value. pixel values >0.5 will say us that flat2 has lower illumination that flat1. Pixel values <0.5 will say us that flat2 has higher illumination that flat1. Also a substraction would work, but a division will show better illumination discrepances.

Indeed, this is what ImageIntegration does when you select the "multiplicative" and "equalize fluxes" normalization modes. These are the setting you must enable to generate a correct master flat frame.


Hope this helps!
Regards,
Vicent.
Hope this works for you!