SPHERE.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:VLTPF 作者: avigan 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号