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

Python logging.warning函数代码示例

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

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



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

示例1: onResize

 def onResize(self, width, height):
     """A method that will be called if the window detects a resize event
     """
     logging.warning("dispatchEvents() method in {} was called "
                     "but is not implemented. Is it needed?"
                     .format(self.win.winType)
                     )
开发者ID:flipphillips,项目名称:psychopy,代码行数:7,代码来源:_base.py


示例2: __init__

    def __init__(self,
                    win,
                    contrast=1.0,
                    gamma=None,
                    nEntries=256,
                    mode='bits++',
                    rampType = 'configFile'):
        self.win = win
        self.contrast=contrast
        self.nEntries=nEntries
        self.mode = mode
        self.method = 'fast' #used to allow setting via USB which was 'slow'
        self.gammaCorrect = 'software' #Bits++ doesn't do its own correction so we need to

        #import pyglet.GL late so that we can import bits.py without it initially
        global GL, visual
        from psychopy import visual
        import pyglet.gl as GL

        if self.gammaCorrect=='software':
            if gamma is None:
                self.gamma = win.gamma #inherit from window
            elif len(gamma)>2: # [Lum,R,G,B] or [R,G,B]
                self.gamma=gamma[-3:]
            else:
                self.gamma = [gamma, gamma, gamma]
        if init():
            setVideoMode(NOGAMMACORRECT|VIDEOENCODEDCOMMS)
            self.initialised=True
            logging.debug('found and initialised bits++')
        else:
            self.initialised=False
            logging.warning("couldn't initialise bits++")

        #do the processing
        self._HEADandLUT = np.zeros((524,1,3),np.uint8)
        self._HEADandLUT[:12,:,0] = np.asarray([ 36, 63, 8, 211, 3, 112, 56, 34,0,0,0,0]).reshape([12,1])#R
        self._HEADandLUT[:12,:,1] = np.asarray([ 106, 136, 19, 25, 115, 68, 41, 159,0,0,0,0]).reshape([12,1])#G
        self._HEADandLUT[:12,:,2] = np.asarray([ 133, 163, 138, 46, 164, 9, 49, 208,0,0,0,0]).reshape([12,1])#B
        self.LUT=np.zeros((256,3),'d')        #just a place holder
        self.setLUT()#this will set self.LUT and update self._LUTandHEAD
        self._setupShaders()
        #replace window methods with our custom ones
        self.win._prepareFBOrender = self._prepareFBOrender
        self.win._finishFBOrender = self._finishFBOrender
        self.win._afterFBOrender = self._afterFBOrender
        #set gamma of the window to the identity LUT
        if rampType == 'configFile':
            #now check that we have a valid configuration of the box
            self.config = Config(self)
            #check that this matches the prev config for our graphics card etc
            ok=False #until we find otherwise
            ok = self.config.quickCheck()
            if ok:
                self.win.gammaRamp = self.config.identityLUT
            else:
                rampType = None
        if not rampType == 'configFile': #'this must NOT be an `else` from the above `if` because can be overidden
            #possibly we were given a numerical rampType (as in the :func:`psychopy.gamma.setGamma()`)
            self.win.winHandle.setGamma(self.win.winHandle, rampType=rampType)
开发者ID:alexholcombe,项目名称:psychopy,代码行数:60,代码来源:bits.py


示例3: lms2rgb

def lms2rgb(lms_Nx3, conversionMatrix=None):
    """Convert from cone space (Long, Medium, Short) to RGB.

    Requires a conversion matrix, which will be generated from generic
    Sony Trinitron phosphors if not supplied (note that you will not get
    an accurate representation of the color space unless you supply a
    conversion matrix)

    usage::

        rgb_Nx3 = lms2rgb(dkl_Nx3(el,az,radius), conversionMatrix)

    """

    lms_3xN = numpy.transpose(lms_Nx3)#its easier to use in the other orientation!

    if conversionMatrix==None:
        cones_to_rgb = numpy.asarray([ \
            #L        M        S
            [ 4.97068857, -4.14354132, 0.17285275],#R
            [-0.90913894, 2.15671326, -0.24757432],#G
            [-0.03976551, -0.14253782, 1.18230333]#B
            ])
        logging.warning('This monitor has not been color-calibrated. Using default LMS conversion matrix.')
    else: cones_to_rgb=conversionMatrix

    rgb_to_cones = numpy.linalg.pinv(cones_to_rgb)#get inverse
    rgb = numpy.dot(cones_to_rgb, lms_3xN)
    return numpy.transpose(rgb)#return in the shape we received it
