Author Topic: Another Ha Combine question  (Read 28018 times)

Offline Jack Harvey

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 975
    • PegasusAstronomy.com & Starshadows.com
Noisy R
« Reply #30 on: 2007 December 19 18:19:48 »
I uploaded a Mean R1 which is from the original data set and should have the noise??
Jack Harvey, PTeam Member
Team Leader, SSRO/PROMPT Imaging Team, CTIO

Offline vicent_peris

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 988
    • http://www.astrofoto.es/
Another Ha Combine question
« Reply #31 on: 2007 December 20 01:04:29 »
Man, you are so lucky...  :lol:  You have an incredible dark sky at CTIO, so your H-alpha data in the R1 image is almost as good as in the H-alpha image.  :lol: Could you upload a combination of perhaps two 900 seconds red images? I want noise, I need noise.  :lol:

BTW, now your image is far better I think. I would do a star shaping, and perhaps it would be possible to raise a bit the fainter parts of the nebula.

I think I have now the method to combine H-alpha with RGB. Next step I think must be test the method with H-alpha, O-III, S-II and RGB images together.


Thanks you,
Vicent.

Offline Jack Harvey

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 975
    • PegasusAstronomy.com & Starshadows.com
Noisy frames
« Reply #32 on: 2007 December 20 06:59:39 »
OK, I selected 3 Red Frames and uploaded the raw uncal frames BUT also uploaded a calibrated and registered mean of the 3.  If you need more let me know.

On the star shaping - I was actually thinking of a new thread on this and hope you will comment.
Jack Harvey, PTeam Member
Team Leader, SSRO/PROMPT Imaging Team, CTIO

Offline vicent_peris

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 988
    • http://www.astrofoto.es/
Another Ha Combine question
« Reply #33 on: 2007 December 20 07:49:10 »
Ok, I'm going to give a try with all the new data! If you want, I can upload the final HaRGB result with all the R data and the enhanced H-alpha emission, ready for processing.

Once finished this experiment, I would propose another one... I want to try to combine RGB data with more narrowband filters. Do you have any images with H-alpha, O-III and, perhaps S-II?


Best regards,
Vicent.

Offline Jack Harvey

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 975
    • PegasusAstronomy.com & Starshadows.com
Great
« Reply #34 on: 2007 December 20 08:38:18 »
Please do upload so I can work also<G>.  Unfortunately I do not have SII or OIII data.  We share the telescope at CTIO with some real astronomers (scientists) and they have clutered up the filter wheel with things like g', u' B, U etc<G>.  SO we only had room for LRGBHa.
Jack Harvey, PTeam Member
Team Leader, SSRO/PROMPT Imaging Team, CTIO

Offline Jack Harvey

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 975
    • PegasusAstronomy.com & Starshadows.com
ABE
« Reply #35 on: 2007 December 20 08:42:07 »
Using the background extractions (ABE or one of the others) can you set it to automatically perform the operation you first gave us

ie Ha-Med(Ha-Background)+0.05

I assume you only need to find a way to have the ABE subtract the Background and then add the 0.05.  Or I guess just let the ABE subtract the background anad then us Pixel Math to so Ha + 0.05   ??????
Jack Harvey, PTeam Member
Team Leader, SSRO/PROMPT Imaging Team, CTIO

Offline vicent_peris

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 988
    • http://www.astrofoto.es/
Another Ha Combine question
« Reply #36 on: 2007 December 20 10:48:10 »
Hi Jack,

I'm working with your new data. It's perfect because the H-alpha image is a lot deeper than the R one. I think we're going to have a super - tool for narrowband imaging; thanks you another time!

But there is a problem with the last image combination. You've done a simple average, so the images are full of silly pixels.  :lol:  Could you make a sigma clip image combination? You have also a better image integration algorithm in PixInsight, it's one of the last scripts Juan released, it's explained in one of the last tutorials (the one of NA Nebula). If you have problems, I can combine the data for you and send back the four channels.


Vicent.

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Another Ha Combine question
« Reply #37 on: 2007 December 20 11:16:52 »
If you're going to apply the script from the wavelets tutorial, please use this improved version:

Code: [Select]
/**
 * A simple script to perform average image integration with asymmetric k-sigma
 * pixel rejection and generation of rejection map images.
 *
 * From the processing example:
 *    The Region Around NGC 7000 and IC 5070: ATrousWaveletTransfrom and
 *    HDRWaveletTransform in PixInsight, by J. Conejero.
 */

#include <pjsr/UndoFlag.jsh>

// Base identifier of the images to integrate
// The script will try to integrate images such as ngc7000_1, ngc7000_2, ...
#define BASE_ID      ngc7000

// Identifier of a preview to integrate. Leave it empty to integrate the
// whole images.
#define PREVIEW_ID   /*Preview01*/

