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

Python saltprint.err函数代码示例

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

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



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

示例1: cleanpropcode

def cleanpropcode(pids, propids, logfile):
    status=0
    props = []

    #Make a list of all the Propcodes that are observed
    for pid in propids:
        props.extend(pid.upper().split(','))

    #Check to make sure that the requested propocodes
    # are in that night's observation or set the propocodes
    # to all of that nights observatoins
    if (pids[0].upper() != 'ALL'):
        for pid in pids:
            for pid in pid.split(','):
                if (pid.upper().strip() not in set(props)):
                    message  = 'ERROR: CLEANPROPCODE -- Propcode ' + pid.upper()
                    message += ' is not recorded in the observation log '
                    status = saltprint.err(logfile,message)
    else:
        pids = set(props)

    pids=removebadpids(pids)

    if not pids:
        message  = 'ERROR: CLEANPROPCODE -- Propcode list is empty'
        status = saltprint.err(logfile,message)
    return pids, status
开发者ID:apodemus,项目名称:pysalt3,代码行数:27,代码来源:saltio.py


示例2: symlink

def symlink(infile,linkfile,clobber,verbose,logfile):

# delete file if one of the same name already exists

    status = 0
    message = 'SALTIO.SYMLINK -- created symbolic link from ' + infile + ' to ' + linkfile
    if (os.path.exists(linkfile) and not clobber):
        message = 'ERROR: SALTIO.SYMLINK -- file ' + linkfile + ' exists, use clobber=y'
        status = saltprint.err(logfile,message)
    if (status == 0 and clobber):
        try:
            os.remove(linkfile)
        except:
            status = 0

# create symbolic link

    if (status == 0):
        try:
            os.symlink(infile,linkfile)
        except:
            message  = 'ERROR: SALTIO.SYMLINK -- could not create symbolic link from '
            message += infile + ' to ' + linkfile
            status = saltprint.err(logfile,message)
    if (status == 0): saltprint.log(logfile,message,verbose)

    return status
开发者ID:apodemus,项目名称:pysalt3,代码行数:27,代码来源:saltio.py


示例3: instrumid

def instrumid(struct,file,logfile):
    """identify instrument in keywords"""

    instrume = ''
    keyprep = ''
    keygain = ''
    keybias = ''
    keyxtalk = ''
    keyslot = ''
    status = 0
    try:
        instrume = struct[0].header['INSTRUME']
        if (string.join(instrume.split(),"") == 'RSS' or string.join(instrume.split(),"") == 'PFIS'):
            keyprep = 'PPREPARE'
            keygain = 'PGAIN'
            keybias = 'PBIAS'
            keyxtalk = 'PXTALK'
            keyslot = 'PSLOT'
        elif (string.join(instrume.split(),"") == 'SALTICAM'):
            keyprep = 'SPREPARE'
            keygain = 'SGAIN'
            keybias = 'SBIAS'
            keyxtalk = 'SXTALK'
            keyslot = 'SSLOT'
        else:
            message = 'ERROR -- SALTKEY.INSTRUMID: INSTRUME keyword not '
            message += 'recognized in file ' + file
            status = saltprint.err(logfile,message)
    except:
        message = 'ERROR -- SALTKEY.INSTRUMID: INSTRUME keyword not found '
        message += 'in file ' + file
        status = saltprint.err(logfile,message)

    return instrume,keyprep,keygain,keybias,keyxtalk,keyslot,status
开发者ID:astrophysaxist,项目名称:pysalt,代码行数:34,代码来源:saltkey.py


示例4: _finishcallsave

    def _finishcallsave(self, e):
        status=0
        self.sroot.destroy()
        name=self.nametext.get()
        if not name: return
        if name[-3:]!='.ps': name=name+'.ps'

        #remove the file if the name already exists
        if saltio.filedoesnotexist(name,self.verbose, self.logfile):
            if self.clobber:
                os.remove(name)
            else:
                message = 'ERROR -- SALTVIEW: File ' + name + ' already exists, use clobber=y'
                status = saltprint.err(logfile,message)
                return

        #turn the red dot off in the graph
        self.light_point.set_visible(False)

        #save the figure
        self.lcfig.savefig(name)


        #turn the red dot on in the graph
        self.light_point.set_visible(True)
开发者ID:astrophysaxist,项目名称:pysalt,代码行数:25,代码来源:old_slotview.py


示例5: readccdgeom

