當前位置: 首頁>>代碼示例>>Python>>正文


Python AdmitLogging.error方法代碼示例

本文整理匯總了Python中admit.util.AdmitLogging.AdmitLogging.error方法的典型用法代碼示例。如果您正苦於以下問題:Python AdmitLogging.error方法的具體用法?Python AdmitLogging.error怎麽用?Python AdmitLogging.error使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在admit.util.AdmitLogging.AdmitLogging的用法示例。


在下文中一共展示了AdmitLogging.error方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_error

# 需要導入模塊: from admit.util.AdmitLogging import AdmitLogging [as 別名]
# 或者: from admit.util.AdmitLogging.AdmitLogging import error [as 別名]
    def test_error(self):
        msg = "unit_test_error_message"
        Alogging.error(msg)
 
        found = False
        r = open(self.logfile, 'r')
        for line in r.readlines():
            if msg in line:
                if(self.verbose):
                    print "\nFound message > ", line
                found = True
                r.close()
                break
 
        self.assertTrue(found)
開發者ID:teuben,項目名稱:admit,代碼行數:17,代碼來源:unittest_AdmitLogging.py

示例2: run

# 需要導入模塊: from admit.util.AdmitLogging import AdmitLogging [as 別名]
# 或者: from admit.util.AdmitLogging.AdmitLogging import error [as 別名]
    def run(self):
        """ The run method creates the BDP

            Parameters
            ----------
            None

            Returns
            -------
            None
        """
        self._summary = {}
        dt = utils.Dtime("Smooth")
        dt.tag("start")
        # get the input keys
        bmaj   = self.getkey("bmaj")
        bmin   = self.getkey("bmin")
        bpa    = self.getkey("bpa")
        velres = self.getkey("velres")

        # take care of potential issues in the unit strings
        # @todo  if not provided?
        bmaj['unit'] = bmaj['unit'].lower()
        bmin['unit'] = bmin['unit'].lower()
        velres['unit'] = velres['unit'].lower()
        taskargs = "bmaj=%s bmin=%s bpa=%s velres=%s" % (bmaj,bmin,bpa,velres)
        

        bdpnames=[]
        for ibdp in self._bdp_in:
            istem = ibdp.getimagefile(bt.CASA)
            image_in = ibdp.baseDir() + istem

            bdp_name = self.mkext(istem,'sim')
            image_out = self.dir(bdp_name)
          
            taskinit.ia.open(image_in)        
            h = casa.imhead(image_in, mode='list')
            pix_scale = np.abs(h['cdelt1'] * 206265.0) # pix scale in asec @todo QA ?
            CC = 299792458.0 # speed of light  @todo somewhere else   [utils.c , but in km/s]

            rest_freq = h['crval3']
            # frequency pixel scale in km/s 
            vel_scale = np.abs(CC*h['cdelt3']/rest_freq/1000.0)

            # unit conversion to arcsec (spatial) or km/s 
            # (velocity) or some flavor of Hz.

            if(bmaj['unit'] == 'pixel'):
                bmaj = bmaj['value']*pix_scale
            else:
                bmaj = bmaj['value']
            if(bmin['unit'] == 'pixel'):
                bmin = bmin['value']*pix_scale
            else:
                bmin = bmin['value']

            hertz_input = False
            if velres['unit'] == 'pixel':
                velres['value'] = velres['value']*vel_scale
                velres['unit'] = 'km/s'
            elif velres['unit'] == 'm/s':
                velres['value'] = velres['value']/1000.0
                velres['unit'] = 'km/s'
            elif velres['unit'][-2:] == 'hz':
                hertz_input = True
            elif velres['unit'] == 'km/s':
                pass
            else:
                logging.error("Unknown units in velres=%s" % velres['unit'])

            rdata = bmaj

            # we smooth in velocity first. if smoothing in velocity
            # the cube apparently must be closed afterwards and 
            # then reopened if spatial smoothing is to be done.

            if velres['value'] > 0:
                # handle the different units allowed. CASA doesn't
                # like lowercase for hz units...          
                if not hertz_input:
                    freq_res = str(velres['value']*1000.0/CC *rest_freq )+'Hz'
                else:
                    freq_res = str(velres['value'])
                    # try to convert velres to km/s for debug purposes
                    velres['value'] = velres['value']/rest_freq*CC / 1000.0 
                    if(velres['unit'] == 'khz'):
                        velres['value'] = velres['value']*1000.0
                        velres['unit'] = 'kHz'
                    elif(velres['unit']=='mhz'):
                        velres['value'] = velres['value']*1E6
                        velres['unit'] = 'MHz'
                    elif(velres['unit']=='ghz'):
                        velres['value'] = velres['value']*1E9
                        velres['unit'] = 'GHz'
                    freq_res = freq_res + velres['unit']

                # NB: there is apparently a bug in CASA. only smoothing along the frequency
                # axis does not work. sepconvolve gives a unit error (says axis unit is radian rather 
                # than Hz). MUST smooth in 2+ dimensions if you want this to work.
#.........這裏部分代碼省略.........
開發者ID:teuben,項目名稱:admit,代碼行數:103,代碼來源:Smooth_AT.py


注:本文中的admit.util.AdmitLogging.AdmitLogging.error方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。