Author Topic: SubFrame Selector se cuelga!!  (Read 6896 times)

Offline matelunga

  • Newcomer
  • Posts: 6
SubFrame Selector se cuelga!!
« on: 2014 January 23 15:40:20 »
Hola:
Eso, la aplicación lleva el i7 a 90% y se pega en la primera imagen para algunos juegos de imágenes.
Sucede con juegos de imágenes que sin embargo se pueden abrir y trabajar de manera regular.

con todas las versiones incluso la 01.08.01.1079-20140121.


Un saludo
Pablo

Offline mschuster

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1087
Re: SubFrame Selector se cuelga!!
« Reply #1 on: 2014 January 23 15:48:02 »
Hola,
Publica un "link" a una de las imágenes.
Gracias,
Mike

Offline matelunga

  • Newcomer
  • Posts: 6
Re: SubFrame Selector se cuelga!!
« Reply #2 on: 2014 January 27 19:08:29 »
Aquí hay unas imágenes con las que cuelga:

https://www.dropbox.com/s/m5ovnv9i2rp1ker/Ha-240.rar

Lo acabo de probar con la nueva versión 01.08.01.1083


Quedo Atento.
Un Saludo
Pablo

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: SubFrame Selector se cuelga!!
« Reply #3 on: 2014 January 27 20:21:21 »
probably the same thing i'm seeing… if you want my images i can provide them but they are pretty unremarkable. 8300M and 400mm OTA.

rob

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
SubFrameSelector script: Performance degradation
« Reply #4 on: 2014 January 28 02:19:16 »
I have narrowed the cause of this problem down to the StarDetector PJSR object. There is some interaction with the new JavaScript engine that causes a terrible performance degradation in successive executions.

I am working hard to isolate the problem and fix it, but this is a very complex task. I ask for some more patience; as soon as I get this fixed I'll release a new version.

So far I have no workaround. Sorry for the trouble.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: SubFrame Selector se cuelga!!
« Reply #5 on: 2014 January 28 08:33:49 »
no problem juan, as long as you can reproduce it, it's no longer a mystery...

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
(FIXED) SubFrameSelector script: Performance degradation
« Reply #6 on: 2014 January 28 12:00:42 »
This bug is now fixed. I have just released an update with a new version of the StarDetector JavaScript engine that fixes all script performance regressions. As a bonus, star detection is somewhat faster now (compared with the previous version when it was working well).

Thank you for your patience.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: SubFrame Selector se cuelga!!
« Reply #7 on: 2014 January 28 14:07:46 »
thanks, will update!

rob

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: SubFrame Selector se cuelga!!
« Reply #8 on: 2014 January 28 16:27:27 »
looks good, processing time is back to being constant per frame.

rob

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Re: (FIXED) SubFrameSelector script: Performance degradation
« Reply #9 on: 2014 January 28 23:26:41 »
This bug is now fixed. I have just released an update with a new version of the StarDetector JavaScript engine that fixes all script performance regressions. As a bonus, star detection is somewhat faster now (compared with the previous version when it was working well)....

Apparently this was a problem with the script. Is there anything that JavaScript writers can learn from this issue?
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: (FIXED) SubFrameSelector script: Performance degradation
« Reply #10 on: 2014 January 29 02:27:55 »
Apparently this was a problem with the script. Is there anything that JavaScript writers can learn from this issue?

This bug has led to a very interesting analysis work, which will allow me to further optimize several key elements of PixInsight's JavaScript runtime.

After a lot of tests and precise execution time measurements, I managed to isolate the origin of this strange performance degradation. Basically, for reasons that I am still investigating, some statistical methods of the Image object start increasing their execution times exponentially after a long sequence of calls (in the range of thousands of function calls). For example, this code is excerpted from the version of StarDetector.jsh that shipped with build 1083, and is part of the inner loop of the star detection engine:

                           if ( data.bkg == 0 || (data.norm - data.bkg)/data.bkg > this.sensitivity )
                              if ( wrk.sample( ix, iy ) > 0.85*data.peak )
                                 if ( wrk.median( r ) < this.peakResponse*data.peak )
                                    S.push( new Star( data.pos, data.flux, data.size ) );


This code executes for most candidate stars (that is, not only for reported stars, but for much more). This means that this piece of code typically runs in the range from 1000 to 20,000 times for average deep sky images. In red color is one of the function calls that was causing a severe performance degradation. The wrk variable is an Image object.

To fix this problem, I have replaced all calls to Image's statistic methods within the inner loop of the star detection engine. For example, the above code is now:

                           if ( data.bkg == 0 || (data.norm - data.bkg)/data.bkg > this.sensitivity )
                              if ( wrk.sample( ix, iy ) > 0.85*data.peak )
                              {
                                 var m = Matrix.fromImage( wrk, r );
                                 if ( m.median() < this.peakResponse*data.peak )
                                    S.push( new Star( data.pos, data.flux, data.size ) );
                              }


Fortunately, the Matrix object implements all statistical methods of Image, and Matrix.fromImage() is a fast native call without any measurable penalty. The call to Matrix.median() has no performance degradation. Surprisingly, the underlying native C++ code for Image.median() and Matrix.median() is the same (part of PCL). Of course, the corresponding C++ classes in PCL have no performance degradation at all (in fact, pcl::GenericImage<>::Median() is slightly faster than pcl::GenericMatrix<>::Median() because a part of the code is parallelized in GenericImage<>).

I still don't know what's going on here, but I'll investigate it thoroughly. My best bet is that we have some weird interaction with garbage collection in SpiderMonkey 24, but I'm not sure. The fact that this never happened with SM 17 supports this hypothesis. JavaScript engines, especially the last generation ones, are very complex beasts.

So please don't make any premature conclusions, especially not one of the "Matrix is faster than Image" kind.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline matelunga

  • Newcomer
  • Posts: 6
Re: SubFrame Selector se cuelga!!
« Reply #11 on: 2014 January 31 08:02:34 »
Hello:

I have applied the update, unfortunately for the same set of data, the behavior has not changed, even if only the first image is processed.






By mesaje console, where the process is stopped, it appears that the StarDetector has already been executed. Perhaps the problem lies elsewhere.

Un Saludete :)
Pablo

Offline matelunga

  • Newcomer
  • Posts: 6
Re: SubFrame Selector se cuelga!!
« Reply #12 on: 2014 February 03 05:26:32 »
Hello:

Reviewing frames that block the IP, verify that all of them have the background to zero, obviously this is a problem of capturing, I'll have to investigate.

Anyway, I think that would be useful, not the application I blocked, and instead report the error frame.

Un Saludo
Pablo