[fitswcs] Units along spectral axes

Mark Calabretta mcalabre at atnf.CSIRO.AU
Tue Jun 14 00:54:34 EDT 2005


On Fri 2005/06/10 10:10:34 +0100, David Berry wrote
in a message to: Pedro Osuna <Pedro.Osuna at sciops.esa.int>
and copied to: FITSWCS <fitswcs at donar.cv.nrao.edu>,
      Jesus.Salgado at sciops.esa.int,
      William Thompson <William.T.Thompson.1 at gsfc.nasa.gov>

>I'm curious about this. Since a units parser will effectively do something
>equivalent to a dimensional analysis, what extra problems can your
>suggestion provide solutions for? Writing a unit parser, whilst not
>trivial, is not a huge job. Mark Calabretta says WCSLIB now has one. AST
>has one. Bill is writing one. And there are undoubtedly others that I do
>not know of. Adding support for deviant units is also, as Mark has pointed
>out, not difficult. The most difficult question is deciding where abouts
>to put the translation.

I think the question here is what would be the best approach if starting
over from scratch.  The dimensional analysis approach may be profitable
for VO, but since FITS already requires string parsing I don't think it
would be helpful to add another dialect of units specification.

While the dimensional approach promises to be easier to analyse, I think
the current spec is incomplete; I needed the following dimensional types
in analysing the units defined in WCS Paper I:

#define WCSUNITS_PLANE_ANGLE 0
#define WCSUNITS_SOLID_ANGLE 1
#define WCSUNITS_CHARGE      2
#define WCSUNITS_MOLE        3
#define WCSUNITS_TEMPERATURE 4
#define WCSUNITS_LUMINTEN    5
#define WCSUNITS_MASS        6
#define WCSUNITS_LENGTH      7
#define WCSUNITS_TIME        8
#define WCSUNITS_BEAM        9
#define WCSUNITS_BIN        10		...includes 'channel'
#define WCSUNITS_BIT        11
#define WCSUNITS_COUNT      12		...includes 'photon'
#define WCSUNITS_MAGNITUDE  13
#define WCSUNITS_PIXEL      14
#define WCSUNITS_SOLRATIO   15
#define WCSUNITS_VOXEL      16

In a physics context many of these would be considered dimensionless,
but for us 'count/bin' means something different from 'bit/pixel'.

To this you must add at least log() and ln(), and we also have exp().
This leads to three parameters for a units conversion: a scale, an
offset, and a power (see appended).

Mark Calabretta
ATNF

>>>

*   FITS units specification conversion; wcsunits()
*   -----------------------------------------------
*   wcsunits() derives the conversion from one system of units to another.
*
*   Given:
*      have     const char []
*                        FITS units specification to convert from (null-
*                        terminated), with or without surrounding square
*                        brackets (for inline specifications); text following
*                        the closing bracket is ignored.
*
*      want     const char []
*                        FITS units specification to convert to (null-
*                        terminated), with or without surrounding square
*                        brackets (for inline specifications); text following
*                        the closing bracket is ignored.
*
*   Returned:
*      scale    double*  Convert units using (scale*value + offset)^power.
*      offset   double*  Normally offset == 0.0 except for log() or ln()
*      power    double*  conversions, e.g. log(MHz) to ln(Hz).  Likewise,
*                        power == 1.0 except for exp() conversions, e.g.
*                        exp(ms) to exp(/Hz).
*
*   Function return value:
*               int      Status return value:
*                           0: Success.
*                         1-9: (status return from wcsulex(), see below.)
*                          10: Non-conformant unit specifications.
*                          11: Non-conformant functions.
*
*                        scale is zeroed on return if an error occurs.




More information about the fitswcs mailing list