[fitsbits] The meaning and use of nonphysical FITS units {External}
Barrett, Paul
pebarrett at email.gwu.edu
Fri Jun 6 11:20:13 EDT 2025
Julia has Unitful and its associated packages such as UnitfulAstro that
handle units and their mathematical behaviour, so this is not an
implementation problem. However, it does not yet include the units of
photon, count, beam, etc., because they are dimensionless units. I will
have to add them.
These units are analogous to angular units, such as radians and degrees.
However, in this case, their relationship and behaviour are well
understood, so one can convert between radians and degrees and their
associated units without problems.
I must disagree that my question is beyond the FITS specification. Good
software design provides use cases that are used to inform and define the
specification. They help to illuminate corner cases that the software needs
to properly handle. Otherwise, the software will produce nonsense in these
situations. So I am basically asking a use case question and how it informs
and defines the FITS specification.
-- Paul
On Fri, Jun 6, 2025 at 10:51 AM Tiago Gomes <tiagogomes at fe.up.pt> wrote:
> Hi Paul,
>
> I'm not part of the FITS team in any way, so these are just my two cents,
> take it for what it is. However, I've worked quite a bit with FITS and
> units, so I may have some insight.
>
> - As I understand it, the specification itself does not attempt to
> specify any sort of behavior for operations between units, it merely
> defines how unit information should be stored. So, I would say that your
> question is actually completely outside what's covered by the specification
> and thus you likely won't have any sort of "officially correct" way of
> handling it. I'd say this is a layer above FITS, outside of what FITS
> itself actually cares about. As long as you can handle reading/writing the
> units specified in the specification, I would say you are completely within
> spec, so operations between units are just added convenience you are
> providing to your users.
> - If you are looking for implementation inspiration you may take a
> look at how Astropy handles units (look up "Astropy Quantity"). You can
> play around with units and you'll see it mostly makes sense. In their
> implementation, if you have 5 photons and divide by 2 counts you have...
> 2.5 photons / count. If you have 3 counts and multiply by 3 counts, you
> have 9 count^2. Do "photons / count" or "count^2" actually *mean*
> anything? I don't know, but I'd say you actually shouldn't care! That's for
> the user to decide. In short, my opinion is that if you have SI units and
> you know what to do with their operations, then do it; otherwise, just make
> it an explicit operation, and it's up to the user to decide how to
> interpret it.
>
> Hope that was useful in any way. Best of luck with your package.
>
> Cheers,
>
> Tiago
> On 2025-06-06 14:50, Barrett, Paul via fitsbits wrote:
>
> I am adding unit support to the Julia FITS package FITSFiles.jl. Table 4
> of the FITS specification (aka standard) lists several nonphysical units,
> such as *pixel, voxel, photon, count, beam,* etc. The relationship and
> usage of physical units is well known and understood, but this does not
> appear to be the case for nonphysical units. For example, is a *photon*
> equivalent to a *count* ? In other words, if I divide a *count* by a
> *photon*, is that unitless? And what does *count^2* mean? Can anyone
> explain this or should I just ignore it?
>
> - Paul
>
> --
> Paul Barrett, PhD
> Department of Physics
> The George Washington University
> Washington, DC 20052
>
>
> _______________________________________________
> fitsbits mailing listfitsbits at listmgr.nrao.eduhttps://listmgr.nrao.edu/mailman/listinfo/fitsbits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listmgr.nrao.edu/pipermail/fitsbits/attachments/20250606/b3fcb007/attachment-0001.html>
More information about the fitsbits
mailing list