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


Python AdmitLogging.info方法代码示例

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


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

示例1: addBDPtoAT

# 需要导入模块: from admit.util.AdmitLogging import AdmitLogging [as 别名]
# 或者: from admit.util.AdmitLogging.AdmitLogging import info [as 别名]
    def addBDPtoAT(self, bdp):
        """ Method to add a BDP to an AT. The AT is not specified, but the
            _taskid attribute of the BDP is used to identify the necessary AT.

            Parameters
            ----------
            bdp : BDP
                Any valid BDP, to be added to an existing AT.

            Returns
            -------
            None

        """
        found = False
        cp = copy.deepcopy(bdp)
        # find the AT we need
        for at in self.tasks:
            # see if the ID's match
            if at._taskid == bdp._taskid:
                found = True
                # set the base directory of the BDP
                cp.baseDir(at.baseDir())
                # add it to the correct slot
                at._bdp_out[at._bdp_out_map.index(cp._uid)] = cp
                break
        if not found:
            logging.info("##### Found orphaned BDP with type %s in file %s" % \
                (bdp._type, bdp.xmlFile))
开发者ID:teuben,项目名称:admit,代码行数:31,代码来源:Parser.py

示例2: checkAll

# 需要导入模块: from admit.util.AdmitLogging import AdmitLogging [as 别名]
# 或者: from admit.util.AdmitLogging.AdmitLogging import info [as 别名]
    def checkAll(self):
        """ Method to check the dtd structure to see if all expected
            nodes were found.

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

            Returns
            -------
            Boolean, whether or not all nodes were found

        """
        #pp.pprint(self.entities)
        for i in self.entities:
            if not self.entities[i]["found"]:
                print self.xmlFile
                logging.info(str(i) + " not found")
                return False
            for a in self.entities[i]["attrib"]:
                if not self.entities[i]["attrib"][a]["found"]:
                    print "2",self.xmlFile
                    logging.info(str(i) + " " + str(a) + " not found")
                    return False
        return True
开发者ID:teuben,项目名称:admit,代码行数:27,代码来源:DTDParser.py

示例3: get_mem

# 需要导入模块: from admit.util.AdmitLogging import AdmitLogging [as 别名]
# 或者: from admit.util.AdmitLogging.AdmitLogging import info [as 别名]
    def get_mem(self):
        """ Read memory usage info from /proc/pid/status
            Return Virtual and Resident memory size in MBytes.
        """
        global ostype
        
        if ostype == None:
            ostype = os.uname()[0].lower()
            logging.info("OSTYPE: %s" % ostype)
            
        scale = {'MB': 1024.0}
        lines = []
        try:
            if ostype == 'linux':
                proc_status = '/proc/%d/status' % os.getpid()          # linux only
                # open pseudo file  /proc/<pid>/status
                t = open(proc_status)
                # get value from line e.g. 'VmRSS:  9999  kB\n'
                for it in t.readlines():
                    if 'VmSize' in it or 'VmRSS' in it :
                        lines.append(it)
                t.close()
            else:
                proc = subprocess.Popen(['ps','-o', 'rss', '-o', 'vsz', '-o','pid', '-p',str(os.getpid())],stdout=subprocess.PIPE)
                proc_output = proc.communicate()[0].split('\n') 
                proc_output_memory = proc_output[1]
                proc_output_memory = proc_output_memory.split()
                
                phys_mem = int(proc_output_memory[0])/1204 # to MB 
                virtual_mem = int(proc_output_memory[1])/1024 
                
        except (IOError, OSError):
            if self.report:
                logging.timing(self.label + " Error: cannot read memory usage information.")

            return np.array([])

        # parse the two lines
    
        mem = {}
        if(ostype != 'darwin'):
            for line in lines:
                words = line.strip().split()
            #print words[0], '===', words[1], '===', words[2]
                
            # get rid of the tailing ':'
                key = words[0][:-1]

            # convert from KB to MB
                scaled = float(words[1]) / scale['MB']
                mem[key] = scaled
        else:
            mem['VmSize'] = virtual_mem
            mem['VmRSS']  = phys_mem


        return np.array([mem['VmSize'], mem['VmRSS']])