开发者ID:glupyan,项目名称:psychopy,代码行数:29,代码来源:misc.py


示例4: calibrateZero

    def calibrateZero(self):
        """Perform a calibration to zero light.

        For early versions of the ColorCAL this had to be called after
        connecting to the device. For later versions the dark calibration
        was performed at the factory and stored in non-volatile memory.

        You can check if you need to run a calibration with::

            ColorCAL.getNeedsCalibrateZero()
        """
        val = self.sendMessage(b"UZC", timeout=1.0)
        if val == 'OK00':
            pass
        elif val == 'ER11':
            logging.error(
                "Could not calibrate ColorCAL2. Is it properly covered?")
            return False
        else:  # unlikely
            logging.warning(
                "Received surprising result from ColorCAL2: %s" % val)
            return False
        # then take a measurement to see if we are close to zero lum (ie is it
        # covered?)
        self.ok, x, y, z = self.measure()
        if y > 3:
            logging.error('There seems to be some light getting to the '
                          'detector. It should be well-covered for zero '
                          'calibration')
            return False
        self._zeroCalibrated = True
        self.calibMatrix = self.getCalibMatrix()
        return True
开发者ID:ChenTzuYin,项目名称:psychopy,代码行数:33,代码来源:colorcal.py


示例5: __init__

    def __init__(self,
                    win,
                    contrast=1.0,
                    gamma=[1.0,1.0,1.0],
                    nEntries=256,
                    mode='bits++',):
        self.win = win
        self.contrast=contrast
        self.nEntries=nEntries
        self.mode = mode
        self.method = 'fast' #used to allow setting via USB which was 'slow'

        if len(gamma)>2: # [Lum,R,G,B] or [R,G,B]
            self.gamma=gamma[-3:]
        else:
            self.gamma = [gamma, gamma, gamma]

        if init():
            setVideoMode(NOGAMMACORRECT|VIDEOENCODEDCOMMS)
            self.initialised=True
            logging.debug('found and initialised bits++')
        else:
            self.initialised=False
            logging.warning("couldn't initialise bits++")

        #do the processing
        self._HEADandLUT = np.zeros((524,1,3),np.uint8)
        self._HEADandLUT[:12,:,0] = np.asarray([ 36, 63, 8, 211, 3, 112, 56, 34,0,0,0,0]).reshape([12,1])#R
        self._HEADandLUT[:12,:,1] = np.asarray([ 106, 136, 19, 25, 115, 68, 41, 159,0,0,0,0]).reshape([12,1])#G
        self._HEADandLUT[:12,:,2] = np.asarray([ 133, 163, 138, 46, 164, 9, 49, 208,0,0,0,0]).reshape([12,1])#B
        self.LUT=np.zeros((256,3),'d')        #just a place holder
        self.setLUT()#this will set self.LUT and update self._LUTandHEAD
        self._setupShaders()
开发者ID:Lx37,项目名称:psychopy,代码行数:33,代码来源:bits.py


示例6: __init__

 def __init__(self, name='', autoLog=True):
     self.name = name
     self.status = NOT_STARTED
     self.autoLog = autoLog
     if self.autoLog:
         logging.warning("%s is calling MinimalStim.__init__() with autolog=True. Set autoLog to True only at the end of __init__())" \
                         %(self.__class__.__name__))
开发者ID:larigaldie-n,项目名称:psychopy,代码行数:7,代码来源:basevisual.py


示例7: pavlovia

 def pavlovia(self, proj):
     global knownProjects
     self.__dict__['pavlovia'] = proj
     if not hasattr(proj, 'attributes'):
         return
     thisID = proj.attributes['path_with_namespace']
     if thisID in knownProjects \
             and os.path.exists(knownProjects[thisID]['localRoot']):
         rememberedProj = knownProjects[thisID]
         if rememberedProj['idNumber'] != proj.attributes['id']:
             logging.warning("Project {} has changed gitlab ID since last "
                             "use (was {} now {})"
                             .format(thisID,
                                     rememberedProj['idNumber'],
                                     proj.attributes['id']))
         self.update(rememberedProj)
     elif 'localRoot' in self:
         # this means the local root was set before the remote was known
         self['id'] = proj.attributes['path_with_namespace']
         self['idNumber'] = proj.attributes['id']
         knownProjects[self['id']] = self
     else:
         self['localRoot'] = ''
         self['id'] = proj.attributes['path_with_namespace']
         self['idNumber'] = proj.attributes['id']
     self['remoteSSH'] = proj.ssh_url_to_repo
     self['remoteHTTPS'] = proj.http_url_to_repo
