Author Topic: Automatic ReScale of ADU data on <File><Open>  (Read 12234 times)

Offline Niall Saunders

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1456
  • We have cookies? Where ?
Re: Automatic ReScale of ADU data on <File><Open>
« Reply #15 on: 2010 January 30 16:10:08 »
Hi Sander,

Fundamentally, I 'think' that the proposed solution 'should' actually work - for any valid FITS file, irrespective of the source (unless we discount some FITS creation software, like Meade's Envisage FITSINT format, which is just plain WRONG !!).

Let's say we are dealing with FITS images that use the ubiquitous 32-bit Float format. Even Envisage can get THAT format right. It downloads 16-bit (integer) data from the CCD - which means an ADU range of 00000 to 65535, and it stores this as 32-bit floating-point data (4 bytes per pixel) in a 'standard' FITS format image. This means that an original ADU value of, say, 12345 would now be stored as 12345.000. Nothing wrong with things so far.

So, when PixInsight comes to 'open' or 'load' the image, the FITS header (correctly) identifies the data as being in 32-bit unsigned floating-point format. It will therefore 'read' the pixel ADU value (correctly) as "12345.000".

It then has a decision to make, based on the <FITS Format Preferences> window parameters. If you simple leave everything set to 'default', then it will test for the condition whereby the data (i.e. ALL the ADU values) is between the Lower Range and Upper Range limits (which default to 0.0 and 1.0). In our case the data WILL be outwith these limits (images written to disk BY PixInsight will have already been re-scaled to the "0.0->1.0" range, so they will NOT fail the range test on re-load) and so they WILL need to be rescaled.

Now, as Juan says, there is no ACTUAL need to rescale to the 0-1 range. The data can remain 'native' (0-65535), and PI will 'rescale on the fly' (or at least that is my understanding), whereby there is a temporary rescale to 0-1, then a process is applied, then the result is returned to the original 0-65535 scale. But I may be completely wrong.

In any case, I can 'live with' a permanent 0-1 rescale - I use the 'on-the-fly- readout rescale to get back to 16-bit Integer values, if I need them. Otherwise I work quite happily in a 0 to 1 world.

What is just NOT working for me is the fact that I simply CANNOT get PixInsight to allow me to define the Upper and Lower Range values - and because I cannot do this, PI seems to rescale the non-conforming image such that "Maximum(T$)" is used for the Upper Range, and thus becomes "1.000" in the opened image.

Which might be OK for images that do actually have ADU values that were fully saturated, all the way up to 65535.

But this is HOPELESS for non-saturated images like Flats, FlatDarks and BiasOffsets.

There simply HAS to be something wrong with the code, if it cannot accept a typed in value of 65535.00000 for the Upper Range parameter.

It is driving me mad, and ruining a perfectly valid attempt to create an image using ONLY the power of PixInsight - from beginning to end  >:(

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 Niall Saunders

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1456
  • We have cookies? Where ?
Re: Automatic ReScale of ADU data on <File><Open>
« Reply #16 on: 2010 January 30 16:31:52 »
Quote
This is really weird. This is shooting in the dark, but are you using a wireless keyboard, by chance? I have seen spectacularly weird problems with wireless peripherals...

Yes Juan, I am using a (Logitech) wireless keyboard ???

But, surely, your code obtains keyboard input way, way, higher than 'BIOS' level? Your code should not be in any way concerned 'how' my keyboard entry is created - I could even be using direct brainwave control and - once the correct number has appeared in the TextBox field for the parameter in question, then 'change of focus' from that TextBox should leave the new value 'fixed' for that field.

This is simply not happening - and this is the ONLY area that I have EVER seen this happen - on any program, using any operating system, with this keyboard.

By the way, I have just checked all the other image formats - and I see the same error using the TIFF format

And the same misbehaviour is seen if you try to enter a large numer in the Lower Range TextBox.

The error occurs at the transition level around 9223.372036854776500, with the error result becoming -9223.372036854776500I cannot even see a correlation between this 'magic number' and some internal bit-pattern, that becomes corrupted, somehow.

Is it a mis-declaration of variable 'type'?

Is it voodoo O0, in which case we need exorcism O:), or the voodoo-police :police:

Please don't tell me I need a new keyboard :'(

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 NKV

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 677
Re: Automatic ReScale of ADU data on <File><Open>
« Reply #17 on: 2010 January 31 06:48:24 »
Hi Juan.
For example, I have master Bias file (float 32bit in range 0-65535.99). Standard Deviation less then 1. One of a pixels in the file have value 2002.953
1) How to see the 2002.953 value in PI? ( I want see 3 or more digit after dot).
2) How to save to new file in range 0-65535.99 without rescaling ? ( I want see value 2002.953 in new file).

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Re: Automatic ReScale of ADU data on <File><Open>
« Reply #18 on: 2010 January 31 08:57:59 »
Quote
This is really weird. This is shooting in the dark, but are you using a wireless keyboard, by chance? I have seen spectacularly weird problems with wireless peripherals...

Yes Juan, I am using a (Logitech) wireless keyboard ???

...
Is it voodoo O0, in which case we need exorcism O:), or the voodoo-police :police:
...

I think it is highly unlikely that a wireless keyboard is causing this kind of issue. If this is confirmed, I will buy a bottle of holy water and sink by keyboard in it...  >:D :angel:

Georg
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)