Author Topic: How can I use PixelMath to reduce the dynamic range of an image in a precise and  (Read 2929 times)

Offline MikeOates

  • PixInsight Addict
  • ***
  • Posts: 278
How can I use PixelMath to reduce the dynamic range of an image in a precise and linear way?

I have an model, it looks very much like a flat and is used as a flat using ImageCalibration on already calibrated images. The model maps the very slight variations of sensor sensitivity that a normal flat cannot achieve. This stage is absolutely required in order to extract very faint data out of the target, particularly faint galactic tidal flows and IFN

I am very close with it but I just need to make a slight linear adjustment to make it work as I want. But my knowledge of math and PixelMath means I can't get my head round how I can do this.

The stats of the image (model) are:
  mean 0.1532721
  median 0.1531901
  stdDev 0.0005209
  avgDev 0.0004960
  MAD 0.0004876
  minimum 0.1508893
  maximum 0.1558288

Using the max and min from the stats:
0.1558288 - 0.1508893 = 0.0049395

I want to (for example) reduce the dynamic range by 10% keeping the min at 0.1558288 and the max is adjusted to 0.1513833 (10% lower) and the rest of the data is kept linear between those points.

I also may want to increase the range rather than reduce.

I have uploaded a bin4x4 version of the model to use:
http://www.mikeoates.org/pi/nir_special_flat_bin4_20170319.xisf

Can anyone help?

Thank you,

Mike

PS: I have no idea why some of those numbers look like links!
« Last Edit: 2017 March 19 06:33:09 by MikeOates »

Offline RickS

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1298
Hi Mike,

I struggled a little to understand your example but perhaps this will help...

Try the PixelMath expression "($T-min($T))*scale+min($T)" using a symbol "scale=0.9".  This preserves the minimum value and linearly reduces the spread of the values by 10%.

If that's not what you meant just let me know and I can have another crack at it.

Cheers,
Rick.

Offline MikeOates

  • PixInsight Addict
  • ***
  • Posts: 278
Rick,

Thats exactly what I am after, I will check it out tonight.

Thank you very much, looks obvious in hindsight: read, "why did I not think of that"  :smiley:

Mike

Offline MikeOates

  • PixInsight Addict
  • ***
  • Posts: 278
Rick,

Yes that was what I wanted and it worked, many thanks.

Mike

Offline RickS

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1298
Thanks for letting me know, Mike.  I'd be interested to hear more about your process some time.  I have some data with very faint details and would appreciate any techniques for getting better results.

Cheers,
Rick.

Offline MikeOates

  • PixInsight Addict
  • ***
  • Posts: 278
Rick,

When I am happy with the process I will certainly let you know. Still some bugs to iron out.

It really only concerns imaging in NIR which causes an apparent slight variation of sensitivity on the sensor mainly around the edges. This is most likely caused by the cover window on the sensor, possibly polarisation? of the light due to stress variations in the cover material.

The effect is not removable in normal short exposure flats and you have to produce 'sky flats' of the night sky of your typical light exposure length, in my case 10/15min at bin 2x2

Although you can't see the problem with 'normal' images that are not pushed too much. They are very obvious when doing extreme stretches for IFN when it becomes a major problem, or not, if your happy to do a heavy crop instead!

Mike