开发者ID:hoechenberger,项目名称:psychopy,代码行数:27,代码来源:pavlovia.py


示例8: __init__

    def __init__(self,
                 port=None,
                 sendBreak=False,
                 smoothing=False,
                 bufferSize=262144):
        # if we're trying to send the break signal then presumably the device
        # is sleeping
        if sendBreak:
            checkAwake = False
        else:
            checkAwake = True
        # run initialisation; parity = enable parity checking
        super(BlackBoxToolkit, self).__init__(port,
                                              baudrate=230400, eol="\r\n",
                                              parity='N',
                                              pauseDuration=1.0,  # 1 second pause!! slow device
                                              checkAwake=checkAwake)
        if sendBreak:
            self.sendBreak()
            time.sleep(3.0)  # give time to reset

        if smoothing == False:
            # For use with CRT monitors which require smoothing. LCD monitors do not.
            # Remove smoothing for optos, but keep mic smoothing - refer to BBTK handbook re: mic smoothing latency
            # Important to remove smoothing for optos, as smoothing adds 20ms delay to timing.
            logging.info("Opto sensor smoothing removed.  Mic1 and Mic2 smoothing still active.")
            self.setSmoothing('11000000')
            self.pause()

        try: # set buffer size - can make proportional to size of data (32 bytes per line * events)+1000
            self.com.set_buffer_size(bufferSize)
        except Exception:
            logging.warning("Could not set buffer size. The default buffer size for Windows is 4096 bytes.")
开发者ID:dgfitch,项目名称:psychopy,代码行数:33,代码来源:__init__.py


示例9: add

    def add(self, thisType, value, position=None):
        """Add data to an existing data type (and add a new one if necess)
        """
        if not thisType in self:
            self.addDataType(thisType)
        if position is None:
            # 'ran' is always the first thing to update
            repN = sum(self['ran'][self.trials.thisIndex])
            if thisType != 'ran':
                # because it has already been updated
                repN -= 1
            # make a list where 1st digit is trial number
            position = [self.trials.thisIndex]
            position.append(repN)

        # check whether data falls within bounds
        posArr = np.asarray(position)
        shapeArr = np.asarray(self.dataShape)
        if not np.alltrue(posArr < shapeArr):
            # array isn't big enough
            logging.warning('need a bigger array for: ' + thisType)
            # not implemented yet!
            self[thisType] = extendArr(self[thisType], posArr)
        # check for ndarrays with more than one value and for non-numeric data
        if (self.isNumeric[thisType] and
                ((type(value) == np.ndarray and len(value) > 1) or
                     (type(value) not in [float, int]))):
            self._convertToObjectArray(thisType)
        # insert the value
        self[thisType][position[0], int(position[1])] = value
开发者ID:bergwiesel,项目名称:psychopy,代码行数:30,代码来源:base.py


示例10: rgb2lms

def rgb2lms(rgb_Nx3, conversionMatrix=None):
    """Convert from RGB to cone space (LMS).

    Requires a conversion matrix, which will be generated from generic
    Sony Trinitron phosphors if not supplied (note that you will not get
    an accurate representation of the color space unless you supply a
    conversion matrix)

    usage::

        lms_Nx3 = rgb2lms(rgb_Nx3(el,az,radius), conversionMatrix)

    """

    # its easier to use in the other orientation!
    rgb_3xN = numpy.transpose(rgb_Nx3)

    if conversionMatrix is None:
        cones_to_rgb = numpy.asarray([
            # L        M        S
            [4.97068857, -4.14354132, 0.17285275],  # R
            [-0.90913894, 2.15671326, -0.24757432],  # G
            [-0.03976551, -0.14253782, 1.18230333]])  # B

        logging.warning('This monitor has not been color-calibrated. '
                        'Using default LMS conversion matrix.')
    else:
        cones_to_rgb = conversionMatrix
    rgb_to_cones = numpy.linalg.inv(cones_to_rgb)

    lms = numpy.dot(rgb_to_cones, rgb_3xN)
    return numpy.transpose(lms)  # return in the shape we received it
开发者ID:hoechenberger,项目名称:psychopy,代码行数:32,代码来源:colorspacetools.py