开发者ID:teuben,项目名称:admit,代码行数:59,代码来源:utils.py

示例4: characters

# 需要导入模块: from admit.util.AdmitLogging import AdmitLogging [as 别名]
# 或者: from admit.util.AdmitLogging.AdmitLogging import info [as 别名]
    def characters(self, ch):
        """ Method called whenever characters are detected in an xml node
            This method does some dtd validation. This
            method is only called by the SAX parser iteself.

            Parameters
            ----------
            ch : unicode characters

            Returns
            -------
            None
        """
        target = None
        char = str(ch).strip()
        if char.isspace() or not char:
            return
        # determine which class the data are getting writtrn to
        if self.inUtil:
            target = self.Util
        elif self.inBDP:
            target = self.BDP
        elif self.inAT:
            target = self.curAT
        elif self.inSummaryEntry:
            target = self.summaryEntry
        elif self.inSummary:
            target = self.summaryData
        else:
            target = self.admit
        # a list or dictionary has to be decoded
        if isinstance(self.type, list) or isinstance(self.type, dict) \
           or isinstance(self.type, tuple) or isinstance(self.type, set) \
           or isinstance(self.type, np.ndarray) or isinstance(self.type, str):
            if self.inflow:
                self.flowdata += char
            else:
                self.tempdata += char
        else:
            # check the version
            if self.name == "_version":
                ver = self.getattr(target, self.name)
                vercheck = utils.compareversions(ver, str(char))
                if vercheck < 0: # newer read in
                    logging.warning("Version mismatch for %s, data are a newer version than current software, attempting to continue." % target.getkey("_type"))
                elif vercheck > 0: # older read in
                    logging.warning("Version mismatch for %s, data are an older version than current software, attempting to continue." % target.getkey("_type"))
            else:
                try:
                    self.setattr(target, self.name, self.getData(char))
                except AttributeError:
                    logging.info("Data member %s is not a member of %s. This may be due to a version mismatch between the data and your software, attempting to continue." % (self.name, str(type(target))))
                except:
                    raise
        del ch
开发者ID:teuben,项目名称:admit,代码行数:57,代码来源:AdmitParser.py

示例5: test_info