// Number of images to integrate.
#define IMAGE_COUNT  3

// Kappa value for rejection of bright pixels.
#define KAPPA_BRT    0.12

// Kappa value for rejection of dark pixels.
#define KAPPA_DRK    0.25

/**
 * Script entry point.
 */
function main()
{
   // Gather images and working dimensions.
   var width = 0;
   var height = 0;
   var images = new Array;
   for ( var i = 0; i < IMAGE_COUNT; ++i )
   {
      var id = #BASE_ID + '_' + (i + 1).toString();
      if ( (#PREVIEW_ID).length )
         id += "->" + #PREVIEW_ID;
      var view = View.viewById( id );
      if ( view.isNull )
         throw new Error( "No such image: " + id );

      images[i] = view.image;

      if ( i == 0 )
      {
         width = images[i].width;
         height = images[i].height;
      }
      else
      {
         // All images must have the same dimensions
         if ( images[i].width != width || images[i].height != height )
            throw new Error( "Incompatible image dimensions: " + id );
      }
   }

   // Integrated image in 32-bit integer sample format.
   var intWindow = new ImageWindow( width, height, 1, 32,
                              false, false, #BASE_ID+"_integration" );
   var intView = intWindow.mainView;
   intView.beginProcess( UndoFlag_NoSwapFile );
#define integration intView.image

   // Pixel rejection map image - bright pixels.
   var brtMapWindow = new ImageWindow( width, height, 1, 8,
                              false, false, #BASE_ID+"_rejection_map_bright" );
   var brtMapView = brtMapWindow.mainView;
   brtMapView.beginProcess( UndoFlag_NoSwapFile );
#define brtMap brtMapView.image

   // Pixel rejection map image - dark pixels.
   var drkMapWindow = new ImageWindow( width, height, 1, 8,
                              false, false, #BASE_ID+"_rejection_map_dark" );
   var drkMapView = drkMapWindow.mainView;
   drkMapView.beginProcess( UndoFlag_NoSwapFile );
#define drkMap drkMapView.image

   // Enable and initialize status monitoring.
   integration.statusEnabled = true;
   integration.initializeStatus( "Image integration", width*height );

   // Allow our users to abort the operation.
   console.abortEnabled = true;

   try
   {
      // For each row
      for ( var y = 0; y < height; ++y )
      {
         // For each column
         for ( var x = 0; x < width; ++x )
         {
            // Gather the stack of source pixels for the  current coordinates.
            var srcPixels = new Array;
            for ( var i = 0; i < IMAGE_COUNT; ++i )
               srcPixels[i] = images[i].sample( x, y );

            // Calculate the median of the source stack. This is an excellent
            // estimate of the central peak's position on the histogram.
            var m0 = Math.median( srcPixels );

            // Perform pixel rejection
            if ( m0 != 0 )
            {
               // Prepare to gather unclipped pixels.
               var pixels = new Array;
               var brtCount = 0;
               var drkCount = 0;

               // For each source pixel
               for ( var i = 0; i < IMAGE_COUNT; ++i )
               {
                  // Relative distance of this pixel to the central peak
                  var d = (srcPixels[i] - m0)/m0;

                  // Reject or accept this pixel
                  if ( d < 0 )
                  {
                     // This is a dark pixel
                     if ( d > -KAPPA_DRK )
                        pixels.push( srcPixels[i] );
                     else
                        ++drkCount;
                  }
                  else
                  {
                     // This is a bright pixel
                     if ( d < KAPPA_BRT )
                        pixels.push( srcPixels[i] );
                     else
                        ++brtCount;
                  }
               }

               // Update rejection maps.
               brtMap.setSample( brtCount/IMAGE_COUNT, x, y );
               drkMap.setSample( drkCount/IMAGE_COUNT, x, y );

               // Integrate the set of surviving (unclipped) pixels, or use
               // the median of all source pixels if all pixels were clipped.
               integration.setSample(
                  pixels.length ? Math.avg( pixels ) : m0, x, y );
            }
            else
            {
               // In case we have an all-zeros pixel stack
               brtMap.setSample( 1, x, y );
               drkMap.setSample( 1, x, y );
               integration.setSample( 0, x, y );
            }
         }

         // Invoke the garbage collector after processing a whole row of pixels.
         // A good idea if we are integrating big images.
         gc();

         // Update the status monitor.
         integration.advanceStatus( width );
      }

      // Done with target views.
      drkMapView.endProcess();
      brtMapView.endProcess();
      intView.endProcess();

      // Show them.
      intWindow.show();
      brtMapWindow.show();
      drkMapWindow.show();
   }

   catch ( x )
   {
      // Kill them.
      drkMapView.cancelProcess();
      brtMapView.cancelProcess();
      intView.cancelProcess();
      delete intWindow;
      delete brtMapWindow;
      delete drkMapWindow;

      throw x;
   }
}

main();


This version fixes a small problem that the original script had with an even number of integrated images. I still have to update the script on the tutorial, too...
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline Jack Harvey

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 975
    • PegasusAstronomy.com & Starshadows.com
Sigma Clip
« Reply #38 on: 2007 December 20 12:11:59 »
A mean that has been Sigma Clipped of the top 2% of pixels is in the jack.harvey folder.  It is a mean of the same 3 frames
Jack Harvey, PTeam Member
Team Leader, SSRO/PROMPT Imaging Team, CTIO

Offline Jack Harvey

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 975
    • PegasusAstronomy.com & Starshadows.com
Image Integration script
« Reply #39 on: 2007 December 20 12:15:47 »
I do usually use CCDStack in that I have used it for a few years and it works quickly for me because of my familiarity.  It quickly takes me from calibration to Registration, Normalization, Data Rejection and then COmbine.  I use it only becasue I am used to it.  

I do not know much about running scripts so will have to figure out what to do with the script Juan has here and then how to run it.
Jack Harvey, PTeam Member
Team Leader, SSRO/PROMPT Imaging Team, CTIO

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Another Ha Combine question
« Reply #40 on: 2007 December 20 12:44:58 »
Hi Jack,

Of course this little script is not intended to replace a full-fledged (and excellent) preprocessing application as CCDStack!

This script is useful to combine a small number of images, say no more than eight or ten. It has a nice feature: it generates two rejection map images. These maps are nonzero for pixels that have been rejected by the k-sigma clipping procedure. Two maps are generated: one for bright clipped pixels and another for dark clipped pixels. These maps are useful because they allow us in evaluating how good are the clipping parameters.

In the original tutorial we used the rejection maps to increase the signal-to-noise ratio of the combined image. In this way we achieved a combined image that has all strong points of both combination methods: the good pixel rejection of median combination and the high SNR of mean combination. The results of this method are usually better than the results of most sigma-clipping implementations, but only for small sets of images.

Scripts are extremely powerful in PixInsight. To run this script, do the following:

- Copy the source code.

- Open the Script Editor window in PI

- Select New > JavaScript Source File

- Paste the source code.

- Open your images. They must be registered and have all the same dimensions. Change their identifiers so they have a common prefix and a running postfix, starting from "_1". For example: NGC1234_1, NGC1234_2, NGC1234_3, ... and so on.

- In the script, change the value of BASE_ID from its original value ("ngc7000") to your prefix ("NGC1234" in the example above).

- Set IMAGE_COUNT to the number of images. Must be larger than 3.

- The KAPPA_BRT and KAPPA_DRK values are the pixel rejection points for bright and dark pixels, respectively. They must be fine tuned by trial-error. A lower kappa means more rejected pixels. You must find the largest values able to clip out all hot/cold pixels, gamma rays, plane trails, etc.

- To run the script, select Execute > Compile & Run from the Script Editor (or press F9). When you're asked to save the script, use any location and name you like (e.g. "kappa-sigma" is a good choice).

Have fun! :) If you want to speed up the script to find KAPPA_BRT and KAPPA_DRK, you can use a small preview defined in all images (warning: it must have the same position and dimensions in all images). To use this option, change this line in the script:

#define PREVIEW_ID  Preview01

assuming that the preview's id is Preview01.

It seems tricky and complex, but believe me, once accustomed it's quite easy to use.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline Jack Harvey

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 975
    • PegasusAstronomy.com & Starshadows.com
Another Ha Combine question
« Reply #41 on: 2007 December 20 12:51:56 »
Thanks for taking time out to educate me!
Jack Harvey, PTeam Member
Team Leader, SSRO/PROMPT Imaging Team, CTIO

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Another Ha Combine question
« Reply #42 on: 2007 December 20 12:55:37 »
My pleasure Jack

David Serrano wrote another kappa-sigma integration script, including a graphical user interface:

http://pixinsight.com/forum/viewtopic.php?p=920#920

David?  :D
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline vicent_peris

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 988
    • http://www.astrofoto.es/
Another Ha Combine question
« Reply #43 on: 2007 December 20 13:47:30 »
Hi Jack,

could you upload the H-alpha image combined with sigma clipping??


Thanks,
Vicent.

Offline Jack Harvey

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 975
    • PegasusAstronomy.com & Starshadows.com
Sigma Clipped Ha
« Reply #44 on: 2007 December 20 14:46:35 »
GO to jack.harvey NEW 2074 or to NGC 2074 for Ha work, botrh of these master frames were Sigma clipped prior to median combine
Jack Harvey, PTeam Member
Team Leader, SSRO/PROMPT Imaging Team, CTIO