diff options
Diffstat (limited to 'noao/onedspec/smw/smwmw.x')
-rw-r--r-- | noao/onedspec/smw/smwmw.x | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/noao/onedspec/smw/smwmw.x b/noao/onedspec/smw/smwmw.x new file mode 100644 index 00000000..a79aaf98 --- /dev/null +++ b/noao/onedspec/smw/smwmw.x @@ -0,0 +1,38 @@ +include <smw.h> + + +# SMW_MW -- Get MWCS pointer and coordinates from spectrum line and band + +procedure smw_mw (smw, line, band, mw, x, y) + +pointer smw #I SMW pointer +int line #I Spectrum line +int band #I Spectrum band +pointer mw #O MWCS pointer +int x, y #O MWCS coordinates + +real mw_c1tranr() + +begin + if (line < 1 || line > SMW_NSPEC(smw)) + call error (1, "smw_mw: spectrum not found") + + switch (SMW_FORMAT(smw)) { + case SMW_ND: + mw = SMW_MW(smw,0) + x = mod (line - 1, SMW_LLEN(smw,2)) + 1 + y = (line - 1) / SMW_LLEN(smw,2) + band + default: + if (SMW_NMW(smw) == 1) { + mw = SMW_MW(smw,0) + x = line + y = band + if (SMW_CTLP(smw) != NULL) + x = nint (mw_c1tranr (SMW_CTLP(smw), real(line))) + } else { + mw = SMW_MW(smw,(line-1)/SMW_NSPLIT) + x = mod (line - 1, SMW_NSPLIT) + 1 + y = band + } + } +end |