comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Conversion floating point to byte or integer
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Conversion floating point to byte or integer [message #56296 is a reply to message #56292] Thu, 11 October 2007 14:04 Go to previous messageGo to previous message
M. Katz is currently offline  M. Katz
Messages: 69
Registered: May 2005
Member
You have to guard against byte values going below zero.
Here is what I would recommend.
1) Immediately convert the raw data into float, before any processing.
2) Subtract the background array but "crop" any negative values at
zero.
image1 = (raw_data - background ) > 0.
3) Then apply your calibration
image2 = image1 * calibration
If instead you have to divide by the calibration array, watch out
for zeros.
image2 = image1 / (calibration > 1.) might be a format you should
consider.
(The 1. here is just an example. It depends on your actual data.)

Of course be careful about spikes or zeros in the calibration
file or background file. Those can cause problems.

MKatz
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Minor IDL code changes cause large slowdowns elsewhere in code
Next Topic: Re: Problem while deleting shape file

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:25:25 PDT 2025

Total time taken to generate the page: 0.00439 seconds