• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python pyfits.info函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyfits.info函数的典型用法代码示例。如果您正苦于以下问题:Python info函数的具体用法?Python info怎么用?Python info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: example1

def example1():

    import sys
    import scipy as sp
    import numpy as np
    import matplotlib as mpl
    import matplotlib.pyplot as plt
    import pyfits

   #Path to fits file to be imported                                                                         
    data1 = "/Users/destry/Documents/Github/truffles_examples/GALFA_HI_RA+DEC_092.00+10.35_W.fits"

    #Read out basic info                                                                                      
    pyfits.info(data1)

    #Load file header into keys                                                                               
    header = pyfits.getheader(data1)
    header.keys()

    #Load actual data                                                                                         
    data_cube = pyfits.getdata(data1, 0)

    print 'Type: ', type(data_cube)
    print 'Shape:', data_cube.shape

    #I'm just going to look at a random slice                                                                 
    slice1 = data_cube[45, :, :]

    #Show the slice                                                                                           
    plt.imshow(slice1)
    plt.winter()
    plt.show()
开发者ID:destrys,项目名称:truffles,代码行数:32,代码来源:readin.py


示例2: ReturnSplineofEffectiveArea

def ReturnSplineofEffectiveArea(
        filnameAndDir=None,
        ):
    """Spline of Effective Area as a function of Energy and CTheta. Energy is interms of log10 of 1MeV"""
    print pyfits.info( filnameAndDir) 
    CTHETA_LO_EA, CTHETA_HI_EA, energyLow_EA, energyHigh_EA, EFFAREA =EA.importEffectiveArea(filnameAndDir)
    energylogEA, CthetaEA=EA.centeringDataAndConvertingToLog(energyHigh_EA,energyLow_EA,CTHETA_HI_EA,CTHETA_LO_EA)
    SplineEA=RectBivariateSpline(CthetaEA,energylogEA,EFFAREA)
    return SplineEA
开发者ID:dspolyar,项目名称:Main,代码行数:9,代码来源:DS_SkyExposure.py


示例3: main

def main():
    
    filenameEffArea='aeff_P7REP_ULTRACLEAN_V15_back.fits'
    directoryEffectiveArea='/Users/dspolyar/Documents/IRF/EffectiveArea/' 
    print pyfits.info( directoryEffectiveArea+filenameEffArea) 
    CTHETA_LO, CTHETA_HI, energyLow, energyHigh, EFFAREA = importEffectiveArea(directoryEffectiveArea+filenameEffArea)
    energylog, Ctheta=centeringDataAndConvertingToLog(energyHigh,energyLow,CTHETA_HI,CTHETA_LO)
    SplineEffectiveArea=RectBivariateSpline(Ctheta,energylog,EFFAREA)
    plotofEffectiveArea(SplineEffectiveArea,EFFAREA,energylog,Ctheta)
    print SplineEffectiveArea.ev(1.,5.)
开发者ID:dspolyar,项目名称:Main,代码行数:10,代码来源:DS_EffectiveArea.py


示例4: ReadLiveTimeCubeHealpixFile

def ReadLiveTimeCubeHealpixFile(filename=None, FileNumber=1):
    """Returns the heapix of the RA, DEC, and livetime in seconds spent at a given cosine on the sky"""
    hdulist = pyfits.open(filename)
    print pyfits.info(filename)
    print "columns of the first data file", hdulist[1].columns
    CosineLiveTimeData = hdulist[FileNumber].data["COSBINS"]
    RAdata = hdulist[FileNumber].data["RA"]
    DECdata = hdulist[FileNumber].data["DEC"]
    CThetaMax = hdulist[3].data["CTHETA_MAX"]
    CThetaMin = hdulist[3].data["CTHETA_MIN"]
    hdulist.close()
    return CosineLiveTimeData, RAdata, DECdata, CThetaMax, CThetaMin
开发者ID:douglasquincyadams,项目名称:Main,代码行数:12,代码来源:DS_ReadingLiveTimeCube.py


示例5: fitsinfo

def fitsinfo(filename):
    """
    Print a summary of the HDUs in a FITS file.

    Parameters
    ----------
    filename : str
        The path to a FITS file.
    """

    try:
        fits.info(filename)
    except IOError as e:
        log.error(str(e))
    return