示例11: _getNextFrame

 def _getNextFrame(self):
     # get next frame info ( do not decode frame yet)
     while self.status == PLAYING:
         if self._video_stream.grab():
             self._prev_frame_index = self._next_frame_index
             self._prev_frame_sec = self._next_frame_sec
             self._next_frame_index = self._video_stream.get(cv2.cv.CV_CAP_PROP_POS_FRAMES)
             if self._requested_fps and self._no_audio:
                 self._next_frame_sec = self._next_frame_index/self._requested_fps#*self._video_stream.get(cv2.cv.CV_CAP_PROP_POS_MSEC)/1000.0
             else:
                 self._next_frame_sec = self._video_stream.get(cv2.cv.CV_CAP_PROP_POS_MSEC)/1000.0
             self._video_perc_done = self._video_stream.get(cv2.cv.CV_CAP_PROP_POS_AVI_RATIO)
             self._next_frame_displayed = False
             if self.getTimeToNextFrameDraw() > -self._inter_frame_interval/2.0:
                 return self._next_frame_sec
             else:
                 self.nDroppedFrames += 1
                 if self.nDroppedFrames < reportNDroppedFrames:
                     logging.warning("MovieStim2 dropping video frame index: %d"%(self._next_frame_index))
                 elif self.nDroppedFrames == reportNDroppedFrames:
                     logging.warning("Multiple Movie frames have "
                                     "occurred - I'll stop bothering you "
                                     "about them!")
         else:
             self._onEos()
             break
开发者ID:alexholcombe,项目名称:psychopy,代码行数:26,代码来源:movie2.py


示例12: push

    def push(self, syncPanel=None, progressHandler=None):
        """Push to remote from local copy of the repository

        Parameters
        ----------
        syncPanel
        progressHandler

        Returns
        -------
            1 if successful
            -1 if project deleted on remote
        """
        if syncPanel:
            syncPanel.statusAppend("\nPushing changes to remote...")
        origin = self.repo.remotes.origin
        try:
            info = self.repo.git.push()  # progress=progressHandler
        except git.exc.GitCommandError as e:
            if ("The project you were looking for could not be found" in
                    traceback.format_exc()):
                # we are pointing to a project at pavlovia but it doesn't exist
                # suggest we create it
                logging.warning("Project not found on gitlab.pavlovia.org")
                return MISSING_REMOTE
            else:
                raise e
        logging.debug('push report: {}'.format(info))
        if syncPanel:
            syncPanel.statusAppend("done")
            if info:
                syncPanel.statusAppend("\n{}".format(info))
        return 1
开发者ID:mmagnuski,项目名称:psychopy,代码行数:33,代码来源:pavlovia.py


示例13: sendUsageStats

def sendUsageStats(app=None):
    """Sends anonymous, very basic usage stats to psychopy server:
      the version of PsychoPy
      the system used (platform and version)
      the date
    """

    v = psychopy.__version__
    dateNow = time.strftime("%Y-%m-%d_%H:%M")
    miscInfo = ''

    # get platform-specific info
    if sys.platform == 'darwin':
        OSXver, junk, architecture = platform.mac_ver()
        systemInfo = "OSX_%s_%s" % (OSXver, architecture)
    elif sys.platform.startswith('linux'):
        systemInfo = '%s_%s_%s' % (
            'Linux',
            ':'.join([x for x in platform.dist() if x != '']),
            platform.release())
        if len(systemInfo) > 30:  # if it's too long PHP/SQL fails to store!?
            systemInfo = systemInfo[0:30]
    elif sys.platform == 'win32':
        systemInfo = "win32_v" + platform.version()
    else:
        systemInfo = platform.system() + platform.release()
    u = "http://www.psychopy.org/usage.php?date=%s&sys=%s&version=%s&misc=%s"
    URL = u % (dateNow, systemInfo, v, miscInfo)
    try:
        page = requests.get(URL, proxies=web.proxies)  # proxies
    except Exception:
        logging.warning("Couldn't connect to psychopy.org\n"
                        "Check internet settings (and proxy "
                        "setting in PsychoPy Preferences.")
开发者ID:hoechenberger,项目名称:psychopy,代码行数:34,代码来源:sendusage.py


示例14: _setVersion

    def _setVersion(version):
        """
        Sets the version to be used for compiling using the useVersion function

        Parameters
        ----------
        version: string
            The version requested
        """

        # Set version
        if version:
            from psychopy import useVersion
            useVersion(version)

        global logging

        from psychopy import logging

        if __name__ != '__main__' and version not in [None, 'None', 'none', '']:
            version = None
            msg = "You cannot set version by calling compileScript() manually. Setting 'version' to None."
            logging.warning(msg)

        return version
