pixel math in python script need to preserve absolute vales

I am writing a script for automation in pysiril and want to preserve the scaled values in each pixel after math operations, but pm seems to want to re-scale between 0 and 1 before saving. I need 32 bit fits (not integer only) but I want the values to exceed 1.0 if that is what the math produces. For example:

app.Execute ("pm $orig$ * 100")
app.Execute ("SAVE fdsu")

in above the $ symbol got lost by this text interpreter, orig should be enclosed
When opening fdsu.fits the values are not 100 times the values in orig, but scaled to something much smaller, and some of the values should exceed 1.0.
Is there a way to preserve the real values? I do photometric measurements of sky brightness and need to keep the digital numbers from the original image scaled properly after the math operations and save as a floating point fits.

Doing test on my side, it gives expected results.
Original image:

22:58:08: Red layer: Mean: 0.9, Median: 1.0, Sigma: 2.8, Min: 0.0, Max: 867.1, bgnoise: 0.3
22:58:08: Green layer: Mean: 1.6, Median: 1.4, Sigma: 5.0, Min: 0.0, Max: 1130.8, bgnoise: 0.3
22:58:08: Blue layer: Mean: 1.1, Median: 1.0, Sigma: 3.9, Min: 0.0, Max: 1040.1, bgnoise: 0.3

After a pm * 1000

22:58:17: Red layer: Mean: 919.2, Median: 993.1, Sigma: 2825.7, Min: 0.0, Max: 867124.0, bgnoise: 311.6
22:58:17: Green layer: Mean: 1550.2, Median: 1377.9, Sigma: 5045.0, Min: 0.0, Max: 1130799.6, bgnoise: 305.2
22:58:17: Blue layer: Mean: 1064.5, Median: 1007.0, Sigma: 3927.8, Min: 0.0, Max: 1040131.8, bgnoise: 314.3

Hmmm, looks like the units of sky brightness are not cd/m^2 …

No this is just statistics here, pixel count.

Interactively in the GUI it works as expected. I am automating in pysiril with a script to do hundreds of images and saving the results for use later.

I did it with command line

deleted my post to avoid confusion.

Your post was informative :slight_smile:

figured it out. the original was a 16 bit tif file. when siril saves as fits 32 bit, the range is 0 to 1, so all the values are divided by 65536. Once that is known, the rest proceeds as expected. I had expected the tif to fits would preserve the original values.

It does, but if you change the bitdepth it will change the values.

that’s not good for photometry. Will it always divide by 65536 or does it rescale to the maximum value in the image?