def readccdgeom(geomfile,logfile,status):

    status = 0
    gap = 0.
    xshift = [0., 0.]
    yshift = [0., 0.]
    rot = [0., 0.]
    try:
        gfile = open(geomfile,'r')
        for line in gfile:
            if (len(line.strip()) > 0 and line[0] != '#'):
                line = line.rstrip('\r\n')
                line = line.rstrip().lstrip()
                line = re.sub("\s+",",",line)
                pars = line.split(',')
                gap = float(pars[1])
                xshift[0] = float(pars[2])
                yshift[0] = float(pars[3])
                rot[0] = float(pars[4])
                if (len(pars) == 8):
                    xshift[1] = float(pars[5])
                    yshift[1] = float(pars[6])
                    rot[1] = float(pars[7])
    except:
        message = 'ERROR -- SALTIO.READCCDGEOM: Cannot read geometry definition parameters '
        message += 'in file ' + geomfile
        status = saltprint.err(logfile,message)

    return gap, xshift, yshift, rot, status
开发者ID:apodemus,项目名称:pysalt3,代码行数:29,代码来源:saltio.py


示例6: readgaindb

def readgaindb(gaindb,logfile):

    dbspeed = []
    dbrate  = []
    dbgain  = []
    dbnoise = []
    dbbias  = []
    dbamp   = []
    status  = 0
    try:
        gainfile = open(gaindb,'r')
        for line in gainfile:
            if (len(line.strip()) > 0 and line[0] != '#'):
                line = line.rstrip('\r\n')
                line = re.sub("\s+",",",line)
                line.rstrip(',')
                entries = line.split(',')
                dbspeed.append(entries[0])
                dbrate.append(entries[1])
                dbgain.append(entries[2])
                dbnoise.append(entries[3])
                dbbias.append(entries[4])
                dbamp.append(entries[5].strip('amp'))
    except:
        message = 'Cannot read gain database file ' + gaindb
        status = saltprint.err(logfile,message)

    return dbspeed, dbrate, dbgain, dbnoise, dbbias, dbamp, status
开发者ID:apodemus,项目名称:pysalt3,代码行数:28,代码来源:saltio.py


示例7: writefits

def writefits(struct,file,logfile):

    status = 0
    try:
        struct.writeto(file)
    except Exception, e:
        message = 'ERROR -- SALTIO.WRITE: cannot write %s because %s' % (file, e)
        status = saltprint.err(logfile,message)
开发者ID:astrophysaxist,项目名称:pysalt,代码行数:8,代码来源:saltio.py


示例8: filedefined

def filedefined(filetype,file,logfile):

    status = 0
    file = file.strip()
    if (len(file) == 0 or file.count(' ') > 0):
        message = 'ERROR -- SALTIO.FILEDEFINED: ' + filetype + ' file(s) not specified'
        status = saltprint.err(logfile,message)
    return status
开发者ID:apodemus,项目名称:pysalt3,代码行数:8,代码来源:saltio.py


示例9: fileexists

def fileexists(file,logfile):

    status = 0
    if not os.path.isfile(file):
        message = 'ERROR -- SALTIO.FILEEXISTS: File ' + file
        message += ' does not exist'
        status = saltprint.err(logfile,message)
    return status
开发者ID:apodemus,项目名称:pysalt3,代码行数:8,代码来源:saltio.py


示例10: filesexist

def filesexist(infiles,path,mode,logfile):

    status = 0
    if (path != ''):
        if (path[len(path)-1] != '/'): path += '/'
    for fileitem in infiles:
        if (mode == 'r'):
            if (not os.path.isfile(path+fileitem)):
                message = 'ERROR -- SALTIO.FILESEXIST file ' + path + fileitem
                message += ' does not exist'
                status = saltprint.err(logfile,message)
        elif (mode == 'w'):
            if (os.path.isfile(path+fileitem)):
                message = 'ERROR -- SALTIO.FILESEXIST file ' + path + fileitem
                message += ' already exists'
                status = saltprint.err(logfile,message)
    return status
开发者ID:apodemus,项目名称:pysalt3,代码行数:17,代码来源:saltio.py


示例11: argdefined

def argdefined(argument,value,logfile):

    status = 0
    value = value.strip()
    if (len(value) == 0): # or value.count(' ') > 0):
        message = 'ERROR -- SALTIO.ARGDEFINED: ' + argument + ' argument not defined'
        status = saltprint.err(logfile,message)
    return status
开发者ID:apodemus,项目名称:pysalt3,代码行数:8,代码来源:saltio.py


示例12: comparelists

def comparelists(list1,list2,name1,name2,logfile):

    status = 0
    if (len(list1) != len(list2)):
        message = 'ERROR -- SALTIO.COMPARELISTS: ' + name1 + ' and ' + name2
        message += ' lists are of unequal length'
        status = saltprint.err(logfile,message)
    return status