开发者ID:hoechenberger,项目名称:psychopy,代码行数:25,代码来源:psyexpCompile.py


示例15: OnDropFiles

 def OnDropFiles(self, x, y, filenames):
     logging.debug('PsychoPyBuilder: received dropped files: %s' % filenames)
     for filename in filenames:
         if filename.endswith('.psyexp') or filename.lower().endswith('.py'):
             self.builder.fileOpen(filename=filename)
         else:
             logging.warning('dropped file ignored: did not end in .psyexp or .py')
开发者ID:papr,项目名称:psychopy,代码行数:7,代码来源:utils.py


示例16: setMarker

    def setMarker(self, tone=19000, secs=0.015, volume=0.03, log=True):
        """Sets the onset marker, where `tone` is either in hz or a custom sound.

        The default tone (19000 Hz) is recommended for auto-detection, as being
        easier to isolate from speech sounds (and so reliable to detect). The default duration
        and volume are appropriate for a quiet setting such as a lab testing
        room. A louder volume, longer duration, or both may give better results
        when recording loud sounds or in noisy environments, and will be
        auto-detected just fine (even more easily). If the hardware microphone
        in use is not physically near the speaker hardware, a louder volume is
        likely to be required.

        Custom sounds cannot be auto-detected, but are supported anyway for
        presentation purposes. E.g., a recording of someone saying "go" or
        "stop" could be passed as the onset marker.
        """
        if hasattr(tone, "play"):
            self.marker_hz = 0
            self.marker = tone
            if log and self.autoLog:
                logging.exp("custom sound set as marker; getMarkerOnset() will not be able to auto-detect onset")
        else:
            self.marker_hz = float(tone)
            sampleRate = sound.pyoSndServer.getSamplingRate()
            if sampleRate < 2 * self.marker_hz:
                # NyquistError
                logging.warning(
                    "Recording rate (%i Hz) too slow for %i Hz-based marker detection."
                    % (int(sampleRate), self.marker_hz)
                )
            if log and self.autoLog:
                logging.exp("frequency of recording onset marker: %.1f" % self.marker_hz)
            self.marker = sound.Sound(self.marker_hz, secs, volume=volume, name=self.name + ".marker_tone")
开发者ID:rpbaxter,项目名称:psychopy,代码行数:33,代码来源:microphone.py


示例17: rush

def rush(value=True, realtime=False):
    """Raise the priority of the current thread/process using
        - sched_setscheduler

    realtime arg is not used in Linux implementation.

    NB for rush() to work on (debian-based?) Linux requires that the
    script is run using a copy of python that is allowed to change
    priority, eg: sudo setcap cap_sys_nice=eip <sys.executable>,
    and maybe restart PsychoPy. If <sys.executable> is the system python,
    it's important to restore it back to normal to avoid possible
    side-effects. Alternatively, use a different python executable,
    and change its cap_sys_nice.

    For RedHat-based systems, 'sudo chrt ...' at run-time might be
    needed instead, not sure.
    see http://rt.et.redhat.com/wiki/images/8/8e/Rtprio.pdf
    """
    if importCtypesFailed:
        return False

    if value:  # set to RR with max priority
        schedParams = _SchedParams()
        schedParams.sched_priority = c.sched_get_priority_max(SCHED_RR)
        err = c.sched_setscheduler(0, SCHED_RR, ctypes.byref(schedParams))
        if err == -1:  # returns 0 if OK
            logging.warning(warnMax % (sys.executable, sys.executable))
    else:  # set to RR with normal priority
        schedParams = _SchedParams()
        schedParams.sched_priority = c.sched_get_priority_min(SCHED_NORMAL)
        err = c.sched_setscheduler(0, SCHED_NORMAL, ctypes.byref(schedParams))
        if err == -1:  # returns 0 if OK
            logging.warning(warnNormal % sys.executable)

    return True
开发者ID:flipphillips,项目名称:psychopy,代码行数:35,代码来源:linux.py


