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


Python AstroData.is_type方法代码示例

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


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

示例1: float

# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import is_type [as 别名]
mag = np.where((dqflag==0), mag, None)

# Now ditch the values out of the arrays where mag is None
# NB do mag last
magerr = magerr[np.flatnonzero(mag)]
refmag = refmag[np.flatnonzero(mag)]
refmagerr = refmagerr[np.flatnonzero(mag)]
mag = mag[np.flatnonzero(mag)]

if(len(mag) == 0):
  print "No good sources to plot"
  sys.exit(1)

# Now apply the exposure time and nom_at_ext corrections to mag
et = float(ad.exposure_time())
if(ad.is_type('GMOS_NODANDSHUFFLE')):
    print "Imaging Nod-And-Shuffle. Photometry may be dubious"
    et /= 2.0

etmag = 2.5*math.log10(et)
nom_at_ext = float(ad.nominal_atmospheric_extinction())

mag += etmag
mag += nom_at_ext

# Can now calculate the zp array
zp = refmag - mag
zperr = np.sqrt(refmagerr*refmagerr + magerr*magerr)

# Trim values out of zp where the zeropoint error is > 0.1
zp_trim = np.where((zperr<0.1), zp, None)
开发者ID:pyrrho314,项目名称:recipesystem,代码行数:33,代码来源:zp_histogram.py

示例2: __init__

# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import is_type [as 别名]
    def __init__(self,fname,linelist=None,extv=1,nsum=10,match=6,radius=10):

        self.extv = extv
        self.nsum = nsum
        self.match = match
        self.radius = radius

        ad = AstroData(fname)

        self.imdata = ad['SCI',extv].data

        if ad.dispersion_axis() == 2:
            # Transpose to work on the X-axis.
            self.imdata = self.imdata.transpose()

        self.filename = ad.filename
        self.ad = ad

        linelist_file = linelist

        scrpix = 'crpix1'
        scrval = 'crval1'
        scdelt = 'cd1_1'
        fpath=os.path.dirname(spu.__file__)
        if ad.is_type('F2_SPECT') or self.ad.is_type('GNIRS'):
            reffile = 'calibrated_arc.fits'
            wmin = 7035.14    # x*0.24321 + 7035.1381. wavelength at [0]
            wmax = 25344.54   # wavelength at [-1]
            scrpix = 'crpix2'
            scrval = 'crval2'
            scdelt = 'cd2_2'
            sz = np.shape(self.imdata)
            if len(sz) == 3:
               self.imdata = self.imdata.reshape(sz[1],sz[2])

            if linelist_file==None:
                linelist_file = 'argon.dat'
                #linelist_file = 'lowresargon.dat'
        elif ad.is_type('GMOS_SPECT'):
            if linelist_file==None:
                 linelist_file = 'cuar.dat'
            reffile = 'cuar.fits'
            wmin = 3053.    # x*0.25 + 3053. cuar.fits wavelength at cuarf[0]
            wmax = 10423.   # cuar.fits wavelength at cuarf[-1]
        elif ad.is_type('NIRI_SPECT'):
            reffile = 'calibrated_arc.fits'
            wmin = 7032.706
            wmax = 25342.113
            if linelist_file==None:
                 linelist_file = 'lowresargon.dat'
        elif ad.is_type('NIFS_SPECT'):
            filtername = str(self.ad.filter_name())
            if 'JH' in filtername:
                 if linelist_file==None:
                    linelist_file = 'argon.dat'
                 wmin = 7032.706
                 wmax = 25342.113
                 reffile = 'calibrated_arc.fits'
            elif 'HK' in filtername:
                 if linelist_file==None:
                    linelist_file = 'ArXe_K.dat'
                 wmin = 20140.259
                 wmax = 24491.320
                 reffile = 'NIFS_K_arc_1D.fits'
            elif 'ZJ' in filtername:
                 if linelist_file==None:
                    linelist_file = 'argon.dat'
                 wmin = 7035.14
                 wmax = 25344.54
                 reffile = 'calibrated_arc.fits'
        else:
            raise ValueError('Input file is not supported: '+ad.filename)

        self.reffile = os.path.join(fpath,reffile)
        self.wmin = wmin
        self.wmax = wmax
        self.pixs=[]
        self.users=[]

        linelist_file = os.path.join(fpath,linelist_file)
        linelist = np.loadtxt(linelist_file,usecols=(0,))

        hdr = ad['SCI',extv].header
        self.wcs={'crpix':hdr[scrpix], 'crval':hdr[scrval], 'cdelt':hdr[scdelt]}
        cdelt = self.wcs['cdelt']

        if cdelt < 0:
            linelist = linelist[::-1]    # Change to decreasing order

        self.cuar = linelist     # cuar is the IRAF name
        self.ad = ad

        sz = np.shape(self.imdata)

        nsum = 6
        if len(sz) == 2:
            ny = max(3,nsum/2)
            ym = sz[0]/2
            lpix = np.mean(self.imdata[ym-ny:ym+ny],axis=0)
        elif len(sz) == 1:
#.........这里部分代码省略.........
开发者ID:pyrrho314,项目名称:recipesystem,代码行数:103,代码来源:winter.py

示例3: AcquisitionImage

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

#.........这里部分代码省略.........
            dirs.append(dname)

        dirs.append(os.getcwd())

        # search through semester directories as well
        semester_dir = self.get_observatory_prefix() + self.get_semester()
        directories_to_search = []
        for dname in dirs:
            directories_to_search.append(dname)
            dname = os.path.join(dname, semester_dir)
            directories_to_search.append(dname)

        # now search through the directories
        for dname in directories_to_search:
            fname = os.path.join(dname, mdffile)
            debug("...trying", fname)
            if os.path.exists(fname):
                return fname

        raise ValueError("Unable to find MDF file named '%s'" % mdffile)

    def get_num_mos_boxes(self):
        return self.box_mosaic.get_num_mos_boxes()

    def get_mos_boxes(self):
        return self.box_mosaic.get_boxes()

    def get_mos_box_borders(self):
        for border in self.box_mosaic.get_box_borders():
            yield border

    @cache
    def get_min_slitsize(self):
        mdffile_ad = AstroData(self.get_mdf_filename())

        xsize = Ellipsis
        ysize = Ellipsis
        for row in mdffile_ad["MDF"].data:
            # select the alignment boxes, designated by priority 0
            if row["priority"] not in ["1", "2", "3"]:
                continue

            xsize = min(xsize, row["slitsize_x"])
            ysize = min(ysize, row["slitsize_y"])

        return xsize, ysize

    def get_extensions(self):
        for ext in self.ad:
            yield ext

    def _get_lazy_detector_section_finder(self):
        if not hasattr(self, "detsec_finder"):
            self.detsec_finder = DetectorSectionFinder(self)
        return self.detsec_finder

    def get_box_size(self):
        return self._get_lazy_detector_section_finder().get_box_size()

    def find_detector_section(self, point):
        return self._get_lazy_detector_section_finder().find_detector_section(point)

    def get_full_field_of_view(self):
        return self._get_lazy_detector_section_finder().get_full_field_of_view()

    def is_altair(self):
        aofold = self.ad.phu.header["AOFOLD"]
        if aofold == "IN":
            return True
        return False

    def is_south_port(self):
        inportnum = int(self.ad.phu.header["INPORT"])
        if inportnum == 1:
            return True
        return False

    def is_type(self, typename):
        return self.ad.is_type(typename)

    def is_gmos(self):
        return self.is_type("GMOS")
    
    def is_gmosn(self):
        return self.is_type("GMOS_N")

    def is_gmoss(self):
        return self.is_type("GMOS_S")

    def is_gnirs(self):
        return self.is_type("GNIRS")

    def is_f2(self):
        return self.is_type("F2")

    def is_nifs(self):
        return self.is_type("NIFS")

    def is_niri(self):
        return self.is_type("NIRI")
开发者ID:pyrrho314,项目名称:recipesystem,代码行数:104,代码来源:acquisitionimage.py

示例4: AstroData

# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import is_type [as 别名]
            except:
                log.warning('getBPM: CCDSUM value not supported with BPM: '+indx)
                return None
        # Find where are these BPM files

        fp, pathname, description = imp.find_module('detectSources')
        fname = os.path.join(os.path.dirname(pathname),dq)

        return AstroData(fname)


if __name__ == '__main__':

    import sys,glob

    #ad = AstroData('/home/nzarate/zp/zzz.fits')
    #ff = Fluxcal(ad)    # Create object
    #ff.runFC()       # run the scripts
    

    for ifile in glob.glob('[g,m]*.fits'):
        if 'rgS20110125S' in ifile: continue
        if 'zp_' in ifile: continue
        ad = AstroData(ifile)
        if ad.is_type('CAL'):
            print "\nWARNING: 'CAL' type for file:",ifile," not supported."
            continue
        print "\n >>>>>>>>>>>>>>>>>>FluxCAL for:",ifile 
        ff = Fluxcal(ad,addBPM=False)    # Create object
        ff.runFC()
开发者ID:pyrrho314,项目名称:recipesystem,代码行数:32,代码来源:fluxcal.py


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