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

« back to all changes in this revision

Viewing changes to contrib/pepsys/proc/dcon.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
! @(#)dcon.prg  19.1 (ES0-DMD) 02/25/03 13:28:59
 
2
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
3
!.IDENTIFICATION: DCON.PRG
 
4
!.PURPOSE:        Convert data from raw to MIDAS *.tbl form.
 
5
!.USE:            CONVERT/PHOT
 
6
!.AUTHOR:         Andrew T. Young
 
7
! ----------------------------------------------------------------------
 
8
!
 
9
! ********* DEFINE LOCAL KEYWORDS  **********
 
10
!
 
11
DEFINE/LOCAL reply/C/1/12 "?" A
 
12
DEFINE/LOCAL type/C/1/6 "?" A
 
13
DEFINE/LOCAL rawdat/C/1/80 " " A
 
14
DEFINE/LOCAL tblfil/C/1/80 " " A
 
15
DEFINE/LOCAL datfil/C/1/80 "data.dat"
 
16
DEFINE/LOCAL fmtfil/C/1/80 "data.fmt"
 
17
DEFINE/LOCAL obstbl/C/1/80 "esotel.tbl"
 
18
DEFINE/LOCAL nrows/I/1/1 1
 
19
!
 
20
! ********* BEGIN EXECUTION  **********
 
21
!
 
22
WRITE/OUT " "
 
23
WRITE/OUT " "
 
24
WRITE/OUT "The CONVERT/PHOT command will make a new data-table file for you."
 
25
WRITE/OUT " "
 
26
WRITE/OUT "You should have a file of raw data from the telescope to convert."
 
27
WRITE/OUT " "
 
28
WRITE/OUT " "
 
29
WRITE/OUT "   It will be useful to embed date information in file names."
 
30
WRITE/OUT " "
 
31
WRITE/OUT " "
 
32
WRITE/OUT " "
 
33
!
 
34
AskTbl:
 
35
INQUIRE/KEYW tblfil "What name do you want to give the new DATA-TABLE file?"
 
36
IF M$INDEX(tblfil,".tbl") .ne. 0 THEN
 
37
    ! name already has .tbl ext.
 
38
    WRITE/OUT "(new file will be named" {tblfil} ")"
 
39
ELSE
 
40
    WRITE/OUT "(new file will be named" {tblfil}.tbl ")"
 
41
    WRITE/KEYW tblfil {tblfil}.tbl
 
42
ENDIF
 
43
!
 
44
WRITE/OUT " "
 
45
!
 
46
IF M$EXIST(tblfil) .eq. 0 THEN
 
47
   ! OK, no such file.
 
48
ELSE
 
49
   AskWrite:
 
50
   WRITE/OUT {tblfil} "already exists!"
 
51
   INQUIRE/KEYW reply "OK to write over it?"
 
52
   !
 
53
   IF  reply(:1) .eq. "y" THEN
 
54
      WRITE/OUT " "
 
55
      WRITE/OUT {tblfil} "will be re-written."
 
56
   ELSEIF reply(:1) .eq. "n" THEN
 
57
      WRITE/OUT " "
 
58
      WRITE/OUT "Here are the files in your current directory:"
 
59
      WRITE/OUT " "
 
60
      IF AUX_MODE(1) .LE. 1 THEN ! VMS
 
61
         $ DIR
 
62
      ELSE                      ! UNIX
 
63
         $ ls
 
64
      ENDIF
 
65
      WRITE/OUT " "
 
66
      WRITE/OUT "Please select a new name."
 
67
      GOTO AskTbl
 
68
   ELSE
 
69
      WRITE/OUT "Please reply YES or NO."
 
70
      GOTO AskWrite
 
71
   ENDIF
 
72
ENDIF
 
73
 
 
74
AskRaw:
 
75
WRITE/OUT " "
 
76
WRITE/OUT " "
 
77
rawdat = "                                                    "
 
78
INQUIRE/KEYW rawdat "What is the name of the RAW data file?"
 
79
!
 
80
IF M$EXIST(rawdat) .eq. 0 THEN
 
81
   WRITE/OUT "(Cannot find {rawdat})"
 
82
   WRITE/OUT " "
 
83
   WRITE/OUT "Sorry, no such file exists.  Be sure the name is right."
 
84
   WRITE/OUT " "
 
85
   WRITE/OUT "Here are the files in your current directory:"
 
86
   WRITE/OUT " "
 
87
   IF AUX_MODE(1) .LE. 1 THEN ! VMS
 
88
      $ DIR
 
89
   ELSE                 ! UNIX
 
90
      $ ls
 
91
   ENDIF
 
92
   GOTO AskRaw
 
93
ELSEIF rawdat(:4) .eq. "quit" THEN
 
94
   RETURN/EXIT
 
95
ELSE
 
96
   WRITE/OUT "OK," {rawdat} "is found."
 
97
   WRITE/OUT " "
 
98
ENDIF
 
99
 
 
100
! Make sure esotel.tbl is available...
 
101
    IF M$EXIST("esotel.tbl") .eq. 0 THEN        ! not available
 
102
        IF AUX_MODE(1) .LE. 1 THEN              ! VMS
 
103
           define/local peplib/c/1/60 -
 
104
             "MID_DISK:[&MID_PEPSYS] "
 
105
           $ COPY {peplib}esotel.tbl []
 
106
           $ SET PROT=(O:RWED) esotel.tbl
 
107
        ELSE                                    ! UNIX
 
108
           define/local peplib/c/1/60 "$MID_PEPSYS/"
 
109
           $ cp {peplib}esotel.tbl `pwd`
 
110
           $ chmod 644 esotel.tbl
 
111
        ENDIF
 
112
        WRITE/OUT " "
 
113
        WRITE/OUT "The standard Observatory file    esotel.tbl"
 
114
        WRITE/OUT "has been copied into your working directory."
 
115
        WRITE/OUT " "
 
116
    ENDIF
 
117
 
 
118
AskType:
 
119
WRITE/OUT " "
 
120
WRITE/OUT " "
 
121
WRITE/OUT "The following formats are supported and cna be converted:"
 
122
WRITE/OUT "      DANISH (D)"
 
123
WRITE/OUT "      ESO 50 cm (ESO50)"
 
124
WRITE/OUT "      ESO standard (E)"
 
125
WRITE/OUT "and    OTHER (O) format"
 
126
WRITE/OUT " "
 
127
INQUIRE/KEYW reply "In which format is the raw data:"
 
128
IF reply(:1) .eq. "D" THEN              ! Danish format
 
129
!
 
130
    RUN CON_EXE:DANISH
 
131
    !
 
132
    ! Make sure it terminated normally:
 
133
    !
 
134
    IF APPLIC(1:1) .EQ. "X" THEN
 
135
       RETURN/EXIT
 
136
    ENDIF
 
137
    !
 
138
    WRITE/KEYW type "Danish"
 
139
!
 
140
ELSEIF reply(1:5) .eq. "ESO50" THEN     ! ESO 50cm photometer format
 
141
!
 
142
    WRITE/KEYW  IN_A/C/1/60 {rawdat}
 
143
    WRITE/KEYW  OUT_A/C/1/60 {tblfil}
 
144
    RUN CON_EXE:ESO50
 
145
    !
 
146
    ! Make sure it terminated normally:
 
147
    !
 
148
    IF APPLIC(1:1) .EQ. "X" THEN
 
149
       RETURN/EXIT
 
150
    ENDIF
 
151
    !
 
152
    WRITE/KEYW type "ESO50"
 
153
    GOTO READ
 
154
!
 
155
ELSEIF reply(:1) .eq. "E" THEN          ! ESO format
 
156
!
 
157
    RUN CON_EXE:ESODCON
 
158
    !
 
159
    ! Make sure it terminated normally:
 
160
    !
 
161
    IF APPLIC(1:1) .EQ. "X" THEN
 
162
       RETURN/EXIT
 
163
    ENDIF
 
164
    !
 
165
    WRITE/KEYW type "ESO"
 
166
!
 
167
ELSEIF reply(:1) .eq. "O" THEN          ! other format
 
168
!
 
169
    WRITE/OUT "Sorry -- you have to convert those data yourself."
 
170
    RETURN/EXIT
 
171
!
 
172
ELSE
 
173
    WRITE/OUT "Please answer DANISH, ESO50, ESO, or OTHER."
 
174
    GOTO AskType
 
175
ENDIF
 
176
!
 
177
! *** Here check for the data and format file and create the table
 
178
!     Only for the D and E format; the ESO50 table are created directly
 
179
WRITE/OUT " "
 
180
WRITE/OUT " "
 
181
!       (*dcon programs create files "data.dat" and "data.fmt")
 
182
IF M$EXIST(datfil) .eq. 0 THEN
 
183
   WRITE/OUT "ERROR -- Could not find " {datfil}
 
184
   WRITE/OUT " "
 
185
   WRITE/OUT "Probably the data could not be converted."
 
186
   WRITE/OUT "Please make sure your raw data are clean."
 
187
   RETURN/EXIT
 
188
ELSE
 
189
   WRITE/OUT {datfil} "has been created."
 
190
ENDIF
 
191
 
 
192
IF M$EXIST(fmtfil) .eq. 0 THEN
 
193
   WRITE/OUT " "
 
194
   WRITE/OUT "ERROR -- Could not find " {fmtfil}
 
195
   WRITE/OUT " "
 
196
   WRITE/OUT "Probably the data could not be converted."
 
197
   WRITE/OUT "Please make sure your raw data are clean."
 
198
   RETURN/EXIT
 
199
ELSE
 
200
   WRITE/OUT {fmtfil} "has been created."
 
201
ENDIF
 
202
!
 
203
WRITE/OUT " "
 
204
WRITE/OUT "Creating the table (may take a while) ..."
 
205
CREATE/TABLE {tblfil} 1 1 {datfil} {fmtfil}
 
206
WRITE/OUT " "
 
207
WRITE/OUT "Observational-data table file" {tblfil} "has been created."
 
208
WRITE/OUT "Here are the first 5 lines:"
 
209
WRITE/OUT " "
 
210
!
 
211
READ:
 
212
! *** Table created; read it
 
213
READ/TABLE {tblfil} @1..5
 
214
!
 
215
 
 
216
WRITE/OUT " "
 
217
WRITE/OUT " "
 
218
INQUIRE/KEYW reply "Do you have a star-table file for your program stars?"
 
219
!
 
220
WRITE/OUT " "
 
221
IF reply(:1) .eq. "y" THEN
 
222
   WRITE/OUT "Good.  You can now reduce these data with REDUCE/PHOT."
 
223
 
 
224
ELSEIF reply(:1) .eq. "n" THEN
 
225
   WRITE/OUT " "
 
226
   WRITE/OUT " "
 
227
   WRITE/OUT "If you can find accurate coordinates for them, create"
 
228
   WRITE/OUT "an ASCII table of the coordinate data, and use the"
 
229
   WRITE/OUT "MAKE/STARTABLE command to convert it to MIDAS *.tbl format."
 
230
   WRITE/OUT " "
 
231
   WRITE/OUT "You should be able to get good coordinates from STARCAT."
 
232
   WRITE/OUT " "
 
233
   WRITE/OUT " "
 
234
   WRITE/OUT "It is possible to extract rough coordinates from the" {type}
 
235
   WRITE/OUT "data themselves.  However, these values may be in error by an"
 
236
   WRITE/OUT "unknown amount, and this procedure is NOT recommended."
 
237
   WRITE/OUT " "
 
238
   WRITE/OUT "Do you want to try to extract coordinates from" {rawdat} "?"
 
239
   INQUIRE/KEYW reply "?"
 
240
   !
 
241
   IF reply(:1) .eq. "y" THEN
 
242
      WRITE/OUT " "
 
243
      WRITE/OUT " "
 
244
      WRITE/OUT " "
 
245
      WRITE/OUT "                      W A R N I N G"
 
246
      WRITE/OUT " "
 
247
      WRITE/OUT " "
 
248
      WRITE/OUT "You are at the mercy of whoever last adjusted the coordinate"
 
249
      WRITE/OUT "zero-points of the telescope control system!  The results may"
 
250
      WRITE/OUT "be in ERROR by an UNKNOWN amount.  This is the last warning"
 
251
      WRITE/OUT "you will have that there may be serious systematic errors."
 
252
      WRITE/OUT " "
 
253
      WRITE/OUT " "
 
254
      INQUIRE/KEYW reply "            Do you REALLY want to do this ???"
 
255
      IF reply(:1) .eq. "y" THEN
 
256
         WRITE/OUT " "
 
257
         WRITE/OUT " "
 
258
         WRITE/OUT " "
 
259
         WRITE/OUT "                    YOU HAVE BEEN WARNED."
 
260
         WRITE/OUT " "
 
261
         WRITE/OUT " "
 
262
         WRITE/OUT " "
 
263
         WRITE/KEYW tblfil/C/1/80 " " ALL       ! clear the damn keyword
 
264
         INQUIRE/KEYW tblfil "What do you want to call the program-star table?"
 
265
         !
 
266
         IF M$EXIST(tblfil) .eq. 0 THEN
 
267
            ! OK, no such file.
 
268
         ELSE
 
269
            BadName:
 
270
            WRITE/OUT {tblfil} "already exists!"
 
271
            INQUIRE/KEYW reply "OK to write over it?"
 
272
            !
 
273
            IF  reply(:1) .eq. "y" THEN
 
274
               WRITE/OUT {tblfil} "will be re-written."
 
275
            ELSEIF reply(:1) .eq. "n" THEN
 
276
               WRITE/OUT " "
 
277
               WRITE/OUT "Here are the files in your current directory:"
 
278
               WRITE/OUT " "
 
279
               IF AUX_MODE(1) .LE. 1 THEN ! VMS
 
280
                  $ DIR
 
281
               ELSE                     ! UNIX
 
282
                  $ ls
 
283
               ENDIF
 
284
               WRITE/OUT " "
 
285
               WRITE/OUT "Please select a new name."
 
286
               GOTO AskTbl
 
287
            ELSE
 
288
               WRITE/OUT "Please reply YES or NO."
 
289
               GOTO BadName
 
290
            ENDIF
 
291
         ENDIF
 
292
         !
 
293
         WRITE/OUT "Extracting stars..."
 
294
         !
 
295
         IF type(:1) .eq. "D" THEN
 
296
            WRITE/OUT " "
 
297
            ! run danstarx
 
298
            RUN CON_EXE:DANSTARX
 
299
            !
 
300
            ! Make sure it terminated normally:
 
301
            !
 
302
            IF APPLIC(1:1) .EQ. "X" THEN
 
303
               RETURN/EXIT
 
304
            ENDIF
 
305
            !
 
306
         ELSEIF type(:1) .eq. "E" THEN
 
307
            ! run esodstarx
 
308
            RUN CON_EXE:ESODSTARX
 
309
            !
 
310
            ! Make sure it terminated normally:
 
311
            !
 
312
            IF APPLIC(1:1) .EQ. "X" THEN
 
313
               RETURN/EXIT
 
314
            ENDIF
 
315
            !
 
316
         ENDIF
 
317
         !
 
318
         WRITE/OUT "Creating sdata.tbl (may take some time)..."
 
319
         CREATE/TABLE sdata.tbl 1 1 sdata.dat sdata.fmt
 
320
         !
 
321
         WRITE/OUT "Combining multiple positions..."
 
322
         ! run meanstar
 
323
         RUN CON_EXE:MEANSTAR
 
324
         !
 
325
         ! Make sure it terminated normally:
 
326
         !
 
327
         IF APPLIC(1:1) .EQ. "X" THEN
 
328
            RETURN/EXIT
 
329
         ENDIF
 
330
         !
 
331
         WRITE/OUT " "
 
332
         WRITE/OUT "Program star positions are in " {tblfil}
 
333
         WRITE/OUT " "
 
334
         WRITE/OUT "Here are the first 10 lines:"
 
335
         WRITE/OUT " "
 
336
         READ/TABLE {tblfil} @1..10
 
337
         WRITE/OUT " "
 
338
      ELSE
 
339
         WRITE/OUT " "
 
340
         WRITE/OUT "Please use Starcat and MAKE/STARTABLE before REDUCE/PHOT."
 
341
      ENDIF
 
342
   ELSEIF reply(:1) .eq. "n" THEN
 
343
      WRITE/OUT " "
 
344
      WRITE/OUT "Please use Starcat and MAKE/STARTABLE before REDUCE/PHOT."
 
345
!   ELSE
 
346
   ENDIF
 
347
   !
 
348
!ELSE
 
349
ENDIF