<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Bob and Brian,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
We've run into some problems when trying to import and apply gain maps, with values ranging from about 0.97 to 1.03, to Jiahui's data. After doing some digging, I've found that when the PE images are imported, the values are converted from floats to integers.
As far as I can tell, the conversion is happening in the code snippet below, from file G2img_1TIF.py, in function GetTifData.<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
elif sizexy == [2048,2048] or sizexy == [1024,1024] or sizexy == [3072,3072]:
<div> if IFD[273][2][0] == 8:</div>
<div> if IFD[258][2][0] == 32:</div>
<div> tifType = 'PE'</div>
<div> pixy = [200.,200.]</div>
<div> File.seek(8)</div>
<div> G2fil.G2Print ('Read APS PE-detector tiff file: '+filename)</div>
<div> if dataType == 5:</div>
<div> image = np.array(np.frombuffer(File.read(4*Npix),dtype=np.float32),dtype=np.int32) #fastest</div>
<div> else:</div>
image = np.array(np.frombuffer(File.read(4*Npix),dtype=np.int32),dtype=np.int32)<br>
</div>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
If I change the np.int32 to np.float32, the gain map can be read in, applied to data, and integrated successfully. I'm not sure what else I might have broken downstream when I do that, and there's still some funkiness with the slider bars for the intensities.
Can you implement a cleaner fix into the G2img code?</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Leighanne<br>
</div>
<div id="Signature">
<div>
<div></div>
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<div style="font-family:Tahoma; font-size:13px"><font size="2"><span style="font-size:10pt">--
<br>
Leighanne C. Gallington, Ph.D.<br>
Assistant Chemist<br>
Advanced Photon Source (X-ray Science Division)<br>
Argonne National Laboratory<br>
Argonne, IL 60439<br>
gallington@anl.gov</span></font></div>
</div>
</div>
</div>
</div>
</body>
</html>