Identifier sap_mean Purpose Compute the (weighted) mean of two spectra Synopsis sap_mean, in1flux, in1err, in2flux, in2err, outflux, outerr [,/weight] Arguments Name I/O Type Description ----------------------------------------------------- in1flux I Float(*) array of first spectrum (flux or photocurrents) in1err I Float(*) Array of weights for in1flux in2flux I Float(*) array of second spectrum in2err I Float(*) Array of weights for in2flx outflux O Float(*) the mean fluxes of Spectrum 1 and 2 outerr O Float(*) Array of uncertainties of outflux weight I switch if set: compute weighted mean Returns The (weighted) mean fluxes (or photocurrents) and their propagated errors. Description Adds two spectra and divides the result by 2. (unweighted mean. If weighting is desired (/weight is given) the weights are taken from the errors (stdev^2). For points where both errors are 0 the weights are set to 1 and the resulting error to 0. Comment The routine should be called from the "shell" ARITHM. If the switch /weight is set "mean" is performed with the square of the standard deviations as weights. Weighting with constants (like "(3.*arr1 + 2.*arr2)/5.") can be performed step by step - calling mult, add, and div. Weighting with artificial arrays of weights (e.g. containing zeros to mask out bad data points) is not supported in this first version (masking can be done in alternative ways). Example --- Dependencies CALLS: sap_error, sap_keyword_set CALLED FROM: arithm Category ISAP Filename sap_mean.pro Author A. Fiedler (--> AF) Version 1.0 History 0.1 27-09-95 AF 0.2 05-10-95 AF can handel zero and small errors 1.0 30-11-95 ES V1 delivery ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Copyright (C) 1995, Max-Planck-Institut fuer extraterrestrische Physik (MPE); Garching, Germany ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;