# 需要导入模块: from admit.util.AdmitLogging import AdmitLogging [as 别名]
# 或者: from admit.util.AdmitLogging.AdmitLogging import info [as 别名]
    def test_info(self):
        msg = "unit_test_info_message"
        Alogging.info(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,代码行数:18,代码来源:unittest_AdmitLogging.py

示例6: fitgauss1D

# 需要导入模块: from admit.util.AdmitLogging import AdmitLogging [as 别名]
# 或者: from admit.util.AdmitLogging.AdmitLogging import info [as 别名]
def fitgauss1D(x, y, par=None, width=-1.0):
    """ Method for fitting a 1D gaussian to a spectral line

        Parameters
        ----------
        x: array like
            The x co-ordinates of the spectrum, note the center of
            the spectral line should be near 0.0 if possible

        y: array like
            The y co-ordinates (intensity) of the spectrum

        par: array like
            The initial guesses for the fit parameters, the fitter works best
            if the center parameter is near 0.0
            3 parameters:  PeakY, CenterX, FWHM.

        width: float 
            If positive, this is the assumed width (or step) in the x array,
            which is needed if only 1 point is given. Otherwise ignored.

        Returns
        -------
        A tuple containing the best fit parameters (as a list) and the covariance
        of the parameters (also as a list)
    """
    if len(x) == 3:
        logging.info("Gaussian fit attempted with only three points, look at the covariance for goodness of fit.")
    # if there are too few points to fit then just conserve the are of the channels to calculate the
    # parameters
    if len(x) < 3:
        logging.info("Gaussian fit attempted with fewer than three points (%d). Using conservation of area method to determine parameters." % len(x))
        params = fitgauss1Dm(x,y,dx=width)
        covar = [1000.] * len(params)
    else:
        try:
            params, covar = curve_fit(gaussian1D, x, y, p0=par)
        # if the covariance cannot be determined, just return the initial values
        except RuntimeError, e:
            if "Optimal" in str(e):
                params = par
                covar = [0] * len(par)
            # otherwise re-raise the exception
            else:
                raise
开发者ID:teuben,项目名称:admit,代码行数:47,代码来源:utils.py

示例7: test_effectiveLevel

# 需要导入模块: from admit.util.AdmitLogging import AdmitLogging [as 别名]
# 或者: from admit.util.AdmitLogging.AdmitLogging import info [as 别名]
    def test_effectiveLevel(self):
        msg = "unit_test_levels_message"
 
        # check that the logging level is what is expected
        level = Alogging.getEffectiveLevel()
        self.assertTrue(level == self.level)
 
        # set the level to a new value and check again
        Alogging.setLevel(50)
        level = Alogging.getEffectiveLevel()
        self.assertTrue(level == 50)
 
        # log an info message which is below the logging level, this message should not appear
        # in the logs
        Alogging.info(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
                break
        r.close()
        self.assertFalse(found)
 
        Alogging.setLevel(self.level)
        # reset the logging level
        msg += "2"
        # log an info message, which is now above the logging level, this message should appear
        # in the logs
        Alogging.info(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,代码行数:47,代码来源:unittest_AdmitLogging.py

示例8: checkAttribute

# 需要导入模块: from admit.util.AdmitLogging import AdmitLogging [as 别名]
# 或者: from admit.util.AdmitLogging.AdmitLogging import info [as 别名]
    def checkAttribute(self, name, attrib, value=None):
        """ Method to check an attribute for validity. Validity includes correct
            name and data type.

            Parameters
            ----------
            name : str
                The name of the node being checked

            attrib : str
                The attribute of the node being checked, if any.

            value : str
                The type of the attribute being checked (e.g. bt.INT)
                Default: None
        """
        # check an attribute for validity
        try:
            if not value in self.entities[name]["attrib"][attrib]["values"] \
               and not "ANY" in self.entities[name]["attrib"][attrib]["values"]:
                raise Exception("DTDParser.checkAttributes: Value %s for attribute %s is not a valid entry (file %s)" %
                                (value, name, self.xmlFile))
            self.entities[name]["attrib"][attrib]["found"] = True
        except KeyError:
            logging.info("Attribute %s not listed in DTD, malformed xml detected (%s)" %
                         (attrib, self.xmlFile))
            logging.info("Inconsistency between dtd and xml detected, continuing")
        except:
            logging.info("Unknown error encountered while parsing attribute %s (%s)" %
                         (attrib, self.xmlFile))
            raise
开发者ID:teuben,项目名称:admit,代码行数:33,代码来源:DTDParser.py

示例9: run

# 需要导入模块: from admit.util.AdmitLogging import AdmitLogging [as 别名]
# 或者: from admit.util.AdmitLogging.AdmitLogging import info [as 别名]
    def run(self):
        """ running the File_AT task
        """
        
        # grab and check essential keywords
        filename = self.getkey('file')
        logging.info("file=%s" % filename)
        if len(filename) == 0:
            raise Exception,'File_AT: no file= given'

        exist = self.getkey('exist')
        if exist:
            #
            logging.warning("no checking now")
            # self._bdp_in[0].checkfiles()

        # create the BDP
        bdp1 = File_BDP(filename)
        bdp1.filename = filename
        self.addoutput(bdp1)

        # touch the file if desired
        if self.getkey('touch'): bdp1.touch()
开发者ID:teuben,项目名称:admit,代码行数:25,代码来源:File_AT.py

示例10: check

# 需要导入模块: from admit.util.AdmitLogging import AdmitLogging [as 别名]
# 或者: from admit.util.AdmitLogging.AdmitLogging import info [as 别名]
    def check(self, name, attrib=None, value=None):
        """ Method to check a node for validity. Validity includes correct name
            and data type.

            Parameters
            ----------
            name : str
                The name of the node being checked

            attrib : str
                The attribute of the node being checked, if any.
                Default: None

            value : str
                The type of the attribute being checked (e.g. bt.INT)
                Default: None
        """
        # check a node for validity
        try:
            # note that the node has been found
            self.entities[name]["found"] = True
            # if there is an attribute specified then check it too
            # if the attribute was not expected just print a note to the screen
            if attrib is not None:
                try:
                    if not value in self.entities[name]["attrib"][attrib]["values"] \
                       and not "ANY" in self.entities[name]["attrib"][attrib]["values"]:
                        raise Exception("DTDParser.check: Value %s for attribute %s is not a valid entry (attribute = %s) (file %s)" % (value, name, attrib, self.xmlFile))
                    self.entities[name]["attrib"][attrib]["found"] = True
                except KeyError:
                    logging.info("Attribute %s for %s not listed in DTD, malformed xml detected (%s)" %
                                 (attrib, name, self.xmlFile))
                    logging.info("Inconsistency between dtd and xml detected, continuing")
                except:
                    logging.info("Unknown error encountered while parsing attribute %s for %s (%s)" %
                                 (attrib, name, self.xmlFile))
                    raise
        except KeyError:
            logging.info("Data member %s is not a member of the dtd, xml inconsistent with definition (%s)" %
                         (name, self.xmlFile))
        except:
            raise
开发者ID:teuben,项目名称:admit,代码行数:44,代码来源:DTDParser.py

示例11: run

# 需要导入模块: from admit.util.AdmitLogging import AdmitLogging [as 别名]
# 或者: from admit.util.AdmitLogging.AdmitLogging import info [as 别名]
    def run(self):
        """ The run method creates the BDP

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

            Returns
            -------
            None
        """
        dt = utils.Dtime("Export")                 # tagging time

        basename = self.getkey("basename")

        nbdp = len(self._bdp_in)
        logging.info("Found %d input BDPs" % nbdp)
        if nbdp > 1:
            logging.info("Only dealing with 1 BDP now")
        
 
        b1  = self._bdp_in[0]                      # image/cube
        infile = b1.getimagefile(bt.CASA)          # ADMIT filename of the image (cube)

        if len(basename) == 0:
            fitsname = self.mkext(infile,'fits')   # morph to the new output name with replaced extension '
            image_out = self.dir(fitsname)         # absolute filename
        else:
            if basename[0:2] == './' or basename[0] == '/':
                image_out = basename + ".fits"
            else:
                image_out = self.dir(basename + ".fits")
        
        dt.tag("start")

        logging.info("Writing FITS %s" % image_out)

        # @todo   check self.dir(image_out)
        casa.exportfits(self.dir(infile), image_out, overwrite=True)
        
        dt.tag("done")
        dt.end()
开发者ID:teuben,项目名称:admit,代码行数:44,代码来源:Export_AT.py

示例12: run

# 需要导入模块: from admit.util.AdmitLogging import AdmitLogging [as 别名]
# 或者: from admit.util.AdmitLogging.AdmitLogging import info [as 别名]
    def run(self):
        """ The run method, creates the slices, regrids if requested, and 
            creates the BDP(s)

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

            Returns
            -------
            None
        """
        dt = utils.Dtime("LineCube")
        self._summary = {}
        # look for an input noise level, either through keyword or input 
        # CubeStats BDP or calculate it if needed
        pad = self.getkey("pad")
        equalize = self.getkey("equalize")
        minchan = 0

        linelist = self._bdp_in[1]
        if linelist == None or len(linelist) == 0:
            logging.info("No lines found in input LineList_BDP, exiting.")
            return

        spw = self._bdp_in[0]
        # get the columns from the table
        cols = linelist.table.getHeader()
        # get the casa image
        imagename = spw.getimagefile(bt.CASA)
        imh = imhead(self.dir(imagename), mode='list')
        # set the overall parameters for imsubimage
        args = {"imagename" : self.dir(imagename),
                "overwrite" : True}

        dt.tag("start")

        if pad != 0:
            nchan = imh['shape'][2]
            dt.tag("pad") 

        # if equal size cubes are requested, this will honor the requested pad
        if equalize:
            start = linelist.table.getColumnByName("startchan")
            end = linelist.table.getColumnByName("endchan")
            # look for the widest line
            for i in range(len(start)):
                diff = end[i] - start[i] + 1
                minchan = max(minchan , diff + (pad * 2))
            dt.tag("equalize")

        # get all of the rows in the table
        rows = linelist.getall()
        delrow = set()
        procblend = [0]
        # search through looking for blended lines, leave only the strongest from each blend
        # in the list
        for i, row in enumerate(rows):
            if row.blend in procblend:
                continue
            strongest = -100.
            index = -1
            indexes = []
            blend = row.blend
            for j in range(i, len(rows)):
                if rows[j].blend != blend:
                    continue
                indexes.append(j)
                if rows[j].linestrength > strongest:
                    strongest = rows[j].linestrength
                    index = j
            indexes.remove(index)
            delrow = delrow | set(indexes)
            procblend.append(blend)
        dr = list(delrow)
        dr.sort()
        dr.reverse()
        for row in dr:
            del rows[row]

        # check on duplicate UID's, since those are the directory names here
        uid1 = []
        for row in rows:
            uid1.append(row.getkey("uid"))
        uid2 = set(uid1)
        if len(uid1) != len(uid2):
            print "LineList:",uid1
            logging.warning("There are duplicate names in the LineList")
            #raise Exception,"There are duplicate names in the LineList"

        # Create Summary table
        lc_description = admit.util.Table()
        lc_description.columns = ["Line Name","Start Channel","End Channel","Output Cube"]
        lc_description.units   = ["","int","int",""]
        lc_description.description = "Parameters of Line Cubes"
        # loop over all entries in the line list
        rdata = []
        for row in rows:
            uid = row.getkey("uid")
            cdir = self.mkext(imagename,uid)
#.........这里部分代码省略.........
开发者ID:teuben,项目名称:admit,代码行数:103,代码来源:LineCube_AT.py

示例13: run

# 需要导入模块: from admit.util.AdmitLogging import AdmitLogging [as 别名]
# 或者: from admit.util.AdmitLogging.AdmitLogging import info [as 别名]
    def run(self):
        """ The run method creates the BDP

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

            Returns
            -------
            None
        """
        dt = utils.Dtime("SFind2D")               # tagging time
        self._summary = {}
        # get key words that user input
        nsigma = self.getkey("numsigma")
        sigma  = self.getkey("sigma")
        region = self.getkey("region")
        robust = self.getkey("robust")
        snmax  = self.getkey("snmax")
        ds9 = True                                     # writes a "ds9.reg" file
        mpl = True                                     # aplot.map1() plot
        dynlog = 20.0                                  # above this value of dyn range finder chart is log I-scaled
        bpatch = True                                  # patch units to Jy/beam for ia.findsources()
        
        # get the input casa image from bdp[0]
        bdpin = self._bdp_in[0]
        infile = bdpin.getimagefile(bt.CASA)
        if mpl:
            data = np.flipud(np.rot90(casautil.getdata(self.dir(infile)).data))

        # check if there is a 2nd image (which will be a PB)
        for i in range(len(self._bdp_in)):
            print 'BDP',i,type(self._bdp_in[i])

        if self._bdp_in[2] != None:
            bdpin_pb  = self._bdp_in[1]            
            bdpin_cst = self._bdp_in[2]
            print "Need to process PB"
        else:
            bdpin_pb  = None
            bdpin_cst = self._bdp_in[1]
            print "No PB given"
            

        # get the output bdp basename
        slbase = self.mkext(infile,'sl')

        # make sure it's a 2D map
        if not casautil.mapdim(self.dir(infile),2):
            raise Exception,"Input map dimension not 2: %s" % infile

        # arguments for imstat call if required
        args = {"imagename" : self.dir(infile)}
        if region != "":
            args["region"] = region
        dt.tag("start")

        # The following code sets the sigma level for searching for sources using
        # the sigma and snmax keyword as appropriate
        # if no CubeStats BDP was given and no sigma was specified:
        # find a noise level via casa.imstat()
        # if a CubeStat_BDP is given get it from there.
        if bdpin_cst == None:
            # get statistics from input image with imstat because no CubeStat_BDP
            stat  = casa.imstat(**args)
            dmin  = float(stat["min"][0])                 # these would be wrong if robust were used already
            dmax  = float(stat["max"][0])
            args.update(casautil.parse_robust(robust))    # only now add robust keywords for the sigma
            stat  = casa.imstat(**args)            
            if sigma <= 0.0 :
                sigma = float(stat["sigma"][0])
            dt.tag("imstat")
        else:
            # get statistics from CubeStat_BDP 
            sigma = bdpin_cst.get("sigma")
            dmin  = bdpin_cst.get("minval")
            dmax  = bdpin_cst.get("maxval")

        self.setkey("sigma",sigma)
        # calculate cutoff based either on RMS or dynamic range limitation
        drange = dmax/(nsigma*sigma)
        if snmax < 0.0 :
            snmax = drange
        if drange > snmax :
            cutoff = 1.0/snmax
        else:
            cutoff = 1.0/drange
        logging.info("sigma, dmin, dmax, snmax, cutoff %g %g %g %g %g" % (sigma, dmin, dmax, snmax, cutoff))
        # define arguments for call to findsources
        args2 = {"cutoff" : cutoff}
        args2["nmax"] = 30
        if region != "" :
            args2["region"] = region
        #args2["mask"] = ""
        args2["point"] = False
        args2["width"] = 5
        args2["negfind"] = False
        # set-up for SourceList_BDP
        slbdp = SourceList_BDP(slbase)

#.........这里部分代码省略.........
开发者ID:teuben,项目名称:admit,代码行数:103,代码来源:SFind2D_AT.py

示例14: endElement

# 需要导入模块: from admit.util.AdmitLogging import AdmitLogging [as 别名]
# 或者: from admit.util.AdmitLogging.AdmitLogging import info [as 别名]
    def endElement(self, name):
        """ Method called whenever the end of an xml element is reached. This
            method is only called by the SAX parser iteself.

            Parameters
            ----------
            name : str
                The name of the node that just ended

            Returns
            -------
            None
        """
        # reset the tracking stuff, add BDP's to AT's, AT's to the flowmanager
        # reconstruct any nodes that spanned multiple lines
        if name == self.utilName:
            # add the utility classes to the appropriate parent class
            # Images always get added to MultiImages
            if self.inMulti:
                self.MultiImage.addimage(copy.deepcopy(self.Util), self.Util.name)
            elif self.inBDP:
                setattr(self.BDP, self.utilName, copy.deepcopy(self.Util))
            elif self.inAT:
                setattr(self.curAT, self.utilName, copy.deepcopy(self.Util))
            self.inUtil = False
            self.utilName = ""
        elif name == self.multiName:
            if self.inBDP:
                setattr(self.BDP, self.multiName, copy.deepcopy(self.MultiImage))
            elif self.inAT:
                setattr(self.curAT, self.multiName, copy.deepcopy(self.MultiImage))
            self.multiImageName = ""
            self.inMulti = False
            self.inUtil = False
        elif name == bt.BDP:
            # one last validation run
            self.BDP._baseDir = self.basedir
            if not self.dtd.checkAll():
                logging.info("Some required nodes missing from xml file, attempting to continue anyway.")
        elif name == bt.FLOWMANAGER:
            temp = aast.literal_eval(self.flowdata)
            for key in ["depsmap", "varimap"]:
                if key in temp:
                    temp[key] = eval(temp[key])
            self.flowmanager = fm.FlowManager(**temp)

            self.inflow = False
        elif isinstance(self.type, str):
            if self.inUtil:
                target = self.Util
            elif self.inBDP:
                target = self.BDP
            elif self.inAT:
                target = self.curAT
            elif self.inSummaryEntry:
                target = self.summaryEntry
            elif name == "projmanager":
                target = self
            else:
                target = self.admit

            self.setattr(target, name, self.tempdata)
            self.tempdata = ""
        elif isinstance(self.type, list) or isinstance(self.type, dict) \
           or isinstance(self.type, tuple) or isinstance(self.type, set):
            temp = aast.literal_eval(self.tempdata)
            if self.inUtil:
                target = self.Util
            elif self.inBDP:
                target = self.BDP
            elif self.inAT:
                target = self.curAT
            elif self.inSummaryEntry:
                target = self.summaryEntry
            elif name == "projmanager":
                target = self
            else:
                target = self.admit
            for i in self.ndarr:
                temp[i] = np.array(temp[i], dtype=object)
            for i in self.sets:
                temp[i] = set(temp[i])
            if isinstance(self.type, tuple):
                temp = tuple(temp)
            elif isinstance(self.type, set):
                temp = set(temp)
            try:
                self.setattr(target, name, temp)
            except AttributeError:
                logging.info("Data member %s is not a member of %s. This may be due to a version mismatch between the data and your software, attempting to continue." % (self.name, str(type(target))))
            except:
                raise
        elif isinstance(self.type, np.ndarray):
            temp = aast.literal_eval(self.tempdata)
            if self.inUtil:
                target = self.Util
            elif self.inBDP:
                target = self.BDP
            elif self.inAT:
                target = self.curAT
#.........这里部分代码省略.........
开发者ID:teuben,项目名称:admit,代码行数:103,代码来源:AdmitParser.py

示例15: run

# 需要导入模块: from admit.util.AdmitLogging import AdmitLogging [as 别名]
# 或者: from admit.util.AdmitLogging.AdmitLogging import info [as 别名]

#.........这里部分代码省略.........
        dt.tag("imstat0")
        imstat1 = casa.imstat(self.dir(fin),axes=[0,1],logfile=self.dir('imstat1.logfile'),append=False,**rargs)
        dt.tag("imstat1")
        # imm = casa.immoments(self.dir(fin),axis='spec', moments=8, outfile=self.dir('ppp.im'))
        if nrargs > 0:
            # need to get the peaks without rubust
            imstat10 = casa.imstat(self.dir(fin),           logfile=self.dir('imstat0.logfile'),append=True)
            dt.tag("imstat10")
            imstat11 = casa.imstat(self.dir(fin),axes=[0,1],logfile=self.dir('imstat1.logfile'),append=True)
            dt.tag("imstat11")

        # grab the relevant plane-based things from imstat1
        if nrargs == 0:
            mean    = imstat1["mean"]
            sigma   = imstat1["medabsdevmed"]*1.4826     # see also: astropy.stats.median_absolute_deviation()
            peakval = imstat1["max"]
            minval  = imstat1["min"]
        else:
            mean    = imstat1["mean"]
            sigma   = imstat1["rms"]
            peakval = imstat11["max"]
            minval  = imstat11["min"]

        if True:
            # work around a bug in imstat(axes=[0,1]) for last channel [CAS-7697]
            for i in range(len(sigma)):
                if sigma[i] == 0.0:
                    minval[i] = peakval[i] = 0.0

        # too many variations in the RMS ?
        sigma_pos = sigma[np.where(sigma>0)]
        smin = sigma_pos.min()
        smax = sigma_pos.max()
        logging.info("sigma varies from %f to %f; %d/%d channels ok" % (smin,smax,len(sigma_pos),len(sigma)))
        if maxvrms > 0:
            if smax/smin > maxvrms:
                cliprms = smin * maxvrms
                logging.warning("sigma varies too much, going to clip to %g (%g > %g)" % (cliprms, smax/smin, maxvrms))
                sigma = np.where(sigma < cliprms, sigma, cliprms)

        # @todo   (and check again) for foobar.fits all sigma's became 0 when robust was selected
        #         was this with mask=True/False?

        # PeakPointPlot (can be expensive, hence the option)
        if use_ppp:
            logging.info("Computing MaxPos for PeakPointPlot")
            xpos    = np.zeros(nchan)
            ypos    = np.zeros(nchan)
            peaksum = np.zeros(nchan)

            ia.open(self.dir(fin))
            for i in range(nchan):
                if sigma[i] > 0.0:
                    plane = ia.getchunk(blc=[0,0,i,-1],trc=[-1,-1,i,-1],dropdeg=True)
                    v = ma.masked_invalid(plane)
                    v_abs = np.absolute(v)
                    max = np.unravel_index(v_abs.argmax(), v_abs.shape)
                    xpos[i] = max[0]
                    ypos[i] = max[1]
                    if numsigma > 0.0:
                        peaksum[i] = ma.masked_less(v,numsigma * sigma[i]).sum()
            peaksum = np.nan_to_num(peaksum)    # put 0's where nan's are found
            ia.close()
            dt.tag("ppp")

        nzeros = len(np.where(sigma<=0.0))
开发者ID:teuben,项目名称:admit,代码行数:70,代码来源:CubeStats_AT.py


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