开发者ID:spacetelescope,项目名称:PyFITS,代码行数:15,代码来源:fitsinfo.py


示例6: test_file_like_3

    def test_file_like_3(self):

        tmpfile = open(self.temp('tmpfile.fits'), 'wb')
        pyfits.writeto(tmpfile, np.arange(100, dtype=np.int32))
        tmpfile.close()
        info = [(0, 'PRIMARY', 'PrimaryHDU', 5, (100,), 'int32', '')]
        assert_equal(pyfits.info(self.temp('tmpfile.fits'), output=False),
                     info)
开发者ID:pombredanne,项目名称:PyFITS,代码行数:8,代码来源:test_hdulist.py


示例7: test_file_like_2

    def test_file_like_2(self):
        hdu = fits.PrimaryHDU(np.arange(100, dtype=np.int32))
        tmpfile = open(self.temp('tmpfile.fits'), 'wb')
        hdul = fits.open(tmpfile, mode='ostream')
        hdul.append(hdu)
        hdul.flush()
        tmpfile.close()
        hdul.close()

        info = [(0, 'PRIMARY', 'PrimaryHDU', 5, (100,), 'int32', '')]
        assert fits.info(self.temp('tmpfile.fits'), output=False) == info
开发者ID:Doomchinchilla,项目名称:PyFITS,代码行数:11,代码来源:test_hdulist.py


示例8: test_file_like_2

    def test_file_like_2(self):
        hdu = fits.PrimaryHDU(np.arange(100, dtype=np.int32))
        tmpfile = open(self.temp("tmpfile.fits"), "wb")
        hdul = fits.open(tmpfile, mode="ostream")
        hdul.append(hdu)
        hdul.flush()
        tmpfile.close()
        hdul.close()

        info = [(0, "PRIMARY", "PrimaryHDU", 5, (100,), "int32", "")]
        assert fits.info(self.temp("tmpfile.fits"), output=False) == info
开发者ID:embray,项目名称:PyFITS,代码行数:11,代码来源:test_hdulist.py


示例9: test_append_primary_to_empty_list

    def test_append_primary_to_empty_list(self):
        # Tests appending a Simple PrimaryHDU to an empty HDUList.
        hdul = fits.HDUList()
        hdu = fits.PrimaryHDU(np.arange(100, dtype=np.int32))
        hdul.append(hdu)
        info = [(0, 'PRIMARY', 'PrimaryHDU', 5, (100,), 'int32', '')]
        assert hdul.info(output=False) == info

        hdul.writeto(self.temp('test-append.fits'))

        assert fits.info(self.temp('test-append.fits'), output=False) == info
开发者ID:Doomchinchilla,项目名称:PyFITS,代码行数:11,代码来源:test_hdulist.py


示例10: main

def main():
    
    filenameEffArea='aeff_P7REP_ULTRACLEAN_V15_back.fits'
    directoryEffectiveArea= Const_LocalDirectoriesFermiFiles.DataFilesInstrumentResponse4UltraEffectiveAreaDirectory

    filepathEffArea = directoryEffectiveArea+'/'+filenameEffArea

    print pyfits.info( filepathEffArea ) 


    CTHETA_LO, CTHETA_HI, energyLow, energyHigh, EFFAREA = importEffectiveArea(filepathEffArea)
    energylog, Ctheta=centeringDataAndConvertingToLog(energyHigh,energyLow,CTHETA_HI,CTHETA_LO)
    #SplineEffectiveArea=RectBivariateSpline(Ctheta,energylog,EFFAREA)

    SplineEffectiveArea = Library_DataGetFermiInstrumentResponseEffectiveAreaPass7.Main(filepathEffArea)

    plotofEffectiveArea(SplineEffectiveArea,EFFAREA,energylog,Ctheta)


    print SplineEffectiveArea.ev(1.,5.) 
开发者ID:douglasquincyadams,项目名称:Main,代码行数:20,代码来源:Test_DataGetFermiInstrumentResponseEffectiveAreaPass7.py


示例11: mycatfits

