<div dir="ltr">Hi Matt and everyone:<div><br></div><div>I did the same 'experiments'! and I realized that I 'loose' information if I scale to 'uint16' . That's why I don't understand the problem because I have been told that </div><div>the <b>PIXEL VALUES </b>should remain the same <span style="font-size:12.8px">it's just that the dynamic range with the BITPIX=16,BZERO=32767 should be from 0 to 65535. As</span> I'm not clever enough I'm stuck in this step.. I'm guessing that later we need to use another astronomical tool that requires the images with BITPIX = 16. In my despair, I found this:</div><div><br></div><div><a href="https://github.com/varenius/salsa/blob/master/Control_program/spectrum.py">https://github.com/varenius/salsa/blob/master/Control_program/spectrum.py</a><br></div><div><br></div><div>where the important step is<br></div><div><br></div><div><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container" style="box-sizing:border-box;border-collapse:collapse;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:14px"><tbody style="box-sizing:border-box"><tr style="box-sizing:border-box"></tr><tr style="box-sizing:border-box"><td id="gmail-LC234" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;word-wrap:normal;white-space:pre"><span class="gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"><span class="gmail-pl-c" style="box-sizing:border-box">#</span>Since using  int16 as datatype we use bscale and bzero to keep dynamic range.
#SalsaJ cannot read bitpix correctly except 16 bit. If SalsaJ could read bitpix 
#</span>we could just have BITPIX -64 and skip Bscale, Bzero, i.e. just remove
#astype above.</td></tr><tr style="box-sizing:border-box"><td id="gmail-L235" class="gmail-blob-num gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td></tr></tbody></table></div><div><br></div><div><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container" style="box-sizing:border-box;border-collapse:collapse;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:14px"><tbody style="box-sizing:border-box"><tr style="box-sizing:border-box"><td id="gmail-LC229" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line" style="font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre"> datamin <span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">=</span> np.min(<span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197)">self</span>.data)
<div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;white-space:normal"><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container" style="box-sizing:border-box;border-collapse:collapse;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:14px"><tbody style="box-sizing:border-box"><tr style="box-sizing:border-box"><td id="gmail-LC230" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line" style="font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre">datamax <span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">=</span> np.max(<span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197)">self</span>.data)
bscale <span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">=</span> (datamax<span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">-</span>datamin)<span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">/</span><span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197)">65534.0 #shouldn't be 65535.0?
bzero <span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">=</span><span style="color:rgb(36,41,46)"> datamin</span><span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">+</span><span style="color:rgb(36,41,46)">bscale</span><span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">*</span><span class="gmail-pl-c1" style="box-sizing:border-box">32767.0
</span>scaledata <span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">=</span><span style="color:rgb(36,41,46)"> (</span><span class="gmail-pl-c1" style="box-sizing:border-box">self</span><span style="color:rgb(36,41,46)">.data </span><span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">-</span><span style="color:rgb(36,41,46)"> bzero)</span><span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">/</span><span style="color:rgb(36,41,46)">bscale
</span>
hdu.data <span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">=</span><span style="color:rgb(36,41,46)"> scaledata.reshape(</span><span class="gmail-pl-c1" style="box-sizing:border-box">1</span><span style="color:rgb(36,41,46)">, </span><span class="gmail-pl-c1" style="box-sizing:border-box">1</span><span style="color:rgb(36,41,46)">, </span><span class="gmail-pl-c1" style="box-sizing:border-box">self</span><span style="color:rgb(36,41,46)">.nchans).<b>astype(np.int16)</b></span></span></td></tr></tbody></table></div></td></tr></tbody></table></div><div><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container" style="box-sizing:border-box;border-collapse:collapse;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:14px"><tbody style="box-sizing:border-box"><tr style="box-sizing:border-box"><td id="gmail-LC234" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;word-wrap:normal;white-space:pre"><span class="gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"><br></span></td></tr><tr style="box-sizing:border-box"><td id="gmail-L235" class="gmail-blob-num gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-LC235" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;word-wrap:normal;white-space:pre"></td></tr></tbody></table></div><div>Shouldn't this <b>also changes </b>the values? (in this case, spectrum values). Also, </div><div>bscale ~ 1., bzero ~ 326767.</div><div><br></div><div>Thanks a lot,</div><div><br></div><div>Diego</div><div><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container" style="box-sizing:border-box;border-collapse:collapse;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:14px"><tbody style="box-sizing:border-box"><tr style="box-sizing:border-box"><td id="gmail-LC229" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;word-wrap:normal;white-space:pre"><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;white-space:normal"><br></div></td></tr><tr style="box-sizing:border-box"><td id="gmail-L230" class="gmail-blob-num gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-LC230" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;word-wrap:normal;white-space:pre"></td></tr></tbody></table></div><div><br></div><div><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container" style="box-sizing:border-box;border-collapse:collapse;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:14px"><tbody style="box-sizing:border-box"><tr style="box-sizing:border-box"><td id="gmail-LC237" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;word-wrap:normal;white-space:pre"><span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197)">
</span></td></tr><tr style="box-sizing:border-box"><td id="gmail-L238" class="gmail-blob-num gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"><br><br></td><td id="gmail-LC238" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;word-wrap:normal;white-space:pre">      </td></tr><tr style="box-sizing:border-box"><td id="gmail-L239" class="gmail-blob-num gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-LC239" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;word-wrap:normal;white-space:pre">        </td></tr><tr style="box-sizing:border-box"><td id="gmail-L240" class="gmail-blob-num gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-LC240" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;word-wrap:normal;white-space:pre">        </td></tr></tbody></table></div></div>