Author Topic: New Script: Calculate Sky Limited Exposure  (Read 49252 times)

Offline mmirot

  • PixInsight Padawan
  • ****
  • Posts: 881
Re: New Script: Calculate Sky Limited Exposure
« Reply #15 on: 2010 November 29 13:08:02 »
Maybe it is time you started?  :)

Max

Offline Emanuele

  • PixInsight Addict
  • ***
  • Posts: 270
Re: New Script: Calculate Sky Limited Exposure
« Reply #16 on: 2010 November 29 14:12:57 »
Hmmm. Not really. ;)

The ML8300 has so low noise (7.59e) that darks are not necessary. I actually don't know of anyone with an ML8300, who takes darks.

Offline Sean Houghton

  • Newcomer
  • Posts: 36
    • Cerebiggum
Re: New Script: Calculate Sky Limited Exposure
« Reply #17 on: 2010 November 29 14:48:31 »
Using a dark image will reduce the median background value which will give a more correct value for "sky noise", but this is assuming that the dark noise is big enough to be significant.

You could manually run your numbers through the formulas given in the linked paper and see if you come up with the same results.  It's possible there is an error in the script, but I've never written code with a bug in it before*.



* this statement is completely untrue.
Sean
Carlsbad, CA
cerebiggum.com

Offline Simon Hicks

  • PixInsight Old Hand
  • ****
  • Posts: 333
Re: New Script: Calculate Sky Limited Exposure
« Reply #18 on: 2010 November 29 15:31:36 »
Hi Sean,

I'm confused (not for the first time!). If I set the Gain and the Readout Noise at the values I've determined from the literature (see below), then if I decrease the MaxADUCount down to 4096 (I have a 12bit DSLR  :sad: ) then the recommended exposure time goes up. This is what surprises me. If you have a given number of ADU per electron, and you increase the number of ADU, then surely you need longer to fill the available ADU? I couldn't find anything on the maximum ADU count in the paper. Have I missed something or got the wrong of a stick?

Values for Canon 400D ISO 1600: Gain = 0.635, ReadOutNoise = 4.3

And I worked out that for the Canon 400D, ReadOutNoise = (1550/ISO) + 3.3 ....which might be of help or might not.

Cheers
         Simon

Offline Sean Houghton

  • Newcomer
  • Posts: 36
    • Cerebiggum
Re: New Script: Calculate Sky Limited Exposure
« Reply #19 on: 2010 November 29 15:42:12 »
Hi Simon,

The pixel values that PixInsight gives me are normalized (i.e. a percentage of the max count) so in order to convert them back to ADU values I have to multiply them by the maximum ADU value for your sensor.  If you use an incorrect value it breaks the conversion from ADU to electrons.  You are close, but the max ADU value is (2^bits)-1, or 4095 for a 12 bit device, remember that "0" counts as a number too :).

I'll add some presets for more Canon cameras this evening.
Sean
Carlsbad, CA
cerebiggum.com

Offline Simon Hicks

  • PixInsight Old Hand
  • ****
  • Posts: 333
Re: New Script: Calculate Sky Limited Exposure
« Reply #20 on: 2010 November 29 16:09:51 »
Sean,

Thanks, that explains it.

Regarding the zero, so you're telling me I've forgotten nothing  ;)

Cheers
         Simon

Offline Sean Houghton

  • Newcomer
  • Posts: 36
    • Cerebiggum
Re: New Script: Calculate Sky Limited Exposure
« Reply #21 on: 2010 November 29 20:38:45 »
Ok, here's version 1.0.

  • Added more Canon presets
  • Cleaned up UI a bit
  • Switched the max ADU to a bits value for ease of use

Also, I've created a GitHub project for the script.  If anyone wants to contribute please feel free.  It's really easy to download the git client, pull a copy of the repository and push changes.  Hopefully the new updates system will support user contributed scripts so we don't have to publish updates on the forum.

https://github.com/seanhoughton/CalculateSkyLimitedExposure
Sean
Carlsbad, CA
cerebiggum.com

Offline Emanuele

  • PixInsight Addict
  • ***
  • Posts: 270
Re: New Script: Calculate Sky Limited Exposure
« Reply #22 on: 2010 November 30 00:58:34 »
THanks for the feedback Sean.
I ran the Starizona Subexposure calculator (on Starizona Website) and for a QHY9 (Same chip as mine) with a median background value of around 2700ADU (see screenshot attached for the statistics of the image) and a 180seconds exposure, I get an ideal subexposure time of 130 minutes.

?

I am lost.


Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: New Script: Calculate Sky Limited Exposure
« Reply #23 on: 2010 November 30 06:18:15 »
Hi Sean,

Welcome to PixInsight development!

Nice work. If you don't mind, I'd like to include this script in the standard set released with the next version.

I have attached a modified version of your script that fixes all screen alignment and sizing problems. The most important modifications include the following:

- When you create a NumericControl control, it already includes a Label subcontrol (its label property) that you must use. There's no need to define an independent Label and a HorizontalSizer to group it with the NumericControl.

