diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
commit | fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch) | |
tree | bdda434976bc09c864f2e4fa6f16ba1952b1e555 /noao/twodspec/multispec/unblend.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'noao/twodspec/multispec/unblend.x')
-rw-r--r-- | noao/twodspec/multispec/unblend.x | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/noao/twodspec/multispec/unblend.x b/noao/twodspec/multispec/unblend.x new file mode 100644 index 00000000..707c6b49 --- /dev/null +++ b/noao/twodspec/multispec/unblend.x @@ -0,0 +1,38 @@ +include "ms.h" + +# UNBLEND -- Create unblended data profiles from a blended data line. +# +# For each point in each spectrum profile determine the corresponding column +# in the data line from the ranges array. If the model is non-zero then the +# data profile value for that spectrum is a fraction of the total data value +# at that point given by the fraction of that model profile to the total +# model at that point. + +procedure unblend (data, data_profiles, model, model_profiles, ranges, + len_line, len_profile, nspectra) + +real data[len_line] # Data line to be unblended +real data_profiles[len_profile, nspectra] # Output data profiles +real model[len_line] # Model line +real model_profiles[len_profile, nspectra] # Model profiles +real ranges[nspectra, LEN_RANGES] # Ranges for model profiles +int len_line # Length of data/model line +int len_profile # Length of each profile +int nspectra # Number of spectra + +int i, x, spectrum + +begin + do spectrum = 1, nspectra { + do i = 1, len_profile { + x = ranges[spectrum, X_START] + i - 1 + if ((x >= 1) && (x <= len_line)) { + if (model[x] > 0.) + data_profiles[i, spectrum] = + data[x] * model_profiles[i, spectrum] / model[x] + else + data_profiles[i, spectrum] = data[x] + } + } + } +end |