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


Python AstroData.count_exts方法代码示例

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


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

示例1: test_method_count_exts_3

# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import count_exts [as 别名]
def test_method_count_exts_3():
    ad = AstroData(TESTFILE2)
    sci_exts = 1
    assert sci_exts == ad.count_exts('SCI')
开发者ID:mmorage,项目名称:DRAGONS,代码行数:6,代码来源:test_AstroDataAPI.py

示例2: atd4

# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import count_exts [as 别名]
def atd4():
    """
    Verify that a  mosaicAD class  method can create a tiled array from 
    extensions of a given name.

    The test creates a mosaic ndarray using the method mosaic_image_data 
    with the parameter 'tile=True'  which avoids the transformation step.

    """
    from astrodata import AstroData
    from gempy.adlibrary.mosaicAD import MosaicAD
    #     This is the default Mosaic function
    from gempy.mosaic.gemMosaicFunction import gemini_mosaic_function

    print '\n atd4 REQUIREMENT.......'
    print ('***** Given an AstroData object, the system shall tile all IMAGE extensions '
          'matching a given extension name')

    gmos_file='../data/gS20120420S0033.fits'
    gsaoi_file='../data/guS20120413S0048.fits'

    ad = AstroData(gmos_file)
    mo = MosaicAD(ad, gemini_mosaic_function)
    #     Now use the mosaic_image_data method to create
    #     the mosaic tile array from the 'SCI' extname.
    tile_data = mo.mosaic_image_data(tile=True, extname='SCI') 

    # ----- Comparing input and output. GMOS image 

    #     The tester should feel free to verify any input and output
    #     pixel location.

    #     For example: A GMOS image:
    #     The lower left corner (2x2) pixels the first GMOS 
    #     data extension. For a GSAOI is the second extension

    corner_gmos = ad['SCI',1].data   # For a GMOS file    
    print 'ad["SCI",1].data[:2,:2]\n',corner_gmos[:2,:2]

    #     From the output mosaic. We should get the same values.
    print 'tile_data[:2,:2]\n',tile_data[:2,:2]

    # The top right corner of the mosaic
    nexts = ad.count_exts('SCI')
    block = ad['SCI',nexts].data    # There is one amp per block
    print '\nad["SCI",last].data[-2:-2]\n',block[-2:,-2:]

    # The mosaic top corner
    print '\ntile_data[-2:,-2:]\n',tile_data[-2:,-2:]

    # ----- GSAOI data
    ad = AstroData(gsaoi_file)
    mo = MosaicAD(ad, gemini_mosaic_function)

    #     Now use the mosaic_image_data method to create
    #     the mosaic tile array from the 'SCI' extname.
    tile_data = mo.mosaic_image_data(tile=True, extname='SCI') 

    print '\nGSAOI data'
    corner_gsaoi = ad['SCI',2].data   # For a GSAOI file    
    print 'ad["SCI",2].data\n',corner_gsaoi[:2,:2]
    print 'tile_data[:2,:2]\n', tile_data[:2,:2]

    #     The top right corner of the mosaic
    block4 = ad['SCI',4].data    # There is one amp per block
    print '\nblock4[-2:,-2:]\n',block4[-2:,-2:]
    print 'tile_data[-2:,-2:]\n',tile_data[-2:,-2:]
开发者ID:pyrrho314,项目名称:recipesystem,代码行数:69,代码来源:rtf_mosaic.py

示例3: test_method_count_exts_1

# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import count_exts [as 别名]
def test_method_count_exts_1():
    ad = AstroData(TESTFILE)
    ad_len = len(ad)
    assert ad_len == ad.count_exts()
开发者ID:mmorage,项目名称:DRAGONS,代码行数:6,代码来源:test_AstroDataAPI.py

示例4: displayRequest

# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import count_exts [as 别名]
    def displayRequest(self, rq):
        print "adcc99:", repr(rq)
        if "display" in rq:
            dispcmd = rq["display"]
            dispcmd.update({"timestamp":datetime.now(),
                            "cmdNum":self.cmdNum})
            self.cmdNum += 1
            rqcopy = copy(rq)

            print "adcc108:", repr(rqcopy)
            if "files" in dispcmd:
                files = dispcmd["files"]
                print "adcc110:", repr(files)
                for basename in files:
                    fileitem = files[basename]
                    ad = AstroData(fileitem["filename"])
                    print "adcc115: loaded ",ad.filename
                    from copy import deepcopy

                    numsci = ad.count_exts("SCI")
                    if numsci > 2:
                        sci = ad[("SCI",2)]                    
                    else:
                        sci = ad[("SCI",1)]
                    data = sci.data
                    mean = data.mean()
                    bottom = data[where(data<mean)].mean()*.80
                    print "adcc140: bottom", bottom
                    top = data[where(data>(1.25*mean))].mean()
                    print "adcc142: top =",top
                    for sci in ad["SCI"]:
                        data = uint32(deepcopy(sci.data))
                        if False:
                            mean = data.mean()
                            bottom = data[where(data<mean)].mean()
                            extver = sci.extver()
                            if extver == 1 or extver ==3:
                                bottom = bottom*1.33
                            print "adcc140: bottom", bottom
                            top = data[where(data>(1.25*mean))].mean()
                            print "adcc142: top =",top
                        bottom = int(bottom)
                        top = int(top)
                        print "adcc164, extver -= %d top,bottom = %d,%d " \
                            %(sci.extver(),top, bottom)
                        abstop = 65535
                        factor = abstop/(top-bottom)
                        data = data - bottom
                        data = data*(factor)
                        im = numpy2im(data)
                        im = im.transpose(Image.FLIP_TOP_BOTTOM)
                        tdir = get_cache_dir("adcc.display")
                        dispname = "sci%d-%s_%d.png" % (sci.extver(), 
                                                     sci.data_label(),
                                                     dispcmd["cmdNum"])
                        nam = os.path.join(tdir, dispname)
                        put_cache_file(dispname, nam)

                        url = "/displaycache/"+dispname
                        baserq = rqcopy["display"]["files"][basename]
                        
                        if "extdict" not in baserq:
                            baserq.update({"extdict":{}})
                        baserq["extdict"].update(
                                             {"SCI%d"%sci.extver(): url }
                                          )
                        rqcopy["display"]["files"][basename].update({"url": None})
                        
                        if os.path.exists(nam):
                            os.remove(nam)
                        im.save(nam, "PNG")

        self.displayCmdHistory.addCmd(rqcopy)
        return
开发者ID:pyrrho314,项目名称:recipesystem,代码行数:76,代码来源:reduceInstanceManager.py


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