Next: Implementation details
Up: class-associated-arrays
Previous: Nomenclature reminder
Contents
The concept of ASSOCIATED ARRAYS is introduced in CLASS. They are specified as
follows:
- The ASSOCIATED ARRAYS section is added to store 1 or more arrays of data
directly related to RY.
- The ASSOCIATED ARRAYS must be of size Nchan (1st dimension). A second
dimension can be used. Their X axis associated to the 1st dimension
is exactly described by RX. In other words, there is a
one-to-one channel relationship between the flux array RY and any
of the ASSOCIATED ARRAYS. This also means that any modification on the
spectroscopic section has a similar and consistent impact on RY and on the ASSOCIATED ARRAYS. This includes resizing the axis (EXTRACT) and
shift/stretch of the axis (MODIFY VELO|FREQ).
- The type and kind of data stored as an ASSOCIATED ARRAY is flexible, in the
limit of what the Gildas internal engines are used to (i.e. numeric
data types). Expected types are integer or real (floating point)
types. See details in Table
.
- An ASSOCIATED ARRAY is identified by its name (12 characters maximum). It
must be unique in one observation. The name may contain only
characters valid for Sic variable names (typically the alphanumeric
character set), so that the arrays can also be used as Sic
variables. The ASSOCIATED ARRAY may also provide a unit string (12 characters
maximum), left blank if not used. And it must provide a bad
(blanking) value, valid in the supported range of values
corresponding to the data format.
- There is no predefined/limited list of supported ASSOCIATED ARRAYS. Some may
be built and saved by the CLASS internal engines with a precise
definition (so-called RESERVED ASSOCIATED ARRAYS, see section
), others
may be created and saved by the user on his own choice. Examples
could be:
- a weight array
- a mask array
- wavelets
- fitted model and residuals
- etc.
One typical counter example which does not satisfy the rule in item
#2 is:
- the Fourier transform: its X axis (inverse frequency) is not
described by the spectroscopic section, EXTRACTing the same
subset of RY and FFT would be incorrect (the FT of a subset is
not the subset of the FT).
- Resampling and its other flavors (RESAMPLE, AVERAGE,
...) is a particular problem since CLASS has to know how the
values can be mixed (e.g. what is the meaning of resampling a
flag array?). There is no straightforward answer. Basic ideas are:
- the usual RY resampling engines can be opened for all
floating point arrays, and can be extended to integers (floating
point averaged then rounded back).
- a nearest neighbour algorithm could also be offered (may be
better suited for integers like boolean arrays).
- for RESERVED ASSOCIATED ARRAYS, the CLASS programmer can offer custom resampling
engines, suited exactly for a given array,
- one can think in hooks so that the users can describe
how the resampling works. Implementation is unclear at this stage.
- if CLASS does not have any solution for resampling, the
ultimate solution is to remove the ASSOCIATED ARRAY. Leaving it non-resampled
would violate the rules in item #2.
As of today, CLASS uses the first proposition as a generic
solution.
Table:
Type and kind of data supported for ASSOCIATED ARRAYS. Note that 4-bits and
2-bits integers are provided for storage on disk with low space
comsuption. In particular, 2-bits integers provide 4 possible values: they
are well suited for storing a boolean (0 and 1) and a bad value (e.g. -1).
Note also that in practice, integers smaller than 32 bits are always
loaded as INTEGER*4 in memory, so that Sic variables can be mapped on them
and the GILDAS tools can be used.
Internal code |
Equivalent Fortran |
Nbits |
Range of values |
Type and kind |
|
type and kind |
(disk) |
|
in memory |
fmt_r8 |
REAL*8 |
64 |
|
REAL*8 |
fmt_r4 |
REAL*4 |
32 |
|
REAL*4 |
fmt_i8 |
INTEGER*8 |
64 |
to  |
INTEGER*8 |
fmt_i4 |
INTEGER*4 |
32 |
to  |
INTEGER*4 |
fmt_i2 |
INTEGER*2 |
16 |
to  |
INTEGER*4 |
fmt_by |
INTEGER*1 |
8 |
to  |
INTEGER*4 |
fmt_b4 |
N/A |
4 |
to  |
INTEGER*4 |
fmt_b2 |
N/A |
2 |
to  |
INTEGER*4 |
Next: Implementation details
Up: class-associated-arrays
Previous: Nomenclature reminder
Contents
Gildas manager
2023-06-01