# Generic integration in CLASS

We describe here what are the generic tools supporting the ASSOCIATED ARRAYS in CLASS and how the end-user can interact with them.

- The command ASSOCIATE allows the user to attach or detach an ASSOCIATED ARRAY to/from the current R buffer. Some other commands may also attach ASSOCIATED ARRAYS implicitly, e.g. the Herschel-HIFI FITS reader.
- The command DUMP can be used for a quick overview of the ASSOCIATED ARRAYS attached to the R buffer, if any.
- The ASSOCIATED ARRAYS are also instantiated in the Sic structure R%ASSOC% (read-only) for direct use by the end-user. For each array a sub-structure of the same name is provided, with the form:

      R%ASSOC%NAME%DIM2 =        0      ! Integer GLOBAL RO
      R%ASSOC%NAME%UNIT =               ! Character*12 GLOBAL RO
      R%ASSOC%NAME%BAD =      -1        ! Integer GLOBAL RO
      R%ASSOC%NAME%DATA is an integer Array of dimensions  8257

  where NAME is to be replaced by the array name.
- The arrays can be plotted thanks to the commands PLOT and SPECTRUM, passing their identifying name as first argument, e.g. PLOT LINE or SPECTRUM W.
- The command EXTRACT (spectrum and index mode) supports extracting a subset of RY and the same consistent subset of all ASSOCIATED ARRAYS.
- The commands SMOOTH, RESAMPLE, and FOLD apply the same exact engines on the ASSOCIATED ARRAYS as the ones which are used for RY. This is straightforward for floating point ASSOCIATED ARRAYS (reasonable solution for most physical quantities). For an integer ASSOCIATED ARRAY, the values are smoothed (resp. resampled) as floating point values and then rounded back to nearest integer (reasonable solution for integer physical quantities, e.g. counts). This solution is generic but may not be satisfying in all cases (e.g. flag arrays). No custom solution is possible yet.
- AVERAGE and its other flavors (ACCUMULATE, STITCH, RMS) support averaging the ASSOCIATED ARRAYS of the current index, as long as all the observations have the same number of ASSOCIATED ARRAYS, with the same name and in the same order. They are also averaged using a floating point engine as a generic solution (see above). All arrays are averaged except W, as it makes no sense to average the weight arrays (the resulting weight array is actually saved if SET WEIGHT is ASSOC.
- Finally, some commands may interpret a specific ASSOCIATED ARRAY when one is found. See the related ASSOCIATED ARRAY description for details.