本文整理汇总了Python中pyo.getVersion函数的典型用法代码示例。如果您正苦于以下问题:Python getVersion函数的具体用法?Python getVersion怎么用?Python getVersion使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getVersion函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_soundpyo_array
def test_soundpyo_array(self):
"""anything using a numpy.array uses pyo.DataTable
"""
if pyo.getVersion() < (0, 7, 7):
pytest.xfail() # pyo leak fixed Oct 2015
for stim in [440, np.zeros(88200)]: # np.zeros(8820000) passes, slow
assert leakage(sound.SoundPyo, stim, secs=2) < THRESHOLD, 'stim = ' + str(stim)
开发者ID:DennisEckmeier,项目名称:psychopy,代码行数:7,代码来源:memory_usage.py
示例2: test_soundpyo_file
def test_soundpyo_file(self):
"""files are handled by pyo.SndFile
"""
if pyo.getVersion() < (0, 7, 7):
pytest.xfail()
from scipy.io import wavfile
tmp = os.path.join(self.tmp, 'zeros.wav')
wavfile.write(tmp, 44100, np.zeros(88200))
assert leakage(sound.SoundPyo, tmp) < THRESHOLD
开发者ID:DennisEckmeier,项目名称:psychopy,代码行数:10,代码来源:memory_usage.py
示例3: validateVersions
def validateVersions():
import sys
from pyo import getVersion
import wxversion
if sys.version_info[0] > VERSIONS['python'][0]:
printMessage("python {}.x must be used to run Pyo Synth from sources".format(VERSIONS['python'][0]), 2)
if getVersion() != VERSIONS['pyo']:
printMessage("pyo version installed: {}.{}.{} ; pyo version required {}.{}.{}".format(*getVersion()+VERSIONS['pyo']), 1)
printMessage("Installed pyo version doesn't match what Pyo Synth uses. Some objects might not be available.", 1)
if not wxversion.checkInstalled('2.8'):
printMessage("wxPython version required {}.{}.{}".format(*VERSIONS['wx']), 1)
开发者ID:alexandrepoirier,项目名称:PyoSynth,代码行数:11,代码来源:install.py
示例4: _setSystemInfo
def _setSystemInfo(self):
"""system info"""
# system encoding
osEncoding=sys.getfilesystemencoding()
# machine name
self['systemHostName'] = platform.node()
self['systemMemTotalRAM'], self['systemMemFreeRAM'] = getRAM()
# locale information:
loc = '.'.join([str(x) for x in locale.getlocale()]) # (None, None) -> str
if loc == 'None.None':
loc = locale.setlocale(locale.LC_ALL, '')
self['systemLocale'] = loc # == the locale in use, from OS or user-pref
# platform name, etc
if sys.platform in ['darwin']:
OSXver, _junk, architecture = platform.mac_ver()
platInfo = 'darwin ' + OSXver + ' ' + architecture
# powerSource = ...
elif sys.platform.startswith('linux'):
platInfo = 'linux ' + platform.release()
# powerSource = ...
elif sys.platform in ['win32']:
platInfo = 'windowsversion=' + repr(sys.getwindowsversion())
# powerSource = ...
else:
platInfo = ' [?]'
# powerSource = ...
self['systemPlatform'] = platInfo
#self['systemPowerSource'] = powerSource
# count all unique people (user IDs logged in), and find current user name & UID
self['systemUser'], self['systemUserID'] = _getUserNameUID()
try:
users = shellCall("who -q").splitlines()[0].split()
self['systemUsersCount'] = len(set(users))
except:
self['systemUsersCount'] = False
# when last rebooted?
try:
lastboot = shellCall("who -b").split()
self['systemRebooted'] = ' '.join(lastboot[2:])
except: # windows
sysInfo = shellCall('systeminfo').splitlines()
lastboot = [line for line in sysInfo if line.startswith("System Up Time") or line.startswith("System Boot Time")]
lastboot += ['[?]'] # put something in the list just in case
self['systemRebooted'] = lastboot[0].strip()
# R (and r2py) for stats:
try:
Rver = shellCall(["R", "--version"])
Rversion = Rver.splitlines()[0]
if Rversion.startswith('R version'):
self['systemRavailable'] = Rversion.strip()
try:
import rpy2
self['systemRpy2'] = rpy2.__version__
except ImportError:
pass
except:
pass
# encryption / security tools:
try:
vers, se = shellCall('openssl version', stderr=True)
if se:
vers = str(vers) + se.replace('\n', ' ')[:80]
if vers.strip():
self['systemSec.OpenSSLVersion'] = vers
except:
pass
try:
so = shellCall(['gpg', '--version'])
if so.find('GnuPG') > -1:
self['systemSec.GPGVersion'] = so.splitlines()[0]
self['systemSec.GPGHome'] = ''.join([line.replace('Home:', '').lstrip()
for line in so.splitlines()
if line.startswith('Home:')])
except:
pass
try:
import ssl
self['systemSec.pythonSSL'] = True
except ImportError:
self['systemSec.pythonSSL'] = False
# pyo for sound:
try:
import pyo
self['systemPyoVersion'] = '%i.%i.%i' % pyo.getVersion()
try:
# requires pyo svn r1024 or higher:
inp, out = pyo.pa_get_devices_infos()
for devList in [inp, out]:
for key in devList.keys():
if isinstance(devList[key]['name'], str):
devList[key]['name'] = devList[key]['name'].decode(osEncoding)
#.........这里部分代码省略.........
开发者ID:alexholcombe,项目名称:psychopy,代码行数:101,代码来源:info.py
示例5: initPyo
def initPyo(rate=44100, stereo=True, buffer=128):
"""setup the pyo (sound) server
"""
global pyoSndServer, Sound, audioDriver, duplex, maxChnls
Sound = SoundPyo
global pyo
try:
assert pyo
except NameError: # pragma: no cover
import pyo # microphone.switchOn() calls initPyo even if audioLib is something else
#subclass the pyo.Server so that we can insert a __del__ function that shuts it down
# skip coverage since the class is never used if we have a recent version of pyo
class _Server(pyo.Server): # pragma: no cover
core=core #make libs class variables so they don't get deleted first
logging=logging
def __del__(self):
self.stop()
self.core.wait(0.5)#make sure enough time passes for the server to shutdown
self.shutdown()
self.core.wait(0.5)#make sure enough time passes for the server to shutdown
self.logging.debug('pyo sound server shutdown')#this may never get printed
if '.'.join(map(str, pyo.getVersion())) < '0.6.4':
Server = _Server
else:
Server = pyo.Server
# if we already have a server, just re-initialize it
if 'pyoSndServer' in globals() and hasattr(pyoSndServer,'shutdown'):
pyoSndServer.stop()
core.wait(0.5)#make sure enough time passes for the server to shutdown
pyoSndServer.shutdown()
core.wait(0.5)
pyoSndServer.reinit(sr=rate, nchnls=maxChnls, buffersize=buffer, audio=audioDriver)
pyoSndServer.boot()
else:
if platform=='win32':
#check for output device/driver
devNames, devIDs=pyo.pa_get_output_devices()
audioDriver,outputID=_bestDriver(devNames, devIDs)
if outputID is None:
audioDriver = 'Windows Default Output' #using the default output because we didn't find the one(s) requested
outputID = pyo.pa_get_default_output()
if outputID is not None:
logging.info('Using sound driver: %s (ID=%i)' %(audioDriver, outputID))
maxOutputChnls = pyo.pa_get_output_max_channels(outputID)
else:
logging.warning('No audio outputs found (no speakers connected?')
return -1
#check for valid input (mic)
devNames, devIDs = pyo.pa_get_input_devices()
audioInputName, inputID = _bestDriver(devNames, devIDs)
if inputID is None:
audioInputName = 'Windows Default Input' #using the default input because we didn't find the one(s) requested
inputID = pyo.pa_get_default_input()
if inputID is not None:
logging.info('Using sound-input driver: %s (ID=%i)' %(audioInputName, inputID))
maxInputChnls = pyo.pa_get_input_max_channels(inputID)
duplex = bool(maxInputChnls > 0)
else:
maxInputChnls = 0
duplex=False
else:#for other platforms set duplex to True (if microphone is available)
audioDriver = prefs.general['audioDriver'][0]
maxInputChnls = pyo.pa_get_input_max_channels(pyo.pa_get_default_input())
maxOutputChnls = pyo.pa_get_output_max_channels(pyo.pa_get_default_output())
duplex = bool(maxInputChnls > 0)
maxChnls = min(maxInputChnls, maxOutputChnls)
if maxInputChnls < 1: # pragma: no cover
logging.warning('%s.initPyo could not find microphone hardware; recording not available' % __name__)
maxChnls = maxOutputChnls
if maxOutputChnls < 1: # pragma: no cover
logging.error('%s.initPyo could not find speaker hardware; sound not available' % __name__)
return -1
# create the instance of the server:
if platform in ['darwin', 'linux2']:
#for mac/linux we set the backend using the server audio param
pyoSndServer = Server(sr=rate, nchnls=maxChnls, buffersize=buffer, audio=audioDriver)
else:
#with others we just use portaudio and then set the OutputDevice below
pyoSndServer = Server(sr=rate, nchnls=maxChnls, buffersize=buffer)
pyoSndServer.setVerbosity(1)
if platform=='win32':
pyoSndServer.setOutputDevice(outputID)
if inputID is not None:
pyoSndServer.setInputDevice(inputID)
#do other config here as needed (setDuplex? setOutputDevice?)
pyoSndServer.setDuplex(duplex)
pyoSndServer.boot()
core.wait(0.5)#wait for server to boot before starting te sound stream
pyoSndServer.start()
try:
Sound() # test creation, no play
except pyo.PyoServerStateException:
msg = "Failed to start pyo sound Server"
if platform == 'darwin' and audioDriver != 'portaudio':
msg += "; maybe try prefs.general.audioDriver 'portaudio'?"
logging.error(msg)
#.........这里部分代码省略.........
开发者ID:9173860,项目名称:psychopy,代码行数:101,代码来源:sound.py
示例6: print
print("\nPython info")
print(sys.executable)
print(sys.version)
import numpy
print("numpy", numpy.__version__)
import scipy
print("scipy", scipy.__version__)
import matplotlib
print("matplotlib", matplotlib.__version__)
import pyglet
print("pyglet", pyglet.version)
# pyo is a new dependency, for sound:
try:
import pyo
print("pyo", '%i.%i.%i' % pyo.getVersion())
except Exception:
print('pyo [not installed]')
from psychopy import __version__
print("\nPsychoPy", __version__)
win = visual.Window([100, 100]) # some drivers want a window open first
print("have shaders:", win._haveShaders)
print("\nOpenGL info:")
# get info about the graphics card and drivers
print("vendor:", gl_info.get_vendor())
print("rendering engine:", gl_info.get_renderer())
print("OpenGL version:", gl_info.get_version())
print("(Selected) Extensions:")
extensionsOfInterest = ['GL_ARB_multitexture',
开发者ID:DennisEckmeier,项目名称:psychopy,代码行数:30,代码来源:sysInfo.py
示例7:
print sys.version
import numpy
print "numpy", numpy.__version__
import scipy
print "scipy", scipy.__version__
import matplotlib
print "matplotlib", matplotlib.__version__
import pyglet
print "pyglet", pyglet.version
import pyo
print "pyo", ".".join(map(str, pyo.getVersion()))
from psychopy import __version__
print "PsychoPy", __version__
win = visual.Window([100, 100]) # some drivers want a window open first
print "\nOpenGL info:"
# get info about the graphics card and drivers
print "vendor:", gl_info.get_vendor()
print "rendering engine:", gl_info.get_renderer()
print "OpenGL version:", gl_info.get_version()
print "(Selected) Extensions:"
extensionsOfInterest = [
"GL_ARB_multitexture",
"GL_EXT_framebuffer_object",
"GL_ARB_fragment_program",
开发者ID:MattIBall,项目名称:psychopy,代码行数:31,代码来源:sysInfo.py
示例8: _setSystemInfo
def _setSystemInfo(self):
# machine name
self['systemHostName'] = platform.node()
# platform name, etc
if sys.platform in ['darwin']:
OSXver, junk, architecture = platform.mac_ver()
platInfo = 'darwin '+OSXver+' '+architecture
# powerSource = ...
elif sys.platform in ['linux2']:
platInfo = 'linux2 '+platform.release()
# powerSource = ...
elif sys.platform in ['win32']:
platInfo = 'windowsversion='+repr(sys.getwindowsversion())
# powerSource = ...
else:
platInfo = ' [?]'
# powerSource = ...
self['systemPlatform'] = platInfo
#self['systemPowerSource'] = powerSource
# count all unique people (user IDs logged in), and find current user name & UID
self['systemUser'],self['systemUserID'] = _getUserNameUID()
try:
users = shellCall("who -q").splitlines()[0].split()
self['systemUsersCount'] = len(set(users))
except:
self['systemUsersCount'] = False
# when last rebooted?
try:
lastboot = shellCall("who -b").split()
self['systemRebooted'] = ' '.join(lastboot[2:])
except: # windows
sysInfo = shellCall('systeminfo').splitlines()
lastboot = [line for line in sysInfo if line.find("System Up Time") == 0 or line.find("System Boot Time") == 0]
lastboot += ['[?]'] # put something in the list just in case
self['systemRebooted'] = lastboot[0].strip()
# R (and r2py) for stats:
try:
Rver,err = shellCall("R --version",stderr=True)
Rversion = Rver.splitlines()[0]
if Rversion.startswith('R version'):
self['systemRavailable'] = Rversion.strip()
try:
import rpy2
self['systemRpy2'] = rpy2.__version__
except:
pass
except:
pass
# encryption / security tools:
try:
vers, se = shellCall('openssl version', stderr=True)
if se:
vers = str(vers) + se.replace('\n',' ')[:80]
if vers.strip():
self['systemSec.OpenSSLVersion'] = vers
except:
pass
try:
so, se = shellCall('gpg --version', stderr=True)
if so.find('GnuPG') > -1:
self['systemSec.GPGVersion'] = so.splitlines()[0]
self['systemSec.GPGHome'] = ''.join([line.replace('Home:','').lstrip()
for line in so.splitlines()
if line.startswith('Home:')])
except:
pass
try:
import ssl
self['systemSec.pythonSSL'] = True
except ImportError:
self['systemSec.pythonSSL'] = False
# pyo for sound:
try:
import pyo
self['systemPyoVersion'] = '.'.join(map(str, pyo.getVersion()))
except:
pass
开发者ID:MattIBall,项目名称:psychopy,代码行数:83,代码来源:info.py
示例9: initPyo
def initPyo(rate=44100, stereo=True, buffer=128):
"""setup the pyo (sound) server
"""
global pyoSndServer, Sound, audioDriver, duplex, maxChnls
Sound = SoundPyo
if not "pyo" in locals():
import pyo # microphone.switchOn() calls initPyo even if audioLib is something else
# subclass the pyo.Server so that we can insert a __del__ function that shuts it down
class _Server(pyo.Server):
core = core # make libs class variables so they don't get deleted first
logging = logging
def __del__(self):
self.stop()
self.core.wait(0.5) # make sure enough time passes for the server to shutdown
self.shutdown()
self.core.wait(0.5) # make sure enough time passes for the server to shutdown
self.logging.debug("pyo sound server shutdown") # this may never get printed
if ".".join(map(str, pyo.getVersion())) < "0.6.4":
Server = _Server
else:
Server = pyo.Server
# if we already have a server, just re-initialize it
if globals().has_key("pyoSndServer") and hasattr(pyoSndServer, "shutdown"):
pyoSndServer.stop()
core.wait(0.5) # make sure enough time passes for the server to shutdown
pyoSndServer.shutdown()
core.wait(0.5)
pyoSndServer.reinit(sr=rate, nchnls=maxChnls, buffersize=buffer, audio=audioDriver)
pyoSndServer.boot()
else:
if platform == "win32":
# check for output device/driver
devNames, devIDs = pyo.pa_get_output_devices()
audioDriver, outputID = _bestDriver(devNames, devIDs)
if outputID:
logging.info("Using sound driver: %s (ID=%i)" % (audioDriver, outputID))
maxOutputChnls = pyo.pa_get_output_max_channels(outputID)
else:
logging.warning("No audio outputs found (no speakers connected?")
return -1
# check for valid input (mic)
devNames, devIDs = pyo.pa_get_input_devices()
audioInputName, inputID = _bestDriver(devNames, devIDs)
if inputID is not None:
logging.info("Using sound-input driver: %s (ID=%i)" % (audioInputName, inputID))
maxInputChnls = pyo.pa_get_input_max_channels(inputID)
duplex = bool(maxInputChnls > 0)
else:
duplex = False
else: # for other platforms set duplex to True (if microphone is available)
audioDriver = prefs.general["audioDriver"][0]
maxInputChnls = pyo.pa_get_input_max_channels(pyo.pa_get_default_input())
maxOutputChnls = pyo.pa_get_output_max_channels(pyo.pa_get_default_output())
duplex = bool(maxInputChnls > 0)
maxChnls = min(maxInputChnls, maxOutputChnls)
if maxInputChnls < 1:
logging.warning("%s.initPyo could not find microphone hardware; recording not available" % __name__)
maxChnls = maxOutputChnls
if maxOutputChnls < 1:
logging.error("%s.initPyo could not find speaker hardware; sound not available" % __name__)
return -1
# create the instance of the server:
if platform in ["darwin", "linux2"]:
# for mac/linux we set the backend using the server audio param
pyoSndServer = Server(sr=rate, nchnls=maxChnls, buffersize=buffer, audio=audioDriver)
else:
# with others we just use portaudio and then set the OutputDevice below
pyoSndServer = Server(sr=rate, nchnls=maxChnls, buffersize=buffer)
pyoSndServer.setVerbosity(1)
if platform == "win32":
pyoSndServer.setOutputDevice(outputID)
if inputID:
pyoSndServer.setInputDevice(inputID)
# do other config here as needed (setDuplex? setOutputDevice?)
pyoSndServer.setDuplex(duplex)
pyoSndServer.boot()
core.wait(0.5) # wait for server to boot before starting te sound stream
pyoSndServer.start()
try:
Sound() # test creation, no play
except pyo.PyoServerStateException:
msg = "Failed to start pyo sound Server"
if platform == "darwin" and audioDriver != "portaudio":
msg += "; maybe try prefs.general.audioDriver 'portaudio'?"
logging.error(msg)
core.quit()
logging.debug("pyo sound server started")
logging.flush()
开发者ID:smathot,项目名称:psychopy,代码行数:94,代码来源:sound.py
示例10:
print "\nSystem info:"
print platform.platform()
if sys.platform=='darwin':
OSXver, junk, architecture = platform.mac_ver()
print "OS X %s running on %s" %(OSXver, architecture)
print "\nPython info"
print sys.executable
print sys.version
import numpy; print "numpy", numpy.__version__
import scipy; print "scipy", scipy.__version__
import matplotlib; print "matplotlib", matplotlib.__version__
import pyglet; print "pyglet", pyglet.version
# pyo is a new dependency, for sound:
try: import pyo; print "pyo", '%i.%i.%i' % pyo.getVersion()
except: print 'pyo [not installed]'
from psychopy import __version__
print "\nPsychoPy", __version__
win = visual.Window([100,100])#some drivers want a window open first
print "have shaders:", win._haveShaders
print "\nOpenGL info:"
#get info about the graphics card and drivers
print "vendor:", gl_info.get_vendor()
print "rendering engine:", gl_info.get_renderer()
print "OpenGL version:", gl_info.get_version()
print "(Selected) Extensions:"
extensionsOfInterest=['GL_ARB_multitexture',
'GL_EXT_framebuffer_object','GL_ARB_fragment_program',
开发者ID:BrainTech,项目名称:psychopy,代码行数:30,代码来源:sysInfo.py
示例11: _setSystemInfo
def _setSystemInfo(self):
"""system info"""
# system encoding
osEncoding=sys.getfilesystemencoding()
# machine name
self['systemHostName'] = platform.node()
self['systemMemTotalRAM'], self['systemMemFreeRAM'] = getRAM()
# locale information:
loc = '.'.join([str(x) for x in locale.getlocale()]) # (None, None) -> str
if loc == 'None.None':
loc = locale.setlocale(locale.LC_ALL, '')
self['systemLocale'] = loc # == the locale in use, from OS or user-pref
# platform name, etc
if sys.platform in ['darwin']:
OSXver, _junk, architecture = platform.mac_ver()
platInfo = 'darwin ' + OSXver + ' ' + architecture
# powerSource = ...
elif sys.platform.startswith('linux'):
platInfo = 'linux ' + platform.release()
# powerSource = ...
elif sys.platform in ['win32']:
platInfo = 'windowsversion=' + repr(sys.getwindowsversion())
# powerSource = ...
else:
platInfo = ' [?]'
# powerSource = ...
self['systemPlatform'] = platInfo
#self['systemPowerSource'] = powerSource
# count all unique people (user IDs logged in), and find current user name & UID
self['systemUser'], self['systemUserID'] = _getUserNameUID()
try:
users = shellCall("who -q").splitlines()[0].split()
self['systemUsersCount'] = len(set(users))
except:
self['systemUsersCount'] = False
# when last rebooted?
try:
lastboot = shellCall("who -b").split()
self['systemRebooted'] = ' '.join(lastboot[2:])
except: # windows
sysInfo = shellCall('systeminfo').splitlines()
lastboot = [line for line in sysInfo if line.startswith("System Up Time") or line.startswith("System Boot Time")]
lastboot += ['[?]'] # put something in the list just in case
self['systemRebooted'] = lastboot[0].strip()
# R (and r2py) for stats:
try:
Rver = shellCall(["R", "--version"])
Rversion = Rver.splitlines()[0]
if Rversion.startswith('R version'):
self['systemRavailable'] = Rversion.strip()
try:
import rpy2
self['systemRpy2'] = rpy2.__version__
except ImportError:
pass
except:
pass
# encryption / security tools:
try:
vers, se = shellCall('openssl version', stderr=True)
if se:
vers = str(vers) + se.replace('\n', ' ')[:80]
if vers.strip():
self['systemSec.OpenSSLVersion'] = vers
except:
pass
try:
so = shellCall(['gpg', '--version'])
if so.find('GnuPG') > -1:
self['systemSec.GPGVersion'] = so.splitlines()[0]
self['systemSec.GPGHome'] = ''.join([line.replace('Home:', '').lstrip()
for line in so.splitlines()
if line.startswith('Home:')])
except:
pass
try:
import ssl
self['systemSec.pythonSSL'] = True
except ImportError:
self['systemSec.pythonSSL'] = False
# pyo for sound:
try:
travis = bool(str(os.environ.get('TRAVIS')).lower() == 'true')
assert not travis # skip sound-related stuff on travis-ci.org
import pyo
self['systemPyoVersion'] = '%i.%i.%i' % pyo.getVersion()
try:
# requires pyo svn r1024 or higher:
inp, out = pyo.pa_get_devices_infos()
for devList in [inp, out]:
#.........这里部分代码省略.........
开发者ID:NSalem,项目名称:psychopy,代码行数:101,代码来源:info.py
示例12: print
print("\nSystem info:")
print(platform.platform())
if sys.platform=='darwin':
OSXver, junk, architecture = platform.mac_ver()
print("OS X %s running on %s" %(OSXver, architecture))
print("\nPython info")
print(sys.executable)
print(sys.version)
import numpy; print("numpy", numpy.__version__)
import scipy; print("scipy", scipy.__version__)
import matplotlib; print("matplotlib", matplotlib.__version__)
import pyglet; print("pyglet", pyglet.version)
# pyo is a new dependency, for sound:
try:
import pyo; print("pyo", '%i.%i.%i' % pyo.getVersion())
except:
print('pyo [not installed]')
from psychopy import __version__
print("\nPsychoPy", __version__)
win = visual.Window([100,100])#some drivers want a window open first
print("have shaders:", win._haveShaders)
print("\nOpenGL info:")
#get info about the graphics card and drivers
print("vendor:", gl_info.get_vendor())
print("rendering engine:", gl_info.get_renderer())
print("OpenGL version:", gl_info.get_version())
print("(Selected) Extensions:")
extensionsOfInterest=['GL_ARB_multitexture',
开发者ID:natsn,项目名称:psychopy,代码行数:31,代码来源:sysInfo.py
注:本文中的pyo.getVersion函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论