- To visually align all controls on a dialog, use the font property of Dialog to compute a minimum width in pixels for the longest label. Then use that value to set the minWidth property of all labels.

- You can (should) define the width of all Edit controls in the same way. in this case you must force a fixed width for the edit subcontrols of all NumericControl items, as Edit controls shouldn't be resizable in general. However, you must call edit.setFixedWidth() after calling the setPrecision() and setRange() methods of NumericControl, as these methods reset the edit's width automatically.

- There is no need to set the label.textAlignment property, as it is already set to TextAlign_Right|TextAlign_VertCenter by NumericControl's constructor.

- Try to avoid leaving potentially unrooted child controls in a dialog's constructor. For example, if you write:

   function MyDialog()
   {
      ...
      var foo = new Label( this );
      ...
   }


this code should normally work as expected, i.e. foo will be a child control of MyDialog, and in most cases it won't give problems. However, by doing that you take one risk: under certain conditions, the JavaScript garbage collector may decide that foo has become out-of-scope and is unreferenced, and if that happens, foo will eventually be destroyed behind the scenes, with catastrophic results. Although I have been very careful to prevent that to happen with all GUI objects, JavaScript's internals are too complex as to ensure that no unexpected garbage collection may happen sometimes.

To prevent these side effects, always define all subcontrols as properties of their parent controls. In the case above:

   function MyDialog()
   {
      ...
      this.foo = new Label( this );
      ...
   }


is safer because as long as an instance of MyDialog is referenced, its foo child control will also be referenced.

- When a dialog must be user-resizable, always try to force at least one fixed dimension —either the width or the height, as appropriate— whenever possible. In your script, I have set a fixed width of 420 pixels:

  this.setFixedWidth( 420 );
   this.adjustToContents();


which allows only changing the dialog's height. This ensures that a valid geometry will be set on all supported platforms (Mac OS X is particularly problematic in this regard).

Hope this helps.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline harist

  • Newcomer
  • Posts: 46
Re: New Script: Calculate Sky Limited Exposure
« Reply #24 on: 2010 November 30 12:52:29 »
Hi Sean,

Just tested your script and it works fine! I think it would be handy if the previously set ccd selection could be retained
each time the script is run.

Best Regards
Tasos

Offline Simon Hicks

  • PixInsight Old Hand
  • ****
  • Posts: 333
Re: New Script: Calculate Sky Limited Exposure
« Reply #25 on: 2010 November 30 14:29:41 »
Hi Sean,

I've tested it on a number of different exposure length subs and it always seems to come out with sensible answers.

I agree with Tasos, if it could hold the last entered values, then that would be really great. Not sure if this is possible with a script though?

Cheers
         Simon

Offline Sean Houghton

  • Newcomer
  • Posts: 36
    • Cerebiggum
Re: New Script: Calculate Sky Limited Exposure
« Reply #26 on: 2010 November 30 15:26:05 »
Thanks for the fixes and best practices Juan, that's helpful for the future.

I wasn't sure about the GC ramifications of using local variables for UI elements but I had assumed that adding them as children to the sizers would create a reference chain that would keep them alive.

Most of your improvements involve deleting code - my favorite kind.

Including it as part of the distro is fine.  Some people are reporting strange values so I'm going to do another pass on the math to make sure everything is correct.

Persistent settings is a bit tricky in a script.  I can write out a text file with the saved values but file permissions might cause issues.
Sean
Carlsbad, CA
cerebiggum.com

Offline Sean Houghton

  • Newcomer
  • Posts: 36
    • Cerebiggum
Re: New Script: Calculate Sky Limited Exposure
« Reply #27 on: 2010 November 30 20:20:56 »
Emanuele,

I think you plugged in seconds when the page is asking for minutes  :surprised:

When I use the values you provided (including "3" for the exposure) I get 2.25m as the limited exposure, which ends up being 1.125m suggested exposure.  So far all my test images line up with the results from the web calculator you linked to.

Remember that low value can actually be a benefit because it means you can take advantage of subexposure integration and get better pixel rejection and a reduced penalty for an image with defects.
Sean
Carlsbad, CA
cerebiggum.com

Offline Emanuele

  • PixInsight Addict
  • ***
  • Posts: 270
Re: New Script: Calculate Sky Limited Exposure
« Reply #28 on: 2010 December 01 01:06:06 »
Hi Sean,

yes, my bad on that webpage.
I still don't understand how is it possible that I get a suggested exposure time of 1.25m from a 21.5SQM sky!  ???
E.

Offline harist

  • Newcomer
  • Posts: 46
Re: New Script: Calculate Sky Limited Exposure
« Reply #29 on: 2010 December 01 07:06:16 »
Quote
Remember that low value can actually be a benefit because it means you can take advantage of subexposure integration and get better pixel rejection and a reduced penalty for an image with defects.

Very true! However, faint targets are a different story and what matters then (in terms of sub duration) is to register target data!

A very interesting approach for sub duration is also presented here:
http://www.cloudynights.com/item.php?item_id=1622

Tasos