def _create_reductions(self):
'''
Detect and create valid reductions in path
'''
print('Create reductions from available data')
wpath = os.walk(self._path)
for w in wpath:
subs = w[1]
if 'raw' in subs:
# if directory has a raw/ sub-directory, make sure it
# has FITS files and that they are from a valid
# sub-system
reduction_path = w[0]
fits_files = glob.glob(os.path.join(reduction_path, 'raw', '*.fits'))
if len(fits_files) != 0:
hdr = fits.getheader(fits_files[0])
try:
arm = hdr['HIERARCH ESO SEQ ARM']
if arm == 'IRDIS':
instrument = 'IRDIS'
reduction = IRDIS.ImagingReduction(reduction_path)
self._IRDIS_reductions.append(reduction)
elif arm == 'IFS':
instrument = 'IFS'
reduction = IFS.Reduction(reduction_path)
self._IFS_reductions.append(reduction)
else:
raise NameError('Unknown arm {0}'.format(arm))
except:
continue
print(reduction_path)
print(' ==> {0}, {1} files'.format(instrument, len(fits_files)))
print()
# merge all reductions into a single list
self._reductions = self._IFS_reductions + self._IRDIS_reductions
评论列表
文章目录