-
Notifications
You must be signed in to change notification settings - Fork 0
/
Run_Vfree-Synthetic_Flat.py
executable file
·139 lines (97 loc) · 3.93 KB
/
Run_Vfree-Synthetic_Flat.py
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
#!/usr/bin/python
# Created by: Jose G. Fernandez Trincado
# Date: 2013 June 28
# Program: This program correct the imagen .fit (Science) by Syntethic Flat
# 1 m Reflector telescope, National Astronomical Observatory of Venezuela
# Mode f/5, 21 arcmin x 21 arcmin
# Project: Omega Centauri, Tidal Tails.
# The program Astrometry_V1.py defined was developed by J. G. Fernandez Trincado at the Centro de Investigaciones de Astronomia "Francisco J. Duarte".
# If you have any problems, please contact J. G. Fernandez Trincado, [email protected] / [email protected]
import numpy as np
import scipy as sc
import pyfits
import sys, os
from pyraf import iraf
#run, program.
#Example:
# Next program: ./Run_Vfree-Synthetic_Flat.py GrupoX.dat
# >>> GrupoX.dat/XXX.XX.XXX.XX.XXXX.hlv*
location='/home/jfernandez/Escritorio/Tesis_2013-2014_CIDA_ULA/Data_Tesis_2013_2014_CIDA-ULA/Reflector/'
if len(sys.argv[:]) < 2.:
print '***************************************************'
print 'Warning: ./Run_Vfree-Synthetic_Flat.py GrupoX.dat'
print '***************************************************'
else:
#Combine images MEDIAN
#TASK IRAF: images.immatch.imcombine
#Function to combine images for generates Master Flat
def Master_combina(inter_img,filt):
iraf.images.immatch()
iraf.images.immatch.output=filt
iraf.images.immatch.headers=''
iraf.images.immatch.bpmasks=''
iraf.images.immatch.rejmasks=''
iraf.images.immatch.nrejmasks=''
iraf.images.immatch.expmasks=''
iraf.images.immatch.sigmas=''
iraf.images.immatch.logfile='STDOUT'
iraf.images.immatch.combine='median'
iraf.images.immatch.reject='avsigclip'
iraf.images.immatch.project='no'
iraf.images.immatch.outtype='real'
iraf.images.immatch.outlimits=''
iraf.images.immatch.offsets='none'
iraf.images.immatch.masktype='none'
iraf.images.immatch.maskvalue=0.
iraf.images.immatch.blank=1.0
iraf.images.immatch.scale='mode'
iraf.images.immatch.zero='none'
iraf.images.immatch.weight='mode'
iraf.images.immatch.statsec=''
iraf.images.immatch.expname=''
iraf.images.immatch.lthreshold='INDEF'
iraf.images.immatch.hthreshold='INDEF'
iraf.images.immatch.nlow=1.
iraf.images.immatch.nhigh=1.
iraf.images.immatch.nkeep=1.
iraf.images.immatch.mclip='yes'
iraf.images.immatch.lsigma=3.
iraf.images.immatch.hsigma=3.
iraf.images.immatch.rdnoise=7.
iraf.images.immatch.gain=1.68
iraf.images.immatch.snoise=0.
iraf.images.immatch.sigscale=0.1
iraf.images.immatch.pclip=-0.5
iraf.images.immatch.grow=0.
iraf.images.immatch.imcombine(inter_img)
data=sc.genfromtxt(sys.argv[1],dtype=str)
#Lee lista dentro de los directorios, estas listas contienen la ruta de las imagenes ya clasificadas por filtro y tiempo de exposicion.
for i in np.arange(len(data)):
temp='/Initial_list_Syntethic_flat_'
os.system('ls '+data[i]+temp+'* >temporal_classified.dat')
data_clas=sc.genfromtxt('temporal_classified.dat',dtype=str)
for j in np.arange(len(data_clas)):
if data_clas[j] == data[i]+temp+'I60':
os.system('cat '+data[i]+temp+'I60 >> MasterFlat_I60_Good.dat')
elif data_clas[j] == data[i]+temp+'I90':
os.system('cat '+data[i]+temp+'I90 >> MasterFlat_I90_Good.dat')
elif data_clas[j] == data[i]+temp+'V60':
os.system('cat '+data[i]+temp+'V60 >> MasterFlat_V60_Good.dat')
elif data_clas[j] == data[i]+temp+'V90':
os.system('cat '+data[i]+temp+'V90 >> MasterFlat_V90_Good.dat')
else:
pass
os.system('rm temporal_classified.dat')
os.system('ls MasterFlat_*_Good.dat >list_temp_gen.dat')
data_end=sc.genfromtxt('list_temp_gen.dat',dtype=str)
for k in np.arange(len(data_end)):
print 'Generating Master Flat: '+data_end[k]
print ''
Master_combina('@'+data_end[k],data_end[k]+'.fit')
print 'End of the process'
print ''
for h in np.arange(len(data)):
os.system('cp '+data_end[k]+'.fit '+data[h]+'/')
os.system('rm '+data_end[k]+'.fit')
os.system('rm list_temp_gen.dat MasterFlat_*_Good.dat')
#END