开发者ID:apodemus,项目名称:pysalt3,代码行数:8,代码来源:saltio.py


示例13: email

def email(server,username,password,sender,recipient,subject,message,logfile):

    status = 0

# connect to email server

    try:
        smtp = smtplib.SMTP()
        smtp.connect(server)
    except:
        message = 'ERROR: SALTIO.EMAIL -- cannot connect to email server ' + server
        status = saltprint.err(logfile,message)

# login to email server

    if (status == 0):
        try:
            smtp.login(username,password)
        except:
            message = 'ERROR: SALTEMAIL -- cannot login to email server ' + server + ' as user ' + username
            status = saltprint.err(logfile,message)

# send emails

    if (status == 0):
        msg = MIMEText(message)
        msg['Subject'] = subject
        msg['From'] = sender
        msg['To'] = recipient
        try:
            smtp.sendmail(sender,recipient,msg.as_string())
        except:
            message = 'ERROR: SALTEMAIL -- failed to send email to ' + recipient
            status = saltprint.err(logfile,message)

# disconnect from email server

    if (status == 0):
        try:
            smtp.quit()
        except:
            message = '\nERROR: SALTEMAIL -- cannot disconnect from email server ' + server
            status = saltprint.err(logfile,message)

    return status
开发者ID:apodemus,项目名称:pysalt3,代码行数:45,代码来源:saltio.py


示例14: deletedir

def deletedir(path,logfile):

    status = 0
    try:
        os.rmdir(path)
    except:
        message = 'ERROR -- SALTIO.DELETEDIR: Could not delete directory' + file
        status = saltprint.err(logfile,message)
    return status
开发者ID:apodemus,项目名称:pysalt3,代码行数:9,代码来源:saltio.py


示例15: writeimage

def writeimage(struct,hdu,imagedata,logfile):

    status = 0
    try:
        struct[hdu].data = imagedata
    except Exception, e:
        message = 'ERROR -- SALTIO.WRITEIMAGE: Cannot write image data to HDU ' + str(hdu)
        message += ' because %s ' % e
        status = saltprint.err(logfile,message)
开发者ID:astrophysaxist,项目名称:pysalt,代码行数:9,代码来源:saltio.py


示例16: closefits

def closefits(struct,logfile):

    status = 0
    try:
        struct.close()
    except:
        message = 'ERROR -- SALTIO.CLOSE: Cannot close HDU structure'
        status = saltprint.err(logfile,message)
    return status
开发者ID:apodemus,项目名称:pysalt3,代码行数:9,代码来源:saltio.py


示例17: copydir

def copydir(file1,file2,verbose,logfile):

    status = 0
    message = 'SALTIO.COPYDIR -- copied ' + file1 + ' to ' + file2
    try:
        shutil.copytree(file1,file2)
    except Exception, e:
        message = 'ERROR -- SALTIO.COPYDIR: could not copy %s to %s because %s' % (file1,file2,e)
        status = saltprint.err(logfile,message)
开发者ID:astrophysaxist,项目名称:pysalt,代码行数:9,代码来源:saltio.py


示例18: updatefits

def updatefits(struct,logfile):

    status = 0
    try:
        struct.flush()
    except:
        message = 'ERROR -- SALTIO.UPDATEFITS: cannot update FITS file'
        status = saltprint.err(logfile,message)
    return status
开发者ID:apodemus,项目名称:pysalt3,代码行数:9,代码来源:saltio.py


示例19: new

def new(keyword,value,comment,hdu,file,logfile):
    """add new keyword"""

    status = 0
    try:
        hdu.header.update(keyword,value,comment)
    except Exception, e:
        message = 'ERROR -- SALTKEY.NEW: Cannot create keyword %s in %s because %s ' % (keyword, file, e)
        status = saltprint.err(logfile,message)
开发者ID:astrophysaxist,项目名称:pysalt,代码行数:9,代码来源:saltkey.py


示例20: listexists

def listexists(filetype,file,logfile):

    status = 0
    file = file.lstrip('@')
    if not os.path.isfile(file):
        message = 'ERROR -- SALTIO.LISTEXIST: ' + filetype + ' list '+ file
        message += ' does not exist'
        status = saltprint.err(logfile,message)
    return status
开发者ID:apodemus,项目名称:pysalt3,代码行数:9,代码来源:saltio.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python db_utils.DB_Connection类代码示例发布时间:2022-05-27
下一篇:
Python version.SaltStackVersion类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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