aboutsummaryrefslogtreecommitdiff
path: root/noao/twodspec/multispec/unblend.x
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /noao/twodspec/multispec/unblend.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'noao/twodspec/multispec/unblend.x')
-rw-r--r--noao/twodspec/multispec/unblend.x38
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