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


Python pyfits.info函数代码示例

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


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


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