<div dir="ltr"><div>I'm not sure I understand what you mean about UInt16 and UInt32 remaining integers. Do you mean for the special case? If yes, then they will remain integers.</div><div><br></div>I'm sorry, but I am not writing an interface to CFITSIO. If you want such an interface, then use the wrapped version.<div><br></div><div> -- Paul</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 11, 2024 at 12:55 PM Seaman, Robert Lewis - (rseaman) <<a href="mailto:rseaman@arizona.edu">rseaman@arizona.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg6012079796170631538">
<div lang="EN-US" style="overflow-wrap: break-word;">
<div class="m_6012079796170631538WordSection1">
<p class="MsoNormal">Hi Paul,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Just to be clear, the UInt16 and UInt32 would remain integers, right?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Whether or not you review CFITSIO code, applications layered on your code versus on CFITSIO should interoperate. This is particularly true for tile compression (which your package should support).<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Rob<u></u><u></u></p>
<div style="border-top:none;border-right:none;border-left:none;border-bottom:1pt solid windowtext;padding:0in 0in 1pt">
<p class="MsoNormal" style="border:none;padding:0in"><u></u> <u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div id="m_6012079796170631538mail-editor-reference-message-container">
<div>
<div>
<p class="MsoNormal" style="margin-left:0.5in">On 3/11/24, 9:01 AM, "Barrett, Paul" wrote:<u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-left:0.5in"><u></u> <u></u></p>
<div>
<p class="MsoNormal" style="margin-left:0.5in">If the input array is a UInt8, then a Float64 output array is overkill. A Float32 array should work just fine. This provides sufficient precision while saving memory. So using this line of thought, I would think
these mappings from integer input arrays to floating point output arrays would be reasonable.<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal" style="margin-left:0.5in"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:0.5in">UInt8 => Float32<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:0.5in">Int16 => Float32<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:0.5in">Int32 => Float64<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:0.5in">Int64 => Float64<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:0.5in"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:0.5in">By explicitly specifying this in the documentation, you would save future developers some time. They would not have to decipher how best to implement the code as I have done. Note that Julia does type inference,
like Python, unless the developer specifies otherwise. If BSCALE looks like an integer, because there is no decimal point, then Julia will interpret this as an integer, unless I coerce it to a float. I'm just confirming that this is what I should do using
the above mappings.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:0.5in"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:0.5in">I'm trying to support whatever the standard specifies. Being explicit would make this easier for me. I would prefer not to have to wade into the CFITSIO code to do so and I don't think other developers should have
to do so too.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:0.5in"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:0.5in"> -- Paul<u></u><u></u></p>
</div>
</div>
</div>
<p class="MsoNormal" style="margin-left:0.5in"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal" style="margin-left:0.5in">On Sun, Mar 10, 2024 at 12:17 PM Seaman, Robert Lewis - (rseaman) <<a href="mailto:rseaman@arizona.edu" target="_blank">rseaman@arizona.edu</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<div>
<p class="MsoNormal" style="margin-left:0.5in">
Hi Paul,<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">
<u></u><u></u></p>
<div id="m_6012079796170631538m_-8264937793714063958m_2825591748467855562mail-editor-reference-message-container">
<div>
<div>
<p class="MsoNormal" style="margin-left:1in">
<i>I'm writing a FITS package for the Julia programming language. I have a question about the output type of the image when BZERO is an integer value. The documentation implies that the output image should be a floating point type because the BSCALE value is
a float. Is this correct? If yes, then I recommend stating this explicitly in the FITS standard documentation. I also recommend suggesting the appropriate output type depending on the input type, e.g., UInt8 => Float32, Int16 => Float32, etc.</i><u></u><u></u></p>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-left:1in">
<i> </i><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">
Yes, that is the ancient implication of BSCALE. This carries over to lossy tile compression, too, which is a very fancy BSCALE operation if you look at it sideways.<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">
<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">
Undoubtedly there are other pending tweaks to the docs. This is hard to avoid with esoteric standards, especially perhaps if they survive through multiple generations of other contingent computer technologies.<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">
<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">
I’m not sure I understand your last sentence. Could you provide a table of the mappings you think should apply?<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">
<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">
To first order, other languages and libraries should start with the CFITSIO source for appropriate usage (or to suggest differently). One recommendation is that all FITS packages support tile compression.<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">
<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">
Rob Seaman<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">
Lunar and Planetary Laboratory<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">
University of Arizona<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:0.5in">
<u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div></blockquote></div>