def mycatfits(searchpattern):
    '''
    Looks for the information of images in a search pattern.
    '''

    import glob,pyfits

    imagelist = glob.glob(searchpattern)

    if (len(imagelist) == 0):
       print 'No images found using pattern:\n',searchpattern
       return

    print imagelist
    print ''

    for im in imagelist:

        pyfits.info(im)
        print ''
开发者ID:dborncamp,项目名称:training,代码行数:20,代码来源:disp_tools.py


示例12: test_append_extension_to_empty_list

    def test_append_extension_to_empty_list(self):
        """Tests appending a Simple ImageHDU to an empty HDUList."""

        hdul = fits.HDUList()
        hdu = fits.ImageHDU(np.arange(100, dtype=np.int32))
        hdul.append(hdu)
        info = [(0, "PRIMARY", "PrimaryHDU", 4, (100,), "int32", "")]
        assert hdul.info(output=False) == info

        hdul.writeto(self.temp("test-append.fits"))

        assert fits.info(self.temp("test-append.fits"), output=False) == info
开发者ID:embray,项目名称:PyFITS,代码行数:12,代码来源:test_hdulist.py


示例13: test_append_extension_to_empty_list

    def test_append_extension_to_empty_list(self):
        """Tests appending a Simple ImageHDU to an empty HDUList."""

        hdul = pyfits.HDUList()
        hdu = pyfits.ImageHDU(np.arange(100, dtype=np.int32))
        hdul.append(hdu)
        info = [(0, 'PRIMARY', 'PrimaryHDU', 4, (100,), 'int32', '')]
        assert_equal(hdul.info(output=False), info)

        hdul.writeto(self.temp('test-append.fits'))

        assert_equal(pyfits.info(self.temp('test-append.fits'), output=False),
                     info)
开发者ID:pombredanne,项目名称:PyFITS,代码行数:13,代码来源:test_hdulist.py


示例14: test_insert_primary_to_empty_list

    def test_insert_primary_to_empty_list(self):
        """Tests inserting a Simple PrimaryHDU to an empty HDUList."""
        hdul = fits.HDUList()
        hdu = fits.PrimaryHDU(np.arange(100, dtype=np.int32))
        hdul.insert(0, hdu)

        info = [(0, 'PRIMARY', 'PrimaryHDU', 5, (100,), 'int32', '')]

        assert hdul.info(output=False) == info

        hdul.writeto(self.temp('test-insert.fits'))

        assert fits.info(self.temp('test-insert.fits'), output=False) == info
开发者ID:Doomchinchilla,项目名称:PyFITS,代码行数:13,代码来源:test_hdulist.py


示例15: test_open_file_with_end_padding

    def test_open_file_with_end_padding(self):
        """Regression test for #106; open files with end padding bytes."""

        hdul = pyfits.open(self.data('test0.fits'),
                           do_not_scale_image_data=True)
        info = hdul.info(output=False)
        hdul.writeto(self.temp('temp.fits'))
        with open(self.temp('temp.fits'), 'ab') as f:
            f.seek(0, os.SEEK_END)
            f.write('\0'.encode('latin1') * 2880)
        with ignore_warnings():
            assert_equal(info,
                         pyfits.info(self.temp('temp.fits'), output=False,
                                     do_not_scale_image_data=True))
开发者ID:pombredanne,项目名称:PyFITS,代码行数:14,代码来源:test_hdulist.py


示例16: test_insert_primary_to_non_empty_list

    def test_insert_primary_to_non_empty_list(self):
        """Tests inserting a Simple PrimaryHDU to a non-empty HDUList."""

        hdul = fits.open(self.data("arange.fits"))
        hdu = fits.PrimaryHDU(np.arange(100, dtype=np.int32))
        hdul.insert(1, hdu)

        info = [(0, "PRIMARY", "PrimaryHDU", 7, (11, 10, 7), "int32", ""), (1, "", "ImageHDU", 6, (100,), "int32", "")]

        assert hdul.info(output=False) == info

        hdul.writeto(self.temp("test-insert.fits"))

        assert fits.info(self.temp("test-insert.fits"), output=False) == info
