当前位置: 首页>>代码示例>>Python>>正文


Python AstroData.refresh_types方法代码示例

本文整理汇总了Python中astrodata.AstroData.refresh_types方法的典型用法代码示例。如果您正苦于以下问题:Python AstroData.refresh_types方法的具体用法?Python AstroData.refresh_types怎么用?Python AstroData.refresh_types使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在astrodata.AstroData的用法示例。


在下文中一共展示了AstroData.refresh_types方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_method_refresh_1

# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import refresh_types [as 别名]
def test_method_refresh_1():
    ad = AstroData(TESTFILE)
    ad.types.append("FOO")
    assert "FOO" in ad.types
    ad.refresh_types()
    assert "FOO" not in ad.types
开发者ID:mmorage,项目名称:DRAGONS,代码行数:8,代码来源:test_AstroDataAPI.py

示例2: test_method_refresh_3

# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import refresh_types [as 别名]
def test_method_refresh_3():
    ad = AstroData()
    ad.open(TESTFILE)
    ad.refresh_types()
    assert KNOWNSTAT in ad.types
开发者ID:mmorage,项目名称:DRAGONS,代码行数:7,代码来源:test_AstroDataAPI.py

示例3: as_astrodata

# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import refresh_types [as 别名]

#.........这里部分代码省略.........

        adout.phu.header.update('TILED', ['FALSE', 'TRUE'][tile],
                 'False: Image Mosaicked, True: tiled')

        # Set up extname lists with all the extension names that are going to 
        # be mosaiced and table extension names to associate.
        #
        if extname is None:                     # Let's work through all extensions
            if self.associated_im_extns:
                extname_list = self.associated_im_extns
            else:
                extname_list = self.im_extnames
        else:
            self.ref_extname = extname          # Redefine reference extname
            if extname in self.associated_im_extns:
                self.associated_im_extns = [extname]    # We need this extname only
                extname_list = [extname]
            elif extname in self.non_associated_extns: 
                # Extname is not in associated lists; so clear these lists.
                extname_list = []                       
                self.associated_im_extns = []
                self.associated_tab_extns = []
            elif extname in self.associated_tab_extns:
                # Extname is an associated bintable.
                extname_list = []                       
                self.associated_im_extns = []
                self.associated_tab_extns = [extname]
            else:
                extname_list = [extname]

        # ------ Create mosaic ndarrays, update the output WCS, create an 
        #        AstroData object and append to the output list. 
        
        # Make the list to have the order 'sci','var','dq'
        svdq = [k for k in ['SCI','VAR','DQ'] if k in extname_list]
        # add the rest of the extension names.
        extname_list = svdq + list(set(extname_list)-set(svdq))

        for extn in  extname_list:
            # Mosaic the IMAGE extensions now
            mosarray = self.mosaic_image_data(extn,tile=tile,block=block,
                                          return_ROI=return_ROI)
            # Create the mosaic FITS header using the reference 
            # extension header.
            header = self.mosaic_header(mosarray.shape,block,tile)

            # Generate WCS object to be used in the merging the object
            # catalog table for updating the objects pixel coordinates
            # w/r to the new crpix1,2.
            ref_wcs = pywcs.WCS(header)

            # Setup output AD 
            new_ext = AstroData(data=mosarray,header=header)

            # Reset extver to 1.
            new_ext.rename_ext(name=extn,ver=1)
            adout.append(new_ext)

        if return_associated_bintables:
            # If we have associated bintables with image extensions, then
            # merge the tables.
            for tab_extn in self.associated_tab_extns:
                # adout will get the merge table
                new_tab = self.merge_table_data(ref_wcs, tile, tab_extn, block, 
                            update_catalog_method) 
                adout.append(new_tab[0])
        
        # If we have a list of extension names that have not tables extension
        # names associated, then mosaic them.
        #
        if return_non_associations:
            for extn in self.non_associated_extns:
                # Now get the list of extver to append
                if extn in self.im_extnames:   #  Image extensions
                    # We need to mosaic image extensions having more
                    # than one extver.
                    #
                    if adin.count_exts(extn) > 1:
                        mosarray = self.mosaic_image_data(extn,
                                    tile=tile,block=block,
                                    return_ROI=return_ROI)

                        # Get reference extension header
                        header = self.mosaic_header(mosarray.shape,block,tile)
                        new_ext = AstroData(data=mosarray,header=header)

                        # Reset extver to 1.
                        new_ext.rename_ext(name=extn,ver=1)
                        adout.append(new_ext)
                    else:
                        self.log.warning("as_astrodata: extension '"+extn+\
                                         "' has 1 extension.")
                        adout.append(adin[extn])

                if extn in self.tab_extnames:   # We have a list of extvers
                    for extv in self.tab_extnames[extn]:
                        adout.append(adin[extn,extv]) 
        # rediscover classifications.
        adout.refresh_types()
        return adout
开发者ID:pyrrho314,项目名称:recipesystem,代码行数:104,代码来源:mosaicAD.py


注:本文中的astrodata.AstroData.refresh_types方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。