Gui Arithm2

This function computes the arithmetic combinations of fluxes and standard deviations in two given AARS (referred in ISAP as primary and reference AAR).

The allowable arithmetic combinations are :

The Algorithm:

1. Both primary and reference AAR are examined for WAVE and FLUX units. If wave units are not the same, then the operation is terminated. Except for 'div' and 'mul' operations, flux units must also be the same .

2. For each wavelength in primary AAR, the closest point is found in reference wavelength array.  These closest wavelengths and all other associated data are saved to make arrays containing the same number of elements as in wavelengths of primary AAR

3. Compare  the above two arrays in wavelengths and find all the points satisfying the criteria
                     ABS(prim_wave - ref_wave) <= epsilon
where epsilon is the maximum separation for matching the two points. The default value of epsilon is half the distance between the two farthest adjacent values in wavelength of primary AAR. For 'div' operation, the fluxes in reference aar with zero values are also ignored.

4.  All zero or negative values of standard deviation in primary and reference data are replaced by 1.0

5. For all the points found in step 3,  the desired operation is performed as follows:

6.  The new AAR is constructed using the  primary header in primary AAR , remaking the secondary header for modified number of data points, and new values of flux and standard deviation as computed above. The standard deviations ,which were replaced by 1.0 in step 4, are set back to 0.

Masked data

The operation is performed on all the masked data in the primary AAR. However the masked data points in reference AAR are ignored.
 

Output AAR

The output AAR retains all the tags of primary AAR.