示例18: _setupFrameBuffer

    def _setupFrameBuffer(self):
        # Setup framebuffer
        self.frameBuffer = FB.glGenFramebuffersEXT(1)

        FB.glBindFramebufferEXT(FB.GL_FRAMEBUFFER_EXT, self.frameBuffer)
        # Setup depthbuffer
        self.depthBuffer = FB.glGenRenderbuffersEXT(1)
        FB.glBindRenderbufferEXT (FB.GL_RENDERBUFFER_EXT,self.depthBuffer)
        FB.glRenderbufferStorageEXT (FB.GL_RENDERBUFFER_EXT, GL.GL_DEPTH_COMPONENT, int(self.size[0]), int(self.size[1]))

        # Create texture to render to
        self.frameTexture = c_uint(0)
        GL.glGenTextures (1, self.frameTexture)
        GL.glBindTexture (GL.GL_TEXTURE_2D, self.frameTexture)
        GL.glTexParameteri (GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR)
        GL.glTexParameteri (GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR)
        GL.glTexImage2D (GL.GL_TEXTURE_2D, 0, GL.GL_RGBA32F_ARB, int(self.size[0]), int(self.size[1]), 0,
                         GL.GL_RGBA, GL.GL_FLOAT, None)

        #attach texture to the frame buffer
        FB.glFramebufferTexture2DEXT (FB.GL_FRAMEBUFFER_EXT, GL.GL_COLOR_ATTACHMENT0_EXT,
                                      GL.GL_TEXTURE_2D, self.frameTexture, 0)
        FB.glFramebufferRenderbufferEXT(FB.GL_FRAMEBUFFER_EXT, GL.GL_DEPTH_ATTACHMENT_EXT,
                                        FB.GL_RENDERBUFFER_EXT, self.depthBuffer)

        status = FB.glCheckFramebufferStatusEXT (FB.GL_FRAMEBUFFER_EXT)
        if status != FB.GL_FRAMEBUFFER_COMPLETE_EXT:
            logging.warning("Error in framebuffer activation")
            return
        GL.glDisable(GL.GL_TEXTURE_2D)
开发者ID:neuromind81,项目名称:aibs,代码行数:30,代码来源:warpwindow.py


示例19: compareScreenshot

def compareScreenshot(fileName, win, crit=5.0):
    """Compare the current back buffer of the given window with the file

    Screenshots are stored and compared against the files under path
    kept in TESTS_DATA_PATH.  Thus specify relative path to that
    directory
    """
    #if we start this from a folder below run.py the data folder won't be found
    fileName = pjoin(TESTS_DATA_PATH, fileName)
    #get the frame from the window
    win.getMovieFrame(buffer='back')
    frame=win.movieFrames[-1]
    win.movieFrames=[]
    #if the file exists run a test, if not save the file
    if not isfile(fileName):
        frame.save(fileName, optimize=1)
        skip("Created %s" % basename(fileName))
    else:
        expected = Image.open(fileName)
        expDat = np.array(expected.getdata())
        imgDat = np.array(frame.getdata())
        rms = (((imgDat-expDat)**2).sum()/len(imgDat))**0.5
        filenameLocal = fileName.replace('.png','_local.png')
        if rms >= crit/2:
            #there was SOME discrepency
            logging.warning('PsychoPyTests: RMS=%.3g at threshold=%3.g'
                  % (rms, crit))
        if not rms<crit: #don't do `if rms>=crit because that doesn't catch rms=nan
            frame.save(filenameLocal, optimize=1)
            logging.warning('PsychoPyTests: Saving local copy into %s' % filenameLocal)
        assert rms<crit, \
            "RMS=%.3g at threshold=%.3g. Local copy in %s" % (rms, crit, filenameLocal)
开发者ID:Lx37,项目名称:psychopy,代码行数:32,代码来源:utils.py


示例20: push

    def push(self, infoStream=None):
        """Push to remote from local copy of the repository

        Parameters
        ----------
        infoStream

        Returns
        -------
            1 if successful
            -1 if project deleted on remote
        """
        if infoStream:
            infoStream.write("\nPushing changes from remote...")
        try:
            info = self.repo.git.push(self.remoteWithToken, 'master')
            infoStream.write("\n{}".format(info))
        except git.exc.GitCommandError as e:
            if ("The project you were looking for could not be found" in
                    traceback.format_exc()):
                    # pointing to a project at pavlovia but it doesn't exist
                    logging.warning("Project not found on gitlab.pavlovia.org")
                    return MISSING_REMOTE
            else:
                raise e

        logging.debug('push complete: {}'.format(self.remoteHTTPS))
        if infoStream:
            infoStream.write("done")
        return 1
开发者ID:hoechenberger,项目名称:psychopy,代码行数:30,代码来源:pavlovia.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python misc.fromFile函数代码示例发布时间:2022-05-25
下一篇:
Python logging.warn函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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