本文整理汇总了Python中Interface.Interface类的典型用法代码示例。如果您正苦于以下问题:Python Interface类的具体用法?Python Interface怎么用?Python Interface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Interface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setPseudoCnt
def setPseudoCnt(self,arglist=("1.0")):
"Arguments: [pseudocount]\nSet the amount of pseudocounts on matricies. Default 1.0"
try:
Interface.setPseudoCount(self,float(arglist[0]))
except ValueError:
print "Invalid pseudocount. Pseudocount not set."
return
示例2: __init__
def __init__(self, width, height, blocksize, fullscreen=False):
Interface.__init__(self, width, height, blocksize)
self.flags = pygame.DOUBLEBUF | pygame.HWSURFACE
if fullscreen:
self.flags |= pygame.FULLSCREEN
self.window = pygame.display.set_mode((self.width, self.height),
self.flags)
示例3: main
def main():
msg = WhatIsMessage()
# The hidden prepend keyword of the text input also includes
# double-quotes so that left whitespace is not stripped by the
# server.
if msg and msg.startswith("\""):
msg = msg[1:]
Logger("CHAT", "Console: {}: {}".format(activator.name, msg))
console = console_find(activator)
if msg == "exit()":
if console:
console_remove(activator)
inf = Interface(activator, None)
inf.dialog_close()
return
if not console:
console = console_create(activator)
console.push(msg)
if not msg:
console.show()
示例4: align
def align(self, arglist):
"""Arguments: [filename[,num_of_align,[lambda[,xi[,mu[,nu,[,nuc_per_rotation, [Seq1, Seq2]]]]]]]]
aligns the computed BS or optional the BS from a gff file
filename specifies a file in gff format is you want to be aligned
num_of_align specifies how many alignments you want. (Default 3)
lambda Bonus factor for hit (Default 2)
xi Penalty factor for rotation (Default 1.0)
mu Penalty factor for average distance between sites (Default 0.5)
nu Penalty factor for distance difference between sites (Default 1.0)
nuc_per_rotation specifies how many nucletides there are per rotation. (Default 10.4)
Seq1,Seq2 Sequences to be aligned.
If you want to skip a argument just write '.' for it.
If you use '.' as filename the local data are aligned."""
try:
[filename, num_of_align, Lambda, xi,
mu, nu, nuc_per_rotation,Seq1,Seq2]=(arglist + ['.']*(9-len(arglist)))[:9]
if num_of_align=='.':
num_of_align=3
if Lambda=='.':
Lambda=2.0
if xi=='.':
xi=1.0
if mu=='.':
mu=0.5
if nu=='.':
nu=1.0
if nuc_per_rotation=='.':
nuc_per_rotation=10.4
if Seq1=='.':
Seq1=None
if Seq2=='.':
Seq2=None
try:
if not Interface.align(self, filename, int(num_of_align),
float(Lambda), float(xi),
float(mu), float(nu),
float(nuc_per_rotation),Seq1,Seq2):
print "No alignment for a reason or an other"
except AttributeError,val:
if len(val.args)==1 or (len(val.args)>1 and len(val.args[1])<2):
print val.args[0]
else:
msg,seqs=val
# This function is expected to be defined in subclass
firstSeq,secondSeq=self.selectTwoSequences(msg,seqs)
if not Interface.align(self, filename, int(num_of_align),
float(Lambda), float(xi),
float(mu), float(nu),
float(nuc_per_rotation),
firstSeq,secondSeq):
print "No alignment for a reson or an another"
except ValueError,e:
print "Error: unallowed arguments passed to 'align'",e
示例5: test_dicom_download_production
def test_dicom_download_production():
# Example of how to download a worklist of series.
#
# Format worklist like this:
#
# SeriesInstanceUIDs:
# - x.y.zzz.wwwwww.u.ttt.s.aaaaaaaaaaa....
# - x.y.zzz.wwwwww.u.ttt.s.aaaaaaaaaab....
#
# Can search for "Series/Study/PatientInstanceUID", "AccessionNumber", "PatientName" or "PatientID"
raise SkipTest
repos = read_yaml('repos.yaml')
source = Interface.factory('gepacs', repos)
target = Interface.factory('deathstar', repos)
# worklist_config = read_yaml('series_worklist.yaml')['SeriesInstanceUIDs']
#
# for entry in worklist_config:
# w = source.find('study', {'AccessionNumber': 'R13851441'})[0]
u = target.find('study', {'AccessionNumber': 'R13851441'})[0]
#u = target.retreive(w, source)[0]
target.copy(u, target, '/Users/derek/Desktop/%s_archive' % u.study_id.o)
示例6: dicom_tests
def dicom_tests():
logger = logging.getLogger(dicom_tests.__name__)
# Test DICOM Instantiate
from OrthancInterface import OrthancInterface
proxy = OrthancInterface(address='http://localhost:8043', name='3dlab-dev1')
source = DICOMInterface(proxy=proxy, name='3dlab-dev0+dcm')
# Test DICOM Subject Query
r = source.find('subject', {'PatientName': 'ZNE*'})[0]
assert r.subject_id == 'ZA4VSDAUSJQA6'
# Test DICOM Q/R/DL
from tithonus import read_yaml
repos = read_yaml('repos.yaml')
source = Interface.factory('3dlab-dev0+dcm', repos)
target = Interface.factory('3dlab-dev1', repos)
w = source.find('series', {'SeriesInstanceUID': '1.2.840.113654.2.55.4303894980888172655039251025765147023'})[0]
u = target.retrieve(w, source)[0]
target.copy(u, target, 'nlst_tmp_archive')
assert os.path.getsize('nlst_tmp_archive.zip') == 176070
os.remove('nlst_tmp_archive.zip')
示例7: YoutubeLinkDownload
def YoutubeLinkDownload(self):
txt, ok = QtGui.QInputDialog.getText(
self, "YouTube Link", "YTube Link:", QtGui.QLineEdit.Normal, "", QtCore.Qt.FramelessWindowHint
)
if ok == True:
if txt.startsWith("https://www.youtube.com"):
key = self.freeKey()
if key == -1:
obj = Interface(self.PARTS)
else:
obj = self.dLoads[key]
obj.PARTS = self.PARTS
obj.clear()
del self.dLoads[key]
thread.start_new_thread(obj.start_Download, (txt, self.wMutex))
self.dLoads[self.links] = obj
self.links = self.links + 1
else:
msg = QtGui.QMessageBox(
QtGui.QMessageBox.Warning,
"Oops.",
"Not a valid YTube Url ",
QtGui.QMessageBox.Ok,
self,
QtCore.Qt.FramelessWindowHint,
)
msg.show()
示例8: removeMatrix
def removeMatrix(self, arglist):
"Arguments: Matrixnumber\nremoves a matrix"
try:
index=string.atoi(arglist[0])
Interface.removeMatrix(self, index)
except ValueError:
print arglist[0],"is not a number"
示例9: fetchAndSaveUrl
def fetchAndSaveUrl(self, url="", bit=1):
ok = True
if len(url) == 0:
url, ok = QtGui.QInputDialog.getText(
self, "Link", "Download Link:", QtGui.QLineEdit.Normal, "", QtCore.Qt.FramelessWindowHint
)
if ok == True:
key = self.freeKey()
if key == -1:
obj = Interface(self.PARTS)
key = self.links
self.links = self.links + 1
else:
obj = self.dLoads[key]
obj.PARTS = self.PARTS
obj.clear()
del self.dLoads[key]
thread.start_new_thread(obj.start_Download, (url, self.wMutex, bit))
self.dLoads[key] = obj
else:
msg = QtGui.QMessageBox(
QtGui.QMessageBox.Warning,
"Oops.",
"Not a valid Url ",
QtGui.QMessageBox.Ok,
self,
QtCore.Qt.FramelessWindowHint,
)
msg.show()
示例10: __init__
class Program:
"""
General program template
- init function for program component initialization
- main loop
* check events -> handle (event)
* update
"""
def __init__(self):
"""
init function
"""
self.interface = Interface()
self.engine = Engine()
self.run()
def run(self):
"""
main loop
"""
while True:
self.check_events()
self.update()
def check_events(self):
"""
pygame event handling (edit this for more events)
"""
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
if event.type == pygame.MOUSEBUTTONDOWN:
mousex, mousey = event.pos
response = self.interface.click(mousex,mousey)
self.handle(response)
def handle(self,response):
"""
handle responses to events
"""
self.engine.send(response)
def update(self):
"""
update state of program components
"""
self.engine.update()
self.interface.update(self.engine.get_updates())
示例11: addSequence
def addSequence(self, arglist):
"Arguments: filelist\nreads sequences from files"
for filestring in arglist:
filenames=glob(filestring)
if filenames:
Interface.addSequence(self, filenames)
else:
raise CommandError("file not found:"+filestring)
示例12: getTFBSpvalue
def getTFBSpvalue(self, arglist):
"""Arguments: [pvalue]
computes the scores of all matrices and all sequences. Report scores
better than given p-value.
The default value for pvalue is 1e-6"""
cutoff=1e-6
try:
if(len(arglist)>0):
cutoff= string.atof(arglist[0])
Interface.getTFBSpvalue(self, cutoff)
except ValueError:
print "getTFBSpvalue requires an numeric argument!"
示例13: getTFBSabsolute
def getTFBSabsolute(self, arglist):
"""Arguments: [cutoff]
computes the scores of all matrices and all sequences which are
better than cutoff.
The default value for cutoff is 9.0"""
cutoff=9.0
try:
if(len(arglist)>0):
cutoff= string.atof(arglist[0])
Interface.getTFBSAbsolute(self, cutoff)
except ValueError:
print "getTFBSabsolute requires an numeric argument!"
示例14: getTFBS
def getTFBS(self, arglist):
"""Arguments: [bound]
computes the scores of all matrices and all sequences which are
better than log2(bound) + maxscore. maxscore is the highest reachable
score of the actual matrix with respect to the background
The default value for bound is 0.1 i.e. ~3.3 below the maximum score."""
bound=0.1
try:
if(len(arglist)>0):
bound= string.atof(arglist[0])
Interface.getTFBS(self, bound)
except ValueError:
print "getTFBS requires an numeric argument!"
示例15: test_dicom_download_dev
def test_dicom_download_dev():
# Test DICOM Download (also in DICOMInterface)
repos = read_yaml('repos.yaml')
source = Interface.factory('3dlab-dev0+dcm', repos)
target = Interface.factory('3dlab-dev1', repos)
w = source.find('series', {'SeriesInstanceUID': '1.2.840.113654.2.55.4303894980888172655039251025765147023'})
u = target.retrieve(w[0], source)
target.copy(u[0], target, 'nlst_tmp_archive')
assert os.path.getsize('nlst_tmp_archive.zip') == 176070
os.remove('nlst_tmp_archive.zip')