~ubuntu-branches/debian/jessie/eso-midas/jessie

« back to all changes in this revision

Viewing changes to stdred/echelle/proc/necopt.prg

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2014-04-22 14:44:58 UTC
  • Revision ID: package-import@ubuntu.com-20140422144458-okiwi1assxkkiz39
Tags: upstream-13.09pl1.2+dfsg
ImportĀ upstreamĀ versionĀ 13.09pl1.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
! @(#)necopt.prg        19.1 (ESO-DMD) 02/25/03 14:19:40
 
2
! +++++++++++++++++++++++++++++++++++++++++++++++++
 
3
!
 
4
! .IDENTIFICATION
 
5
!
 
6
! ECHELLE PROCEDURE : ECHOPT.PRG
 
7
!  Michele Peron        version 1.0   sep91
 
8
!  Sebastian Wolf       version 2.0   apr99
 
9
!
 
10
! .PURPOSE
 
11
!
 
12
! execute the command : level 1
 
13
! EXTR/OPT in out slit,ord1,ord2 ron,g,sigma table coeffs calcw
 
14
!
 
15
! .RETURN       -1 on error, 0 on successful return.
 
16
!
 
17
! .HISTORY
 
18
! 1999.04.08-SW Compute the initial variance frame from
 
19
!               input frame, RON and GAIN. Here GAIN means the
 
20
!               inverse gain-factor, i.e. CONAD
 
21
! 1999.05.17-SW Do an optimal extraction using the weights of an previous
 
22
!               call to EXTRACT/OPTIMAL. This may be done by setting P7=NO
 
23
!               This is necessary for flatfielding optimal extracted science
 
24
!               spectra.
 
25
! 1999.06.11-SW Average the weights for each order and store in wbin.bdf
 
26
! 1999.09.08-SW The variance of the input frame and the variance of the
 
27
!               extracted data will be determined in any case of P7
 
28
!               P7 may accept the name of the weight map (e.g. Y,name).
 
29
 
30
! 020322        last modif
 
31
!
 
32
! --------------------------------------------------
 
33
!
 
34
define/param p1 ? I "Enter input image:"
 
35
define/param p2 ? I "Enter output extracted orders:"
 
36
define/param p3 ? N "Enter extraction pars(SLIT,ORD1,ORD2):"
 
37
define/param p4 {ron},{gain},{extsigma} N "Enter extraction pars (RON,G,SIGMA):"
 
38
define/param p5 {ordtab} TABLE "Enter auxiliary table:"
 
39
define/param p6 COEFF CHAR "Enter coeffs with order position:"
 
40
define/param p7 YES CHAR "Enter YES determine weights, NO apply weights:"
 
41
!
 
42
write/keyw in_a/c/1/60   {p1}
 
43
write/keyw out_a/c/1/60  {p2}
 
44
write/keyw out_b/c/1/60  " " all
 
45
write/keyw outputc/c/1/60  variance.bdf
 
46
write/keyw inputi/i/2/3  0,0
 
47
write/keyw inputi/i/1/3  {p3}
 
48
write/keyw inputr/r/1/3  {p4}
 
49
write/keyw in_b/c/1/60   {p5}
 
50
write/keyw inputc/c/1/8  {p6}
 
51
 
 
52
define/local ron/r/1/1 0.0
 
53
!
 
54
! compute the variance frame. The input frame is assumed to be only background
 
55
! subtracted (de-biased)
 
56
! The variance frame is in units of [ADU^2]:
 
57
!       V_ij = (RON / CONAD)^2 + |IN_ij|/CONAD ;
 
58
!       [RON] = e-, [CONAD] = e-/ADU, [GAIN] = ADU/e-
 
59
!
 
60
if inputr(2) .gt. 0.0 then
 
61
  ron = inputr(1) / INPUTR(2)   !RON in ADU
 
62
  ron = ron * ron                       !RON^2 in ADU
 
63
  compute/image {outputc} = {ron} + abs({p1}) / {inputr(2)}
 
64
else
 
65
  write/out "Error bad CONAD to determine variance frame!"
 
66
  return -1
 
67
endif
 
68
 
 
69
inputi(4) = m$index(p7,",") + 1 !Check for the name of the weight map
 
70
if inputi(4) .gt. 1 then
 
71
  out_b = p7({inputi(4)}:)
 
72
else
 
73
  out_b = "weight.bdf"
 
74
endif
 
75
 
 
76
inputi(4) = 0                   !Perform an optimal extraction with the
 
77
                                !weights of a previous call to EXTRACT/OPTIMAL
 
78
                                !(used for flatfields) if INPUTI(4) == 0
 
79
 
 
80
if p7(1:1) .eq. "Y" .or. p7(1:1) .eq. "y" -
 
81
   inputi(4) = 1                !otherwise determine the weights.
 
82
 
 
83
write/keyw out_a/c/1/60  {p2}
 
84
 
 
85
run STD_EXE:NECOPT
 
86
 
 
87
write/out "Optimal extraction done."
 
88
 
 
89
if inputi(4) .eq. 1 then
 
90
  define/local istp/i/1/1 1
 
91
  istp = m$value({out_b},npix(2)) / m$value({p2},npix(2))
 
92
  ! copy/dd {p2} *,3 {out_b}  (now done in necopt.exe)
 
93
  rebin/linear {out_b} wbin 1,{istp} 0,0
 
94
  copy/dd {p2} start,step wbin 
 
95
endif
 
96
!
 
97
return 0
 
98