-
Notifications
You must be signed in to change notification settings - Fork 0
/
casleored.cl
843 lines (710 loc) · 33.7 KB
/
casleored.cl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
################################################################################
#
# ===========================================================
# SCRIPT TO PERFORM ZEROCOMBINE, FLATCOMBINE, ETC..
# ===========================================================
#
# To run properly this procedure must be executed inside the package:
# 'noao.imred.ccdred'
#
# by Gabriel Perren 2009
#
################################################################################
bool check, check2
int j,k,q,h,i,n,m,e,o
struct *flist, *flist2, *flist3
struct line,line2,line3,line4
string file_name,file_name2,file_name3,BIASSEC,TRIMSEC,biassec2,trimsec2
real gain, rdnoise
# ------------------------------------------------------------------------------------
# Control 0
# ------------------------------------------------------------------------------------
print ('')
print (' Before running this script, the task "setairmass" must be used')
print (' inside the folder where ALL the frames (bias, flats and standars)')
print (' are, in the following way:')
print ('')
print (' setarimass *.fit')
print ('')
print (' This task is located inside: noao/astutil')
print ('')
print ('Is this correct (else exit)? (y/n)')
print ('')
scan (check)
if (check == yes) {
}
else {
bye()
}
# ------------------------------------------------------------------------------------
# Control 0
# ------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------
# Control 1
# ------------------------------------------------------------------------------------
if (! defpac ("ccdred")) {
print ('')
print (' This script must be loaded inside the package noao/imred/ccdred')
bye()
# ------------------------------------------------------------------------------------
# Control 1
# ------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------
# Activate following controls
# ------------------------------------------------------------------------------------
print ('-----------------------------------------------------------------')
print ('Activate remaining 3 controls? (y/n)')
print ('If you dont know what this is, you should answer "yes"')
print ('')
scan (check)
if (check == yes) {
# ------------------------------------------------------------------------------------
# 1º Control
# ------------------------------------------------------------------------------------
print ('-----------------------------------------------------------------')
print ('1st Control')
print ('TODOS LOS ARCHIVOS (FLATS, BIAS, FRAMES DE CUMULOS Y ESTANDARS)')
print ('DEBEN ENCONTRARSE EN LA CARPETA DE TRABAJO')
print ('')
print ('Se encuentran todos los archivos en la carpeta de trabajo? (y/n)')
print ('')
scan (check2)
if (check2 == yes) { # Do nothing
}
else {
bye()
}
# ------------------------------------------------------------------------------------
# 1º Control
# ------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------
# 2º Control
# ------------------------------------------------------------------------------------
print ('-----------------------------------------------------------------')
print ('2nd Control')
print ('Esta tarea asume que los nombres de las imagenes de FLATS, BIAS,')
print ('FRAMES DE CUMULOS y ESTANDARS se encuentran en el siguiente formato:')
print (' ')
print ('- para FLATS: "flatwx.fit" o "skywx.fit"; donde "w" representa la')
print ('letra del filtro correspondiente (U, B, V, R, I) y "x" representa')
print ('el numero de flat. De esta manera el tercer FLAT tomado en el filtro B')
print ('tendria como nombre: "flatb3.fit" o "skyb3.fit".')
print (' ')
print ('- para BIAS: "biasx.fit"; donde "x" representa el numero de bias.')
print ('De esta manera el bias numero 5 tendria como nombre: "bias5.fit".')
print (' ')
print ('- para FRAMES DE CUMULOS Y ESTANDARS: "abcdwx.fit"; donde "abcd"')
print ('representa las cuatro letras que identifican al cumulo correspondiente')
print ('(es indistinto las cuatro letras que sean), "w" representa la letra')
print ('que identifica, al filtro y "x" representa el tiempo de exposicion.')
print ('De esta manera un frame de 30 seg tomado en el filtro B para el cumulo')
print ('Bochum 13 tendria como nombre: "bo13b30.fit".')
print (' ')
print ('Son correctos los nombres de los archivos? (y/n)')
print ('')
scan (check2)
if (check2 == yes) { # Do nothnig
}
else {
bye()
}
# ------------------------------------------------------------------------------------
# 2º Control
# ------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------
# 3º Control
# ------------------------------------------------------------------------------------
print ('-----------------------------------------------------------------')
print ('3rd Control ')
print ('Es necesario conocer los valores de TRIMSEC y BIASSEC')
print ('(si es que son necesarios) en los pasos siguientes.')
print (' ')
print ('Conoce estos valores? (y/n)')
print ('')
scan (check2)
if (check2 == yes) { # Do nothnig
}
else {
bye()
}
# ------------------------------------------------------------------------------------
# 3º Control
# ------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------
# 4º Control
# ------------------------------------------------------------------------------------
#print ('-----------------------------------------------------------------')
#print ('4th Control')
#print ('IMPORTANTE')
#print ('ANTES de correr este script debe haber ingresado en la')
#print ('linea de comandos de IRAF (o debe estar configurado por')
#print ('defecto) la sentencia:')
#print ('')
#print ('setinstrument=direct')
#print (' ')
#print ('Ha ingresado el comando o se encuentra configurado por defecto? (y/n)')
#print ('')
#scan (check2)
#if (check2 == yes) { # Do nothnig
#}
#else {
# bye()
#}
setinstrument.instrument = "direct"
# ------------------------------------------------------------------------------------
# 4º Control
# ------------------------------------------------------------------------------------
}
else { # Do nothnig
}
# ------------------------------------------------------------------------------------
# End of 'Activate following controls'
# ------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------
# Add TRIMSEC, BIASSES, GAIN and RDNOISE to the image headers of all the files
# ------------------------------------------------------------------------------------
o = 1
h = 1
i = 1
while (o != 3) {
o=1
print ('Write BIASSEC to header? 1 = [25:1340,1301:1310], 2 = Other value, 3 = Do not write')
print ('(Not needed if no "overscan" correction is to be performed)')
print ('')
scan (q)
if (q == 2) {
print ('')
print ('Input BIASSEC with the following format: [num1:num2,num3:num4]')
print ('')
scan (BIASSEC)
}
else { # Do nothing
}
print ('')
print ('Write TRIMSEC to header?')
print ('(Not needed if no "trim" correction is to be performed)')
print ('1 = [25:1340,1:1299], 2= [10:1339,1:1295], 3 = Other value, 4 = Do not write')
print ('')
scan (e)
if (e == 3) {
print ('Input TRIMSEC with the following format: [num1:num2,num3:num4]')
print ('')
scan (TRIMSEC)
}
else { # Do nothing
}
if (q == 1) {
o = o+1
}
else {
if (q == 2) {
o = o+1
}
else {
if (q == 3) {
o = o+1
}
else {
o = o+0
print ('')
print ('Wrong number. Try again..')
print ('')
}
}
}
if (e == 1) {
o = o+1
}
else {
if (e == 2) {
o = o+1
}
else {
if (e == 3) {
o = o+1
}
else {
if (e == 4) {
o = o+1
}
else {
o = o+0
print ('')
print ('Wrong number. Try again.')
print ('')
}
}
}
}
} # This bracket closes the 'o != 3' while
print ('Adding TRIMSEC and BIASSEC...')
if (q == 1) {
hedit (images="*.fit", fields="BIASSEC", value="[25:1340,1301:1310]", add=yes, addonly=yes, delete=no, verify=no, update=yes)
biassec2 = "[25:1340,1301:1310]"
}
else {
if (q == 2) {
hedit (images="*.fit", fields="BIASSEC", value=(BIASSEC), add=yes, addonly=no, delete=no, verify=no, update=yes)
biassec2 = BIASSEC
}
else {
if (q == 3) {
h=2
hedit (images="*.fit", fields="BIASSEC", value="", add=yes, addonly=no, delete=no, verify=no, update=yes)
biassec2 = ""
}
else {
}
}
}
if (e == 1) {
hedit (images="*.fit", fields="TRIMSEC", value="[25:1340,1:1299]", add=yes, addonly=yes, delete=no, verify=no, update=yes)
trimsec2 = "[25:1340,1:1299]"
}
else {
if (e == 2) {
hedit (images="*.fit", fields="TRIMSEC", value="[10:1339,1:1295]", add=yes, addonly=no, delete=no, verify=no, update=yes)
trimsec2 = "[10:1339,1:1295]"
}
else {
if (e == 3) {
hedit (images="*.fit", fields="TRIMSEC", value=(TRIMSEC), add=yes, addonly=no, delete=no, verify=no, update=yes)
trimsec2 = TRIMSEC
}
else {
if (e == 4) {
i=2
hedit (images="*.fit", fields="TRIMSEC", value="", add=yes, addonly=no, delete=no, verify=no, update=yes)
trimsec2 = ""
}
else {
}
}
}
}
print ('Adding GAIN y RDNOISE...')
print ('')
print ('Input GAIN value (CASLEO: 3.98e/ADU)')
scan (gain)
print ('Input RDNOISE value (CASLEO: 4.09e)')
scan (rdnoise)
hedit (images="*.fit", fields="GAIN", value=(gain), add=no, addonly=yes, delete=no, verify=no, update=yes)
hedit (images="*.fit", fields="RDNOISE", value=(rdnoise), add=no, addonly=yes, delete=no, verify=no, update=yes)
print (gain,rdnoise, > "gain_rdnoise") # This file will be used by the 'casleopsf' script later on
# ------------------------------------------------------------------------------------
# End of 'Add TRIMSEC, BIASSES, GAIN and RDNOISE to the image headers of all the files'
# ------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------
# Move BIAS frames and create folder to move FLATS later on
# ------------------------------------------------------------------------------------
print ('Moving biad frames to folder bias/...')
print ('')
mkdir bias
mkdir flats # In this folder we'll store the FLATS frames later on
mv bias*.fit bias/
# ------------------------------------------------------------------------------------
# End of 'Move BIAS frames and create folder to move FLATS later on'
# ------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------
# Rfits on BIAS frames to set datatype="ushort" (pixel value max: 64000)
# ------------------------------------------------------------------------------------
print ('Rfits on BIAS frames to set datatype="ushort"...')
files bias/*.fit > fitfiles
rename (files="bias/*.fit", newname="fits", field="extn")
files bias/*.fits > fitsfiles
rfits (fits_file="@fitsfiles", file_list="0", iraf_file="@fitfiles", make_image=yes,
long_header=no, short_header=yes, datatype="ushort", blank=0., scale=yes, oldirafname=no,
offset=0)
delete bias/*.fits
delete fitfiles
delete fitsfiles
# ------------------------------------------------------------------------------------
# End of 'Rfits on BIAS frames to set datatype="ushort" (pixel value max: 64000)'
# ------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------
# Add missing data to FLAT image headers
# ------------------------------------------------------------------------------------
print ('Adding missing data to FLAT image headers')
print ('')
files sky*.* > temp.sky
files flat*.* > temp.flats
file_name2 = "temp.flats"
file_name3 = "temp.sky"
flist2 = file_name2
flist3 = file_name3
n=0
while (fscan (flist2,line3) != EOF) {
n = n + 1
}
m=0
while (fscan (flist3,line4) != EOF) {
m = m + 1
}
if (n == 0 && m != 0) {
print ('No flat*.* files')
print ('Using sky*.* files...')
k=2
sleep 2
}
else {
if (m == 0 && n != 0) {
print ('No sky*.* files')
print ('Using flat*.* files...')
k=1
sleep 2
}
else {
if (m == 0 && n == 0) {
print ('No FLAT files of any kind found.')
print ('Closing...')
sleep 2
bye()
}
else { # Do nothing
}
}
}
delete temp.flats
delete temp.sky
if (k == 1) {
hedit (images="flatu*.fit", fields="FILTERS", value="U", add=yes, addonly=no, delete=no, verify=no, update=yes)
hedit (images="flatb*.fit", fields="FILTERS", value="B", add=yes, addonly=no, delete=no, verify=no, update=yes)
hedit (images="flatv*.fit", fields="FILTERS", value="V", add=yes, addonly=no, delete=no, verify=no, update=yes)
hedit (images="flati*.fit", fields="FILTERS", value="I", add=yes, addonly=no, delete=no, verify=no, update=yes)
hedit (images="flat*.fit", fields="IMAGETYP", value="flat", add=yes, addonly=no, delete=no, verify=no, update=yes)
mv flat*.fit flats/
}
else {
if (k == 2){
hedit (images="skyu*.fit", fields="FILTERS", value="U", add=yes, addonly=yes, delete=no, verify=no, update=yes)
hedit (images="skyb*.fit", fields="FILTERS", value="B", add=yes, addonly=yes, delete=no, verify=no, update=yes)
hedit (images="skyv*.fit", fields="FILTERS", value="V", add=yes, addonly=yes, delete=no, verify=no, update=yes)
hedit (images="skyi*.fit", fields="FILTERS", value="I", add=yes, addonly=yes, delete=no, verify=no, update=yes)
hedit (images="sky*.fit", fields="IMAGETYP", value="flat", add=yes, addonly=yes, delete=no, verify=no, update=yes)
mv sky*.fit flats/
}
else {
print ('No FLAT files of any kind found.') # Redundant control.
print ('Closing...')
sleep 2
bye()
}
}
# ------------------------------------------------------------------------------------
# End of 'Add missing data to FLAT image headers'
# -----------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------
# Rfits on FLAT frames to set datatype="ushort" (pixel value max: 64000)
# ------------------------------------------------------------------------------------
print ('Rfits on FLAT frames...')
print ('')
files flats/*.fit > fitfiles
rename (files="flats/*.fit", newname="fits", field="extn")
files flats/*.fits > fitsfiles
rfits (fits_file="@fitsfiles", file_list="0", iraf_file="@fitfiles", make_image=yes,
long_header=no, short_header=yes, datatype="ushort", blank=0., scale=yes, oldirafname=no,
offset=0)
delete flats/*.fits
delete fitfiles
delete fitsfiles
# ------------------------------------------------------------------------------------
# End of 'Rfits on FLAT frames to set datatype="ushort" (pixel value max: 64000)'
# ------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------
# Add filter data to standards and clusters frame's image headers
# ------------------------------------------------------------------------------------
print ('')
print (' Adding filter data to standards and clusters frames image headers...')
files *.fit > fitfiles
file_name = "fitfiles"
flist = file_name
while (fscan (flist,line) != EOF) {
j = strlen (line)
if (substr (line, j-3, j) == ".fit") {
line2 = substr (line, 5, 5)
if (line2 == "u") {
hedit (images=(line), fields="FILTERS", value="U", add=yes, addonly=no, delete=no, verify=no, update=yes)
print (line, >> 'imagenes')
}
else {
if (line2 == "b") {
hedit (images=(line), fields="FILTERS", value="B", add=yes, addonly=no, delete=no, verify=no, update=yes)
print (line, >> 'imagenes')
}
else {
if (line2 == "v") {
hedit (images=(line), fields="FILTERS", value="V", add=yes, addonly=no, delete=no, verify=no, update=yes)
print (line, >> 'imagenes')
}
else {
if (line2 == "i") {
hedit (images=(line), fields="FILTERS", value="I", add=yes, addonly=no, delete=no, verify=no, update=yes)
print (line, >> 'imagenes')
}
else {
print ('ERROR IN FILENAME OF FILE: '//line)
print ('Filter value found: '//line2)
print ('Actual extension found: '//(substr (line, j-3, j))
print ('The file "imagenes" holds the names of the files correctly modified')
print ('Closing...')
bye()
}
}
}
}
}
else {
print ('ERROR IN FILENAME OF FILE: '//line)
print ('Actual extension found: '//(substr (line, j-3, j))
print ('The file "imagenes" holds the names of the files correctly modified')
print ('Closing...')
bye()
}
}
# ------------------------------------------------------------------------------------
# End of 'Add filter data to standards and clusters frame's image headers'
# ------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------
# Rfits on standards and clusters frames to set datatype="ushort" (pixel value max: 64000)
# ------------------------------------------------------------------------------------
print ('')
print ('Rfits on standards and clusters frames...')
print ('')
#files *.fit > fitfiles # Already done
rename (files="*.fit", newname="fits", field="extn")
files *.fits > fitsfiles
rfits (fits_file="@fitsfiles", file_list="0", iraf_file="@fitfiles", make_image=yes,
long_header=no, short_header=yes, datatype="ushort", blank=0., scale=yes, oldirafname=no,
offset=0)
delete *.fits
delete fitfiles
delete fitsfiles
# ------------------------------------------------------------------------------------
# End of 'Rfits on standards and clusters frames to set datatype="ushort" (pixel value max: 64000)'
# ------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------
# Zerocombine on BIAS frames
# ------------------------------------------------------------------------------------
zerocombine ("bias/bias*.fit",
output="Zero", combine="average", reject="minmax", ccdtype="zero", process=no,
delete=no, clobber=no, scale="none", statsec="", nlow=0, nhigh=1, nkeep=1,
mclip=yes, lsigma=3., hsigma=3., rdnoise="RDNOISE", gain="GAIN", snoise="0.",
pclip=-0.5, blank=0.)
# ------------------------------------------------------------------------------------
# End of 'Zerocombine on BIAS frames'
# ------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------
# 1º 'ccdproc' run to apply 'biassec', 'trimsec' and 'zerocor'
# ------------------------------------------------------------------------------------
#biassec (overscan)
#1 = [25:1340,1301:1310], 2 = Otro valor, 3 = Do not write (h = 2)
#trimsec (trim)
#1 = [25:1340,1:1299], 2= [10:1339,1:1295], 3 = Otro valor, 4 = Do not write (i = 2)
print ('')
print ('Ccdproc run to apply "overscan", "trim" and "zerocor"')
print ('')
print ('Standards and cluster frames...')
print ('')
if (h == 2 && i == 2) {
ccdproc ("*.fit",
output=" ", ccdtype=" ", max_cache=0, noproc=no, fixpix=no, overscan=no,
trim=no, zerocor=yes, darkcor=no, flatcor=no, illumcor=no, fringecor=no,
readcor=no, scancor=no, readaxis="line", fixfile=" ",
biassec="image", trimsec="image", zero="Zero", dark="",
flat=" ", illum=" ", fringe="", minreplace=1., scantype="shortscan", nscan=1,
interactive=no, function="chebyshev", order=4, sample="*", naverage=1,
niterate=1, low_reject=3., high_reject=3., grow=1.)
}
else {
if (h == 2 && i == 1) {
ccdproc ("*.fit",
output=" ", ccdtype=" ", max_cache=0, noproc=no, fixpix=no, overscan=no,
trim=yes, zerocor=yes, darkcor=no, flatcor=no, illumcor=no, fringecor=no,
readcor=no, scancor=no, readaxis="line", fixfile=" ",
biassec="image", trimsec="image", zero="Zero", dark="",
flat=" ", illum=" ", fringe="", minreplace=1., scantype="shortscan", nscan=1,
interactive=no, function="chebyshev", order=4, sample="*", naverage=1,
niterate=1, low_reject=3., high_reject=3., grow=1.)
}
else {
if (h ==1 && i == 2) {
ccdproc ("*.fit",
output=" ", ccdtype=" ", max_cache=0, noproc=no, fixpix=no, overscan=yes,
trim=no, zerocor=yes, darkcor=no, flatcor=no, illumcor=no, fringecor=no,
readcor=no, scancor=no, readaxis="line", fixfile=" ",
biassec="image", trimsec="image", zero="Zero", dark="",
flat=" ", illum=" ", fringe="", minreplace=1., scantype="shortscan", nscan=1,
interactive=no, function="chebyshev", order=4, sample="*", naverage=1,
niterate=1, low_reject=3., high_reject=3., grow=1.)
}
else { #(h == 1 && i == 1)
ccdproc ("*.fit",
output=" ", ccdtype=" ", max_cache=0, noproc=no, fixpix=no, overscan=yes,
trim=yes, zerocor=yes, darkcor=no, flatcor=no, illumcor=no, fringecor=no,
readcor=no, scancor=no, readaxis="line", fixfile=" ",
biassec="image", trimsec="image", zero="Zero", dark="",
flat=" ", illum=" ", fringe="", minreplace=1., scantype="shortscan", nscan=1,
interactive=no, function="chebyshev", order=4, sample="*", naverage=1,
niterate=1, low_reject=3., high_reject=3., grow=1.)
}
}
}
print ('')
print ('Flat frames...')
print ('')
if (h == 2 && i == 2) {
ccdproc ("flats/*.fit",
output=" ", ccdtype="flat", max_cache=0, noproc=no, fixpix=no, overscan=no,
trim=no, zerocor=yes, darkcor=no, flatcor=no, illumcor=no, fringecor=no,
readcor=no, scancor=no, readaxis="line", fixfile=" ",
biassec="image", trimsec="image", zero="Zero", dark="",
flat=" ", illum=" ", fringe="", minreplace=1., scantype="shortscan", nscan=1,
interactive=no, function="chebyshev", order=4, sample="*", naverage=1,
niterate=1, low_reject=3., high_reject=3., grow=1.)
}
else {
if (h == 2 && i == 1) {
ccdproc ("flats/*.fit",
output=" ", ccdtype="flat", max_cache=0, noproc=no, fixpix=no, overscan=no,
trim=yes, zerocor=yes, darkcor=no, flatcor=no, illumcor=no, fringecor=no,
readcor=no, scancor=no, readaxis="line", fixfile=" ",
biassec="image", trimsec="image", zero="Zero", dark="",
flat=" ", illum=" ", fringe="", minreplace=1., scantype="shortscan", nscan=1,
interactive=no, function="chebyshev", order=4, sample="*", naverage=1,
niterate=1, low_reject=3., high_reject=3., grow=1.)
}
else {
if (h ==1 && i == 2) {
ccdproc ("flats/*.fit",
output=" ", ccdtype="flat", max_cache=0, noproc=no, fixpix=no, overscan=yes,
trim=no, zerocor=yes, darkcor=no, flatcor=no, illumcor=no, fringecor=no,
readcor=no, scancor=no, readaxis="line", fixfile=" ",
biassec="image", trimsec="image", zero="Zero", dark="",
flat=" ", illum=" ", fringe="", minreplace=1., scantype="shortscan", nscan=1,
interactive=no, function="chebyshev", order=4, sample="*", naverage=1,
niterate=1, low_reject=3., high_reject=3., grow=1.)
}
else { #(h == 1 && i == 1)
ccdproc ("flats/*.fit",
output=" ", ccdtype="flat", max_cache=0, noproc=no, fixpix=no, overscan=yes,
trim=yes, zerocor=yes, darkcor=no, flatcor=no, illumcor=no, fringecor=no,
readcor=no, scancor=no, readaxis="line", fixfile=" ",
biassec="image", trimsec="image", zero="Zero", dark="",
flat=" ", illum=" ", fringe="", minreplace=1., scantype="shortscan", nscan=1,
interactive=no, function="chebyshev", order=4, sample="*", naverage=1,
niterate=1, low_reject=3., high_reject=3., grow=1.)
}
}
}
# ------------------------------------------------------------------------------------
# End of '1º 'ccdproc' run to apply 'biassec', 'trimsec' and 'zerocor''
# ------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------
# Flatcombine on flat frames
# ------------------------------------------------------------------------------------
unlearn ccdproc
ccdproc.output=" "
ccdproc.ccdtype="flat"
ccdproc.max_cache=0
ccdproc.noproc=no
ccdproc.fixpix=no
ccdproc.overscan=no
ccdproc.trim=no
ccdproc.zerocor=no
ccdproc.darkcor=no
ccdproc.flatcor=yes
ccdproc.illumcor=no
ccdproc.fringecor=no
readcor=no
ccdproc.scancor=no
ccdproc.readaxis="line"
ccdproc.fixfile=""
ccdproc.biassec="image"
ccdproc.trimsec="image"
ccdproc.zero="Zero"
ccdproc.dark=""
ccdproc.flat=" "
ccdproc.illum=" "
ccdproc.fringe=""
ccdproc.minreplace=1.
ccdproc.scantype="shortscan"
ccdproc.nscan=1
ccdproc.interactive=no
ccdproc.function="chebyshev"
ccdproc.order=4
ccdproc.sample="*"
ccdproc.naverage=1
ccdproc.niterate=1
ccdproc.low_reject=3.
ccdproc.high_reject=3.
ccdproc.grow=1.
print ('')
print ('Flatcombine on flat frames')
print ('')
if (k == 1) {
flatcombine ("flats/flat*.fit",
output="Flat", combine="average", reject="crreject", ccdtype="flat", process=yes,
subsets=yes, delete=no, clobber=no, scale="mode", statsec="", nlow=1, nhigh=1,
nkeep=1, mclip=yes, lsigma=3., hsigma=3., rdnoise=(rdnoise), gain=(gain),
snoise="0.", pclip=-0.5, blank=1.)
}
else {
if (k == 2){
flatcombine ("flats/sky*.fit",
output="Flat", combine="average", reject="crreject", ccdtype="flat", process=yes,
subsets=yes, delete=no, clobber=no, scale="mode", statsec="", nlow=1, nhigh=1,
nkeep=1, mclip=yes, lsigma=3., hsigma=3., rdnoise=(rdnoise), gain=(gain),
snoise="0.", pclip=-0.5, blank=1.)
}
else {
print ('No flat files found.') # Redundant control
print ('Closing...')
bye()
}
}
# ------------------------------------------------------------------------------------
# End of 'Flatcombine on flat frames'
# ------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------
# 2º 'ccdproc' run to apply 'flatcor'
# ------------------------------------------------------------------------------------
print ('')
print ('Ccdproc run to apply "flatcor"')
if (h == 2 && i == 2) {
ccdproc ("*.fit",
output=" ", ccdtype="object", max_cache=0, noproc=no, fixpix=no, overscan=no,
trim=no, zerocor=no, darkcor=no, flatcor=yes, illumcor=no, fringecor=no,
readcor=no, scancor=no, readaxis="column", fixfile=" ",
biassec="", trimsec="", zero="Zero", dark="",
flat="Flat*", illum=" ", fringe="", minreplace=1., scantype="shortscan",
nscan=1, interactive=no, function="chebyshev", order=4, sample="*",
naverage=1, niterate=1, low_reject=3., high_reject=3., grow=1.)
}
else {
ccdproc ("*.fit",
output=" ", ccdtype="object", max_cache=0, noproc=no, fixpix=no, overscan=no,
trim=no, zerocor=no, darkcor=no, flatcor=yes, illumcor=no, fringecor=no,
readcor=no, scancor=no, readaxis="column", fixfile=" ",
biassec=(biassec2), trimsec=(trimsec2), zero="Zero", dark="",
flat="Flat*", illum=" ", fringe="", minreplace=1., scantype="shortscan",
nscan=1, interactive=no, function="chebyshev", order=4, sample="*",
naverage=1, niterate=1, low_reject=3., high_reject=3., grow=1.)
}
mkdir calib
mv Flat*.* calib/ # Moves the Flat* files created by Flatcor and the Zero.out file created by Zerocor
mv Zero.* calib/ # to the folder "calib/"
# ------------------------------------------------------------------------------------
# End of '2º 'ccdproc' run to apply 'flatcor''
# ------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------
# Rotate the frames
# ------------------------------------------------------------------------------------
print ('')
print('Rotating the frames: [-*,*]')
imtranspose (input="*.fit[-*,*]", output="*.fit")
# ------------------------------------------------------------------------------------
# End of 'Rotate the frames'
# ------------------------------------------------------------------------------------
print ('')
print ('Script finished correctly! :)')
print ('')