开发者ID:embray,项目名称:PyFITS,代码行数:14,代码来源:test_hdulist.py


示例17: test_insert_groupshdu_to_empty_list

    def test_insert_groupshdu_to_empty_list(self):
        """Tests inserting a Simple GroupsHDU to an empty HDUList."""

        hdul = fits.HDUList()
        hdu = fits.GroupsHDU()
        hdul.insert(0, hdu)

        info = [(0, "PRIMARY", "GroupsHDU", 8, (), "", "1 Groups  0 Parameters")]

        assert hdul.info(output=False) == info

        hdul.writeto(self.temp("test-insert.fits"))

        assert fits.info(self.temp("test-insert.fits"), output=False) == info
开发者ID:embray,项目名称:PyFITS,代码行数:14,代码来源:test_hdulist.py


示例18: test_open_file_with_end_padding

    def test_open_file_with_end_padding(self):
        """Regression test for https://aeon.stsci.edu/ssb/trac/pyfits/ticket/106

        Open files with end padding bytes.
        """

        hdul = fits.open(self.data("test0.fits"), do_not_scale_image_data=True)
        info = hdul.info(output=False)
        hdul.writeto(self.temp("temp.fits"))
        with open(self.temp("temp.fits"), "ab") as f:
            f.seek(0, os.SEEK_END)
            f.write("\0".encode("latin1") * 2880)
        with ignore_warnings():
            assert info == fits.info(self.temp("temp.fits"), output=False, do_not_scale_image_data=True)
开发者ID:embray,项目名称:PyFITS,代码行数:14,代码来源:test_hdulist.py


示例19: ReadEnergyDispersionFile

def ReadEnergyDispersionFile(
    Filename_ED=None,
    ):

    hdulist_Edisp=pyfits.open(Filename_ED)

    print pyfits.info(Filename_ED)
    print hdulist_Edisp[2].data['EDISPSCALE'].shape
    print hdulist_Edisp[1].data['LS1']
    print hdulist_Edisp[1].columns
    
    ENERG_LO_Edisp=hdulist_Edisp[1].data['ENERG_LO']
    ENERG_HI_Edisp=hdulist_Edisp[1].data['ENERG_HI']
    CTHETA_LO_Edisp=hdulist_Edisp[1].data['CTHETA_LO']
    CTHETA_HI_Edisp=hdulist_Edisp[1].data['CTHETA_HI']
    NORM_Edisp=hdulist_Edisp[1].data['NORM']
    LS1_Edisp=hdulist_Edisp[1].data['LS1']
    LS2_Edisp=hdulist_Edisp[1].data['LS2']
    RS1_Edisp=hdulist_Edisp[1].data['RS1']
    RS2_Edisp=hdulist_Edisp[1].data['RS2']
    BIAS_Edisp=hdulist_Edisp[1].data['BIAS']

    return ENERG_LO_Edisp, ENERG_HI_Edisp, CTHETA_LO_Edisp,CTHETA_HI_Edisp,NORM_Edisp,LS1_Edisp,LS2_Edisp, RS1_Edisp,RS2_Edisp,BIAS_Edisp
开发者ID:douglasquincyadams,项目名称:Main,代码行数:23,代码来源:DS_ReadDispersionFile.py


示例20: test_append_table_extension_to_empty_list

    def test_append_table_extension_to_empty_list(self):
        """Tests appending a Simple Table ExtensionHDU to a empty HDUList."""

        hdul = fits.HDUList()
        hdul1 = fits.open(self.data('tb.fits'))
        hdul.append(hdul1[1])
        info = [(0, 'PRIMARY', 'PrimaryHDU', 4, (), '', ''),
                (1, '', 'BinTableHDU', 24, '2R x 4C', '[1J, 3A, 1E, 1L]', '')]

        assert hdul.info(output=False) == info

        hdul.writeto(self.temp('test-append.fits'))

        assert fits.info(self.temp('test-append.fits'), output=False) == info
开发者ID:Doomchinchilla,项目名称:PyFITS,代码行数:14,代码来源:test_hdulist.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pyfits.new_table函数代码示例发布时间:2022-05-25
下一篇:
Python pyfits.getval函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap