Author Topic: Blinking Script  (Read 87214 times)

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: Blinking Script
« Reply #135 on: 2010 September 01 10:51:12 »
Code: [Select]
function EvolutionEngine()
{
   this.inputFiles = new Array;
   this.bitsPerSample = 8;
   this.floatSample = false;
   this.xev = 0;
   this.yev = 0;


   this.processFiles = function()
   {
      var fileName = 'analysis';
      fileName = File.appendToName( fileName, '_x' );
      fileName = File.appendToName( fileName, Number.toString(this.xev));
      fileName = File.appendToName( fileName, 'y');
      fileName = File.appendToName( fileName, Number.toString(this.yev) );
      //fileName = File.appendToName( fileName, '_x'+Number.toString(this.xev)+'y'+Number.toString(this.yev) );

      var filenamePlot = File.appendToName( fileName, '_plot' );
      var filenameEvo = File.appendToName( fileName, '_evolution' );

      var wPlot = new ImageWindow(this.inputFiles.length, 1001, 1,8, false, false, 'plot');
      var wEvo = new ImageWindow(this.inputFiles.length, 1, 1, 32, true, false, 'pixelEvolution');

      var vPlot = wPlot.mainView;
      vPlot.beginProcess (UndoFlag_NoSwapFile);
      vPlot.image.apply(1);

      var vEvo = wEvo.mainView;
      vEvo.beginProcess (UndoFlag_NoSwapFile);


      for ( var i = 0; i < this.inputFiles.length; ++i )
      {
         var w = ImageWindow.open( this.inputFiles[i] );

         if ( w.length == 0 && i+1 < this.inputFiles.length )
         {
            var msg = new MessageBox( "<p>Unable to load input image file:</p>" +
                                      "<p>" + this.inputFiles[i] + "</p>" +
                                      "<p><b>Continue pixel evolution analysis ?</b></p>",
                                      TITLE, StdIcon_Error, StdButton_Yes, StdButton_No );
            if ( msg.execute() == StdButton_No )
               break;
         }


         for ( var j = 0; j < w.length; ++j )
         {

            var view = w[j].mainView;
            view.beginProcess (UndoFlag_NoSwapFile);

            var f = view.image.sample(this.xev,this.yev,0);
            vEvo.image.setSample( f,i,0);
            var p = 1000-Math.round(1000*f);
            for ( var k = p; k <= 1000; ++k )
              vPlot.image.setSample( 0,i,k);

            view.endProcess();
            w[j].forceClose();
         }
      }

      vPlot.endProcess();
      vEvo.endProcess();

      wPlot.show();
      wEvo.show();

   }
}

var engine = new EvolutionEngine;

As promised... hope this helps (and you takes the ball ;) )
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline NKV

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 677
Re: Blinking Script
« Reply #136 on: 2010 September 01 23:57:03 »
As promised... hope this helps (and you takes the ball ;) )
Thanks Carlos.
One question: Why you use:
Code: [Select]
for ( var j = 0; j < w.length; ++j )I not understand in which situation w.length > 1 ?

Any way... ver 2.9
+evolution analysis
PS there are error. so, don't try to use it on single image. fixed
« Last Edit: 2010 September 02 21:28:02 by NKV »

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: Blinking Script
« Reply #137 on: 2010 September 02 04:24:23 »
To be honest, I didn't understand that either :D I just used the batch format script as base, and if Juan wrote that, it should have been for a good reason :D  Anyway, that works :P
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: Blinking Script
« Reply #138 on: 2010 September 02 12:42:39 »
Just tried the new feature :) really fast, and works pretty well. Congrats ;)
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline NKV

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 677
Re: Blinking Script
« Reply #139 on: 2010 September 02 21:46:31 »
Thanks Carlos.
I updated the script above (fixed zero-division problem).
Note, i add auto min/max rejection. So the graph show only distribution between mim/max values in sequence of images.
Also, because the script operate at images in memory, impossible to analyze QTY of images, so independent version of EvolutionEngine is good idea.

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: Blinking Script
« Reply #140 on: 2010 September 03 06:26:09 »
In fact, this was exactly the same motive why I wanted that to be in your script ;) Mine loaded the images at requests, and this may get pretty boring if you want to inspect several points.
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline mmirot

  • PixInsight Padawan
  • ****
  • Posts: 881
Re: Blinking Script
« Reply #141 on: 2010 September 16 21:19:45 »
I get a syntax error on line #1 on all the latest version of this script.

Max

Offline NKV

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 677
Re: Blinking Script
« Reply #142 on: 2010 September 16 21:48:26 »
I get a syntax error on line #1 on all the latest version of this script.

Max
Max, please show me report from Processing Console or Print Screen with the error.

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: Blinking Script
« Reply #143 on: 2010 September 17 08:46:16 »
Quote
One question: Why you use:
Code:

for ( var j = 0; j < w.length; ++j )

I not understand in which situation w.length > 1 ?


I figured out that cicle. It is there in the case of stored arrays of images. I think that FITS and TIFF support multiple images to be stored in a single file.
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline mmirot

  • PixInsight Padawan
  • ****
  • Posts: 881
Re: Blinking Script
« Reply #144 on: 2010 September 17 17:25:40 »
I get a syntax error on line #1 on all the latest version of this script.

Max
Max, please show me report from Processing Console or Print Screen with the error.

Nevermind,

The script is ok. Fantastic work in fact.
Another kind of problem with my last install was messing it up.

Max

Offline mmirot

  • PixInsight Padawan
  • ****
  • Posts: 881
Re: Blinking Script
« Reply #145 on: 2010 September 26 20:11:49 »
When I try " save selected" it only saves a single image.
( I made a new directory first)
I assume it was intended to save all checked images.

Max

Offline NKV

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 677
Re: Blinking Script
« Reply #146 on: 2010 September 26 20:20:36 »
When I try " save selected" it only saves a single image.
I think you select only one file.
Note: Selected and checked is different. ;) Try again or show me PrintScreen.

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: Blinking Script
« Reply #147 on: 2010 September 26 20:32:19 »
Don't know if this has been implemented yet... Is there a way to blink using one reference frame (fixed) between the others?
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline NKV

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 677
Re: Blinking Script
« Reply #148 on: 2010 September 26 22:37:29 »
Don't know if this has been implemented yet... Is there a way to blink using one reference frame (fixed) between the others?
Double click at reference frame.

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: Blinking Script
« Reply #149 on: 2010 September 27 06:46:13 »
:P Ok! ;)
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com