rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
script_server()
SCRIPT = script_server() SCRIPT.Start()
def execute_cb(self, server_goal): server_result = MoveActionResult().result server_result.return_value = self.sss.move(server_goal.component_name.data,server_goal.parameter_name.data) if server_result.return_value == 0: print "success" self.move_action_server.set_succeeded(server_result) else: print "error" self.move...
self.sss.move("sdh","cup")
self.sss.move("sdh","cylclosed")
def Run(self): listener = tf.TransformListener(True, rospy.Duration(10.0)) # prepare for grasping self.sss.move("base","kitchen") handle01 = self.sss.move("arm","pregrasp",False) self.sss.move("sdh","cylopen") handle01.wait()
n = pynotify.Notification("Emergency Stop issued!", "", "dialog-warning") icon=gtk.status_icon_new_from_icon_name("important") n.attach_to_status_icon(icon) n.set_timeout(1000) n.show()
if(self.em_stop == False): self.em_stop = True n = pynotify.Notification("Emergency Stop issued!", "", "dialog-warning") n.set_timeout(1) n.show()
def setEMStop(self, em): if(em): #print "Emergency Stop Active" self.status_image.set_from_file(roslib.packages.get_pkg_dir("cob_dashboard") + "/share/icons/weather-storm.png") self.status_label.set_text("EM Stop !") n = pynotify.Notification("Emergency Stop issued!", "", "dialog-warning") icon=gtk.status_icon_new_from...
n = pynotify.Notification("Emergency Stop released!", "", "dialog-ok") n.set_timeout(1000) n.show()
if(self.em_stop == True): self.em_stop = False n = pynotify.Notification("Emergency Stop released!", "", "dialog-ok") n.set_timeout(1) n.show()
def setEMStop(self, em): if(em): #print "Emergency Stop Active" self.status_image.set_from_file(roslib.packages.get_pkg_dir("cob_dashboard") + "/share/icons/weather-storm.png") self.status_label.set_text("EM Stop !") n = pynotify.Notification("Emergency Stop issued!", "", "dialog-warning") icon=gtk.status_icon_new_from...
def SetOperationMode(self,component_name,mode):
def SetOperationMode(self,component_name,mode,blocking=False):
def SetOperationMode(self,component_name,mode): rospy.loginfo("setting <<%s>> to operation mode <<%s>>",component_name, mode) rospy.set_param(component_name + "_controller/OperationMode",mode)
rospy.set_param(component_name + "_controller/OperationMode",mode)
rospy.set_param("/" + component_name + "_controller/OperationMode",mode)
def SetOperationMode(self,component_name,mode): rospy.loginfo("setting <<%s>> to operation mode <<%s>>",component_name, mode) rospy.set_param(component_name + "_controller/OperationMode",mode)
print "Width: ", self.allocation.width print "Height: ", self.allocation.height
def do_expose_event(self, event): # Create the cairo context cr = self.window.cairo_create() print "Width: ", self.allocation.width print "Height: ", self.allocation.height # Restrict Cairo to the exposed area; avoid extra work cr.rectangle(event.area.x, event.area.y, event.area.width, event.area.height) cr.clip() self...
xw = height/(self.sizex+1) print height, ", ", self.sizex yw = width/(self.sizey+1) print "Divider: ", xw, ", ", yw for i in range(0,self.sizey): for j in range(0,self.sizex):
xw = width/(self.sizex) yw = height/(self.sizey) for i in range(0,self.sizex): for j in range(0,self.sizey):
def draw(self, cr, width, height): # Fill the background with gray color = 0.5 xw = height/(self.sizex+1) print height, ", ", self.sizex yw = width/(self.sizey+1) print "Divider: ", xw, ", ", yw for i in range(0,self.sizey): for j in range(0,self.sizex): if(color==0.0): color=1.0 else: color=0.0 cr.set_source_rgb(color...
print (j)*yw,":", (i)*xw,":", (j+1)*yw,":", (i+1) * xw cr.rectangle((j)*xw, (i)*yw, xw, yw)
cr.rectangle((i)*xw, (j)*yw, xw, yw)
def draw(self, cr, width, height): # Fill the background with gray color = 0.5 xw = height/(self.sizex+1) print height, ", ", self.sizex yw = width/(self.sizey+1) print "Divider: ", xw, ", ", yw for i in range(0,self.sizey): for j in range(0,self.sizex): if(color==0.0): color=1.0 else: color=0.0 cr.set_source_rgb(color...
button4 = gtk.Button("box.pack4") button5 = gtk.Button("box.pack5") button6 = gtk.Button("box.pack6")
sc4 = Screen() sc4.set_size_request((winwidth/3)-10, (winheight/2)-5) sc5 = Screen() sc5.set_size_request((winwidth/3)-10, (winheight/2)-5) sc6 = Screen() sc6.set_size_request((winwidth/3)-10, (winheight/2)-5)
def main_quit(obh, obb): global dget #Stopping the thread and the gtk's main loop dget.stop() gtk.main_quit()
hbox2=gtk.HBox(True,0) hbox2.pack_start(button4,False, False, 0) hbox2.pack_start(button5,False, False, 0) hbox2.pack_start(button6,False, False, 0)
hbox2=gtk.HBox(False,10) hbox2.pack_start(sc4,False, True, 0) hbox2.pack_start(sc5,False, True, 0) hbox2.pack_start(sc6,False, True, 0)
def main_quit(obh, obb): global dget #Stopping the thread and the gtk's main loop dget.stop() gtk.main_quit()
graph.add_edge(self.last_node, str(self.function_counter)+"_"+function_name+"_"+component_name+"_"+parameter_name)
if type(parameter_name) is types.StringType: graphstring = str(self.function_counter)+"_"+function_name+"_"+component_name+"_"+parameter_name else: graphstring = str(self.function_counter)+"_"+function_name+"_"+component_name graph.add_edge(self.last_node, graphstring)
def AppendGraph(self, function_name, component_name, parameter_name, blocking=True): global graph global graph_wait_list graph.add_edge(self.last_node, str(self.function_counter)+"_"+function_name+"_"+component_name+"_"+parameter_name) for waiter in graph_wait_list: graph.add_edge(waiter, str(self.function_counter)+"...
graph.add_edge(waiter, str(self.function_counter)+"_"+function_name+"_"+component_name+"_"+parameter_name)
graph.add_edge(waiter, graphstring)
def AppendGraph(self, function_name, component_name, parameter_name, blocking=True): global graph global graph_wait_list graph.add_edge(self.last_node, str(self.function_counter)+"_"+function_name+"_"+component_name+"_"+parameter_name) for waiter in graph_wait_list: graph.add_edge(waiter, str(self.function_counter)+"...
self.last_node = str(self.function_counter)+"_"+function_name+"_"+component_name+"_"+parameter_name else: ah.parent_node = str(self.function_counter)+"_"+function_name+"_"+component_name+"_"+parameter_name
self.last_node = graphstring else: ah.parent_node = graphstring
def AppendGraph(self, function_name, component_name, parameter_name, blocking=True): global graph global graph_wait_list graph.add_edge(self.last_node, str(self.function_counter)+"_"+function_name+"_"+component_name+"_"+parameter_name) for waiter in graph_wait_list: graph.add_edge(waiter, str(self.function_counter)+"...
def wait(self, duration=None): global ah_counter ah_counter += 1 self.blocking = True self.wait_for_finished(duration,True) def wait_inside(self, duration=None): if self.blocking: self.wait_for_finished(duration,True) else: thread.start_new_thread(self.wait_for_finished,(duration,False,)) return self.error_code ...
def set_client(self,client): self.client = client
rospy.set_param(operation_mode_name, "position")
def move_traj(self,component_name,parameter_name,blocking): ah = action_handle("move", component_name, parameter_name, blocking, self.parse) if(self.parse): return ah else: ah.set_active() rospy.loginfo("Move <<%s>> to <<%s>>",component_name,parameter_name) # selecting component if component_name == "tray": joint_nam...
self.set_operation_mode(component_name,"position")
def move_traj(self,component_name,parameter_name,blocking): ah = action_handle("move", component_name, parameter_name, blocking, self.parse) if(self.parse): return ah else: ah.set_active() rospy.loginfo("Move <<%s>> to <<%s>>",component_name,parameter_name) # selecting component if component_name == "tray": joint_nam...
pub = rospy.Publisher('light_controller/command', Light) rospy.sleep(0.5)
def set_light(self,parameter_name): ah = action_handle() ah.component_name = "light" ah.parameter_name = parameter_name rospy.loginfo("Set light to %s",parameter_name) pub = rospy.Publisher('light_controller/command', Light) rospy.sleep(0.5) # we have to wait here until publisher is ready, don't ask why # get joint v...
pub.publish(color)
self.pub_light.publish(color) ah.set_succeeded()
def set_light(self,parameter_name): ah = action_handle() ah.component_name = "light" ah.parameter_name = parameter_name rospy.loginfo("Set light to %s",parameter_name) pub = rospy.Publisher('light_controller/command', Light) rospy.sleep(0.5) # we have to wait here until publisher is ready, don't ask why # get joint v...
rospy.loginfo("setting <<%s>> to operation mode <<%s>>",component_name, mode)
def set_operation_mode(self,component_name,mode,blocking=False): rospy.loginfo("setting <<%s>> to operation mode <<%s>>",component_name, mode) rospy.set_param("/" + component_name + "_controller/OperationMode",mode) # \todo remove and only use service call #rospy.wait_for_service("/" + component_name + "_controller/set...
req.operationMode.data = mode
req.operation_mode.data = mode
def set_operation_mode(self,component_name,mode,blocking=False): rospy.loginfo("setting <<%s>> to operation mode <<%s>>",component_name, mode) rospy.set_param("/" + component_name + "_controller/OperationMode",mode) # \todo remove and only use service call #rospy.wait_for_service("/" + component_name + "_controller/set...
def Speak(self,parameter_name,mode="DEFAULT")
def Speak(self,parameter_name,mode="DEFAULT"):
def Speak(self,parameter_name,mode="DEFAULT") """ Speak sound specified by 'parameter_name' either via TTS or by playing a WAV-File Possible modes are: DEFAULT - use mode set by a global parameter (default) WAV_DE - play wav-Files with German Text WAV_EN - play wav-FIles with English Text FEST_EN - use Text-to-speech w...
elif mode == "WAV_DE":
if mode == "WAV_DE":
def Speak(self,parameter_name,mode="DEFAULT") """ Speak sound specified by 'parameter_name' either via TTS or by playing a WAV-File Possible modes are: DEFAULT - use mode set by a global parameter (default) WAV_DE - play wav-Files with German Text WAV_EN - play wav-FIles with English Text FEST_EN - use Text-to-speech w...
if not rospy.has_param(self.ns_global_prefex + "/sound/speech_en/"+parameter_name)
if not rospy.has_param(self.ns_global_prefex + "/sound/speech_en/"+parameter_name):
def Speak(self,parameter_name,mode="DEFAULT") """ Speak sound specified by 'parameter_name' either via TTS or by playing a WAV-File Possible modes are: DEFAULT - use mode set by a global parameter (default) WAV_DE - play wav-Files with German Text WAV_EN - play wav-FIles with English Text FEST_EN - use Text-to-speech w...
if not type(text_string) == str:
return Speak_Str(text_string,mode) elif mode == "CEPS_EN": if not rospy.has_param(self.ns_global_prefex + "/sound/speech_en/"+parameter_name): rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/speech_en/"+parameter_name) ah.error_code = 2 return ah text_st...
def Speak(self,parameter_name,mode="DEFAULT") """ Speak sound specified by 'parameter_name' either via TTS or by playing a WAV-File Possible modes are: DEFAULT - use mode set by a global parameter (default) WAV_DE - play wav-Files with German Text WAV_EN - play wav-FIles with English Text FEST_EN - use Text-to-speech w...
rospy.loginfo("Using English Festival Voice for speaking '%s'",text_string) soundhandle.say(text_string) return 0 elif mode == "CEPS_EN"): if not rospy.has_param(self.ns_global_prefex + "/sound/speech_en/"+parameter_name) rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global...
rospy.loginfo("Using English Festival Voice for speaking '%s'",text) soundhandle.say(text) return 0 elif mode == "CEPS_EN": if not type(text) == str:
def Speak(self,parameter_name,mode="DEFAULT") """ Speak sound specified by 'parameter_name' either via TTS or by playing a WAV-File Possible modes are: DEFAULT - use mode set by a global parameter (default) WAV_DE - play wav-Files with German Text WAV_EN - play wav-FIles with English Text FEST_EN - use Text-to-speech w...
rospy.loginfo("Using English Cepstral Voice David for speaking '%s'",text_string) returnVal = os.system("swift -n \"Matthias\" -e \"utf-8\" \"" + str + "\"") return 0 elif mode == "CEPS_DE"): if not rospy.has_param(self.ns_global_prefex + "/sound/speech_de/"+parameter_name) rospy.logerr("parameter %s does not exist...
rospy.loginfo("Using English Cepstral Voice David for speaking '%s'",text) returnVal = os.system("swift -n \"David\" -e \"utf-8\" \"" + str + "\"") if returnVal != 0: rospy.logerror("Calling Cepstral TTS system returned failure. Check if Cepstral voice \"David\" is set up properly!") ah.error_code = 4 return ah retur...
def Speak(self,parameter_name,mode="DEFAULT") """ Speak sound specified by 'parameter_name' either via TTS or by playing a WAV-File Possible modes are: DEFAULT - use mode set by a global parameter (default) WAV_DE - play wav-Files with German Text WAV_EN - play wav-FIles with English Text FEST_EN - use Text-to-speech w...
rospy.loginfo("Using German Cepstral Voice Matthias for speaking '%s'",text_string) returnVal = os.system("swift -n \"Matthias\"-e \"utf-8\" \"" + str + "\"") return 0 elif mode == "MUTE": rospy.loginfo("Playing sound %s",param_name) else: rospy.lorerr("ROS has no sound mode %s!",mode)
rospy.loginfo("Using German Cepstral Voice Matthias for speaking '%s'",text) returnVal = os.system("swift -n \"Matthias\" -e \"utf-8\" \"" + str + "\"") if returnVal != 0: rospy.logerror("Calling Cepstral TTS system returned failure. Check if Cepstral voice \"Matthias\" is set up properly!") ah.error_code = 4 return ...
def Speak(self,parameter_name,mode="DEFAULT") """ Speak sound specified by 'parameter_name' either via TTS or by playing a WAV-File Possible modes are: DEFAULT - use mode set by a global parameter (default) WAV_DE - play wav-Files with German Text WAV_EN - play wav-FIles with English Text FEST_EN - use Text-to-speech w...
def Trigger(self,component_name,service_name):
def Trigger(self,component_name,service_name,blocking=True):
def Trigger(self,component_name,service_name): rospy.loginfo("<<%s>> <<%s>>", service_name, component_name) rospy.loginfo("Waiting for <<%s>> to <<%s>>...", component_name, service_name) service_full_name = "/" + component_name + "_controller/" + service_name try: rospy.wait_for_service(service_full_name,rospy.get_para...
try: if sock.family != socket.AF_UNIX: raise ValueError("Only AF_UNIX sockets are allowed")
if hasattr(sock, 'family') and sock.family != socket.AF_UNIX: raise ValueError("Only AF_UNIX sockets are allowed") if hasattr(sock, 'fileno'):
def __check_socket(sock): try: if sock.family != socket.AF_UNIX: raise ValueError("Only AF_UNIX sockets are allowed") sock = sock.fileno() except AttributeError: pass if not isinstance(sock, int): raise TypeError("An socket object or file descriptor was expected") return sock
except AttributeError: pass
def __check_socket(sock): try: if sock.family != socket.AF_UNIX: raise ValueError("Only AF_UNIX sockets are allowed") sock = sock.fileno() except AttributeError: pass if not isinstance(sock, int): raise TypeError("An socket object or file descriptor was expected") return sock
s.send("a")
def parent_tests(self, s): # First message is not even sent s.send("a") self.vrfy_recv(recvfd(s), "a") s.send("a") self.vrfy_recv(recvfd(s), "\0") s.send("a") self.vrfy_recv(recvfd(s), "foobar") s.send("a") self.vrfy_recv(recvfd(s, msg_buf = 11), "long string") # is long s.send("a") self.assertEquals(s.recv(8), " is lo...
s.send("a") (f, msg) = recvfd(s, open_args = [ "w" ]) self.assertEquals(msg, "writing") f.write("foo")
def parent_tests(self, s): # First message is not even sent s.send("a") self.vrfy_recv(recvfd(s), "a") s.send("a") self.vrfy_recv(recvfd(s), "\0") s.send("a") self.vrfy_recv(recvfd(s), "foobar") s.send("a") self.vrfy_recv(recvfd(s, msg_buf = 11), "long string") # is long s.send("a") self.assertEquals(s.recv(8), " is lo...
w.acom1.chs=options.serial_handshake.get() + \ ' '[:40]
w.acom1.chs=(options.serial_handshake.get() + \ ' ')[:40]
def put_params(param3=NONE): global param20
root.title(' WSPR 2.20 by K1JT')
root.title(' WSPR 2.21 by K1JT')
def readinit(): global nparam,mrudir try: for i in range(len(params)): if badlist.count(i)>0: print 'Skipping bad entry in WSPR.INI:\a',params[i] continue key,value=params[i].split() if key == 'WSPRGeometry': root.geometry(value) elif key == 'MyCall': options.MyCall.set(value) elif key == 'MyGrid': options.MyGrid.set...
if not no_beep: t=t + "\a"
if not no_beep.get(): t=t + "\a"
def autolog(decodes): # Random delay of up to 20 seconds to spread load out on server --W1BW time.sleep(random.random() * 20.0) try: # This code originally by W6CQZ ... modified by W1BW # TODO: Cache entries for later uploading if net is down. # TODO: (Maybe??) Allow for stations wishing to collect spot data but # ...
bandmap,bm,t0,nreject,gain,phdeg,ierr
bandmap,bm,t0,nreject,gain,phdeg,ierr,itx0,timer1
def update(): global root_geom,isec0,im,pim,ndbm0,nsec0,a,ftx0,nin0,nout0, \ receiving,transmitting,newdat,nscroll,newspec,scale0,offset0, \ modpixmap0,tw,s0,c0,fmid,fmid0,loopall,ntr0,txmsg,iband0, \ bandmap,bm,t0,nreject,gain,phdeg,ierr tsec=time.time() utc=time.gmtime(tsec) nsec=int(tsec) nsec0=nsec ns120=nsec % 12...
if ntr!=ntr0:
itx=w.acom1.transmitting if ntr!=ntr0 or itx!=itx0:
def update(): global root_geom,isec0,im,pim,ndbm0,nsec0,a,ftx0,nin0,nout0, \ receiving,transmitting,newdat,nscroll,newspec,scale0,offset0, \ modpixmap0,tw,s0,c0,fmid,fmid0,loopall,ntr0,txmsg,iband0, \ bandmap,bm,t0,nreject,gain,phdeg,ierr tsec=time.time() utc=time.gmtime(tsec) nsec=int(tsec) nsec0=nsec ns120=nsec % 12...
if ntr==-1:
itx0=int(itx) if ntr==-1 or itx==1:
def update(): global root_geom,isec0,im,pim,ndbm0,nsec0,a,ftx0,nin0,nout0, \ receiving,transmitting,newdat,nscroll,newspec,scale0,offset0, \ modpixmap0,tw,s0,c0,fmid,fmid0,loopall,ntr0,txmsg,iband0, \ bandmap,bm,t0,nreject,gain,phdeg,ierr tsec=time.time() utc=time.gmtime(tsec) nsec=int(tsec) nsec0=nsec ns120=nsec % 12...
ldate.after(200,update)
timer1=ldate.after(200,update)
def update(): global root_geom,isec0,im,pim,ndbm0,nsec0,a,ftx0,nin0,nout0, \ receiving,transmitting,newdat,nscroll,newspec,scale0,offset0, \ modpixmap0,tw,s0,c0,fmid,fmid0,loopall,ntr0,txmsg,iband0, \ bandmap,bm,t0,nreject,gain,phdeg,ierr tsec=time.time() utc=time.gmtime(tsec) nsec=int(tsec) nsec0=nsec ns120=nsec % 12...
print 'hopping'
def update(): global root_geom,isec0,im,pim,ndbm0,nsec0,a,ftx0,nin0,nout0, \ receiving,transmitting,newdat,nscroll,newspec,scale0,offset0, \ modpixmap0,tw,s0,c0,fmid,fmid0,loopall,ntr0,txmsg,iband0, \ bandmap,bm,t0,nreject,gain,phdeg if hopping_feature==1: if hopping.hoppingconfigured.get()==1: bhopping.configure(stat...
global isync
global isync,isync_iscat
def ModeISCAT(event=NONE): global isync if g.mode != "ISCAT": if lauto: toggleauto() ModeJT6M() mode.set("ISCAT") lab2.configure(text='FileID Avg dB DF') isync=-18 report.configure(state=NORMAL) report.delete(0,END) report.insert(0,'-15')
isync=-18
isync=isync_iscat lsync.configure(text=slabel+str(isync)) shmsg.configure(state=NORMAL) nfreeze.set(0)
def ModeISCAT(event=NONE): global isync if g.mode != "ISCAT": if lauto: toggleauto() ModeJT6M() mode.set("ISCAT") lab2.configure(text='FileID Avg dB DF') isync=-18 report.configure(state=NORMAL) report.delete(0,END) report.insert(0,'-15')
im,pim,cmap0,isync,isync441,isync6m,isync65,isync_save,idsec, \ first,itol,txsnrdb,tx6alt
im,pim,cmap0,isync,isync441,isync6m,isync_iscat,isync65, \ isync_save,idsec,first,itol,txsnrdb,tx6alt
def update(): global root_geom,isec0,naz,nel,ndmiles,ndkm,nhotaz,nhotabetter,nopen, \ im,pim,cmap0,isync,isync441,isync6m,isync65,isync_save,idsec, \ first,itol,txsnrdb,tx6alt utc=time.gmtime(time.time()+0.1*idsec) isec=utc[5] if isec != isec0: #Do once per second isec0=isec t=time.strftime(...
elif mode.get()=='JT6M' or mode.get()=="ISCAT": isync6m=isync
elif mode.get()=='JT6M': isync6m=isync elif mode.get()=="ISCAT": isync_iscat=isync
def update(): global root_geom,isec0,naz,nel,ndmiles,ndkm,nhotaz,nhotabetter,nopen, \ im,pim,cmap0,isync,isync441,isync6m,isync65,isync_save,idsec, \ first,itol,txsnrdb,tx6alt utc=time.gmtime(time.time()+0.1*idsec) isec=utc[5] if isec != isec0: #Do once per second isec0=isec t=time.strftime(...
elif mode.get()=='JT6M' or mode.get()=="JT6M": isync=isync6m
elif mode.get()=='JT6M': isync=isync6m elif mode.get()=="ISCAT": isync=isync_iscat
def update(): global root_geom,isec0,naz,nel,ndmiles,ndkm,nhotaz,nhotabetter,nopen, \ im,pim,cmap0,isync,isync441,isync6m,isync65,isync_save,idsec, \ first,itol,txsnrdb,tx6alt utc=time.gmtime(time.time()+0.1*idsec) isec=utc[5] if isec != isec0: #Do once per second isec0=isec t=time.strftime(...
if options.rignum.get()==901: nHzLO=4*(nHz - iq.fiq.get()) cmd="CMDSR -f %d" % (nHzLO,) elif options.rignum.get()==2509:
if options.rignum.get()==2509: nHzLO=nHz - iq.fiq.get()
def update(): global root_geom,isec0,im,pim,ndbm0,nsec0,a,ftx0,nin0,nout0, \ receiving,transmitting,newdat,nscroll,newspec,scale0,offset0, \ modpixmap0,tw,s0,c0,fmid,fmid0,loopall,ntr0,txmsg,iband0, \ bandmap,bm,t0,nreject,gain,phdeg tsec=time.time() utc=time.gmtime(tsec) nsec=int(tsec) nsec0=nsec ns120=nsec % 120 try...
(options.rignum.get(),options.CatPort.get(),nHz)
(options.rignum.get(),options.CatPort.get(),nHzLO)
def update(): global root_geom,isec0,im,pim,ndbm0,nsec0,a,ftx0,nin0,nout0, \ receiving,transmitting,newdat,nscroll,newspec,scale0,offset0, \ modpixmap0,tw,s0,c0,fmid,fmid0,loopall,ntr0,txmsg,iband0, \ bandmap,bm,t0,nreject,gain,phdeg tsec=time.time() utc=time.gmtime(tsec) nsec=int(tsec) nsec0=nsec ns120=nsec % 120 try...
if options.rignum.get() == 901: cmd="CMDSR -T 0" elif options.rignum.get() == 2509:
if options.rignum.get() == 2509:
def readinit(): global nparam,mrudir try: for i in range(len(params)): if badlist.count(i)>0: print 'Skipping bad entry in WSPR.INI:\a',params[i] continue key,value=params[i].split() if key == 'WSPRGeometry': root.geometry(value) elif key == 'MyCall': options.MyCall.set(value) elif key == 'MyGrid': options.MyGrid.set...
if event.y<40 and Audio.gcom2.nspecial==0:
if event.y<40 and Audio.gcom2.nspecial==0 and mode.get()<>'ISCAT':
def dtdf_change(event): if mode.get()[:4]=='JTMS': t="%.1f" % (event.x*30.0/500.0,) lab6.configure(text=t,bg='green') else: if event.y<40 and Audio.gcom2.nspecial==0: lab1.configure(text='Time (s)',bg="#33FFFF") #light blue
(event.y<95 and Audio.gcom2.nspecial>0):
(event.y<95 and (Audio.gcom2.nspecial>0 or mode.get()=='ISCAT')):
def dtdf_change(event): if mode.get()[:4]=='JTMS': t="%.1f" % (event.x*30.0/500.0,) lab6.configure(text=t,bg='green') else: if event.y<40 and Audio.gcom2.nspecial==0: lab1.configure(text='Time (s)',bg="#33FFFF") #light blue
t="%d" % int(0.25*(12000.0/1024.0)*(event.x-250.0)+3)
t="%d" % int(0.25*(12000.0/1024.0)*(event.x-250.0))
def dtdf_change(event): if mode.get()[:4]=='JTMS': t="%.1f" % (event.x*30.0/500.0,) lab6.configure(text=t,bg='green') else: if event.y<40 and Audio.gcom2.nspecial==0: lab1.configure(text='Time (s)',bg="#33FFFF") #light blue
mdf=int(Audio.gcom2.idf+(event.x-250)*5.859)
mdf=int(Audio.gcom2.idf+(event.x-250)*2.9296875)
def mouse_up_g1(event): global nopen,nxa if mode.get()=='ISCAT': if abs(event.x-nxa)>10: nxb=min(event.x,500) if nxb<nxa: t=nxb nxb=nxa nxa=t Audio.gcom2.nxa=nxa Audio.gcom2.nxb=nxb decode() else: if not nopen: mdf=int(Audio.gcom2.idf+(event.x-250)*5.859) if mdf<-400: mdf=-400 if mdf>400: mdf=400 Audio.gcom2.mousedf=md...
nhs=0 if options.serial_handshake.get()=='XONXOFF': nhs=1 if options.serial_handshake.get()=='Hardware': nhs=2 w.acom1.nhandshake=nhs
w.acom1.chs=options.serial_handshake.get() + \ ' '[:40]
def put_params(param3=NONE): global param20
use_tearoff = (sys.platform != 'darwin')
def audio_config(): inbad,outbad=Audio.audiodev(g.ndevin.get(),g.ndevout.get()) options.inbad.set(inbad) options.outbad.set(outbad) if inbad or outbad: Audio.gcom2.ndevsok=0 options1() else: Audio.gcom2.ndevsok=1
if (sys.platform != 'darwin'): filebutton = Menubutton(mbar, text = 'File') filebutton.pack(side = LEFT) filemenu = Menu(filebutton, tearoff=0) filebutton['menu'] = filemenu else: filemenu = Menu(mbar, tearoff=0)
filebutton = Menubutton(mbar, text = 'File') filebutton.pack(side = LEFT) filemenu = Menu(filebutton) filebutton['menu'] = filemenu
def audio_config(): inbad,outbad=Audio.audiodev(g.ndevin.get(),g.ndevout.get()) options.inbad.set(inbad) options.outbad.set(outbad) if inbad or outbad: Audio.gcom2.ndevsok=0 options1() else: Audio.gcom2.ndevsok=1
if (sys.platform != 'darwin'): setupbutton = Menubutton(mbar, text = 'Setup') setupbutton.pack(side = LEFT) setupmenu = Menu(setupbutton, tearoff=0) setupbutton['menu'] = setupmenu else: setupmenu = Menu(mbar, tearoff=0)
setupbutton = Menubutton(mbar, text = 'Setup') setupbutton.pack(side = LEFT) setupmenu = Menu(setupbutton) setupbutton['menu'] = setupmenu
def audio_config(): inbad,outbad=Audio.audiodev(g.ndevin.get(),g.ndevout.get()) options.inbad.set(inbad) options.outbad.set(outbad) if inbad or outbad: Audio.gcom2.ndevsok=0 options1() else: Audio.gcom2.ndevsok=1
if (sys.platform != 'darwin'): viewbutton=Menubutton(mbar,text='View') viewbutton.pack(side=LEFT) viewmenu=Menu(viewbutton,tearoff=0) viewbutton['menu']=viewmenu else: viewmenu=Menu(mbar,tearoff=0)
viewbutton=Menubutton(mbar,text='View') viewbutton.pack(side=LEFT) viewmenu=Menu(viewbutton) viewbutton['menu']=viewmenu
def audio_config(): inbad,outbad=Audio.audiodev(g.ndevin.get(),g.ndevout.get()) options.inbad.set(inbad) options.outbad.set(outbad) if inbad or outbad: Audio.gcom2.ndevsok=0 options1() else: Audio.gcom2.ndevsok=1
if (sys.platform != 'darwin'): modebutton = Menubutton(mbar, text = 'Mode') modebutton.pack(side = LEFT) modemenu = Menu(modebutton, tearoff=0) modebutton['menu'] = modemenu else: modemenu = Menu(mbar, tearoff=use_tearoff)
modebutton = Menubutton(mbar, text = 'Mode') modebutton.pack(side = LEFT) modemenu = Menu(modebutton) modebutton['menu'] = modemenu
def audio_config(): inbad,outbad=Audio.audiodev(g.ndevin.get(),g.ndevout.get()) options.inbad.set(inbad) options.outbad.set(outbad) if inbad or outbad: Audio.gcom2.ndevsok=0 options1() else: Audio.gcom2.ndevsok=1
if (sys.platform != 'darwin'): savebutton = Menubutton(mbar, text = 'Save') savebutton.pack(side = LEFT) savemenu = Menu(savebutton, tearoff=use_tearoff) savebutton['menu'] = savemenu else: savemenu = Menu(mbar, tearoff=use_tearoff)
savebutton = Menubutton(mbar, text = 'Save') savebutton.pack(side = LEFT) savemenu = Menu(savebutton) savebutton['menu'] = savemenu
def audio_config(): inbad,outbad=Audio.audiodev(g.ndevin.get(),g.ndevout.get()) options.inbad.set(inbad) options.outbad.set(outbad) if inbad or outbad: Audio.gcom2.ndevsok=0 options1() else: Audio.gcom2.ndevsok=1
if (sys.platform != 'darwin'): bandbutton = Menubutton(mbar, text = 'Band') bandbutton.pack(side = LEFT) bandmenu = Menu(bandbutton, tearoff=use_tearoff) bandbutton['menu'] = bandmenu else: bandmenu = Menu(mbar, tearoff=use_tearoff)
bandbutton = Menubutton(mbar, text = 'Band') bandbutton.pack(side = LEFT) bandmenu = Menu(bandbutton) bandbutton['menu'] = bandmenu
def audio_config(): inbad,outbad=Audio.audiodev(g.ndevin.get(),g.ndevout.get()) options.inbad.set(inbad) options.outbad.set(outbad) if inbad or outbad: Audio.gcom2.ndevsok=0 options1() else: Audio.gcom2.ndevsok=1
if (sys.platform != 'darwin'): helpbutton = Menubutton(mbar, text = 'Help') helpbutton.pack(side = LEFT) helpmenu = Menu(helpbutton, tearoff=0) helpbutton['menu'] = helpmenu else: helpmenu = Menu(mbar, tearoff=0)
helpbutton = Menubutton(mbar, text = 'Help') helpbutton.pack(side = LEFT) helpmenu = Menu(helpbutton) helpbutton['menu'] = helpmenu
def audio_config(): inbad,outbad=Audio.audiodev(g.ndevin.get(),g.ndevout.get()) options.inbad.set(inbad) options.outbad.set(outbad) if inbad or outbad: Audio.gcom2.ndevsok=0 options1() else: Audio.gcom2.ndevsok=1
os.path.exists('.\user_.exe'):
os.path.exists('.\user_hardware.exe'):
def update(): global root_geom,isec0,im,pim,ndbm0,nsec0,a,ftx0,nin0,nout0, \ receiving,transmitting,newdat,nscroll,newspec,scale0,offset0, \ modpixmap0,tw,s0,c0,fmid,fmid0,loopall,ntr0,txmsg,iband0, \ bandmap,bm,t0,nreject,gain,phdeg if hopping_feature==1 and hopping.hopping==1: w.acom1.nfhopping=1 if w.acom1.nfhopok...
self.load_mod_categories()
def load_mod_common(self): self.load_mod_users() self.load_mod_siteinfo() self.load_mod_categories() self.load_mod_articles() self.load_mod_tags() self.load_mod_comments() self.load_mod_links() self.load_mod_styles() self.load_mod_images() self.load_mod_widgets()
except Queue.Empty:
except Empty:
def run(self): """Repeatedly process the job queue until told to exit.""" while True: if self._dismissed.isSet(): # we are dismissed, break out of loop break # get next work request. If we don't get a new request from the # queue after self._poll_timout seconds, we jump to the start of # the while loop again, to give t...
except Queue.Empty:
except Empty:
def poll(self, block=False): """Process any new results in the queue.""" while True: # still results pending? if not self.workRequests: raise NoResultsPending # are there still workers to process remaining requests? elif block and not self.workers: raise NoWorkersAvailable try: # get back next results request, result =...
def getchunkname(x, y):
def getchunkname(chunk_x, chunk_y):
def getchunkname(x, y): def base36encode(number): sign = '' if not isinstance(number, (int, long)): raise TypeError('number must be an integer') if number < 0: #raise ValueError('number must be positive') sign = '-' number = number * -1 alphabet = '0123456789abcdefghijklmnopqrstuvwxyz' base36 = '' while number: numbe...
chunk_x = -13 chunk_y = 44
def base36encode(number): sign = '' if not isinstance(number, (int, long)): raise TypeError('number must be an integer') if number < 0: #raise ValueError('number must be positive') sign = '-' number = number * -1
exit(0)
return Image.new("RGB", (256, 256))
def map_chunk_slice(x, z, y = 64): map_directory = "D:\\Minemap\\!CURRENT\\dev\\shm\\rsync\\smp2\\smp\\World10\\" chunkname = map_directory + getchunkname(x, z) chunk = gzip.open(chunkname, 'r') output = read_tag(chunk) print output[0] try: for level in output[2]: # skip end tags if (level[0] == 0): continue for ...
for z in range(0, 16): for x in range (0, 16): print ord(blocks[ y + ( z * 128 + (x * 128 * 16)) ]), print
def map_chunk_slice(x, z, y = 64): map_directory = "D:\\Minemap\\!CURRENT\\dev\\shm\\rsync\\smp2\\smp\\World10\\" chunkname = map_directory + getchunkname(x, z) chunk = gzip.open(chunkname, 'r') output = read_tag(chunk) print output[0] try: for level in output[2]: # skip end tags if (level[0] == 0): continue for ...
image = map_chunk_slice(0,0, 77)
imageL = map_chunk_slice(-10, 40, 76).crop((0,0,256,256)) imageR = map_chunk_slice(-9, 40, 76).crop((0,0,256,256)) image = Image.new("RGB", (512, 256)) image.paste(imageL, (0,0,256,256)) image.paste(imageR, (256,0,512,256))
def get_cropbox(x, y): return (x*16, y*16, x*16 + 16, y*16 + 16)
print "%d items of type %s" % (list_length, tag_types[list_item_type])
def read_list_payload(chunk): list_item_type = ord(chunk.read(1)) list_length = unpack('>l', chunk.read(4))[0] print "%d items of type %s" % (list_length, tag_types[list_item_type])
print "Array length: %d" % length
def read_byte_array(chunk): length = read_int(chunk) print "Array length: %d" % length payload = chunk.read(length) return payload
print "Read %d elements in compound" % len(payload)
def read_compound(chunk): payload = [] tag = read_tag(chunk) payload.append(tag) tag_type = tag[0] while (tag_type > 0): tag = read_tag(chunk) payload.append(tag) tag_type = tag[0] print "Read %d elements in compound" % len(payload) return payload
print "Found tag type: %s" % (tag_types[type], )
def read_tag(chunk): type = ord(chunk.read(1)) # Chunk starts with "10" byte print "Found tag type: %s" % (tag_types[type], ) if (type > 0): name = read_string(chunk) if (name != None): print "Name: %s" % name else: name = '' payload = None # Read payload of each tag. "0" tag has no payload if (type == 1): payload = r...
if (name != None): print "Name: %s" % name
def read_tag(chunk): type = ord(chunk.read(1)) # Chunk starts with "10" byte print "Found tag type: %s" % (tag_types[type], ) if (type > 0): name = read_string(chunk) if (name != None): print "Name: %s" % name else: name = '' payload = None # Read payload of each tag. "0" tag has no payload if (type == 1): payload = r...
print output[0]
blocks = None
def map_chunk_slice(x, z, y = 64): map_directory = "D:\\Minemap\\!CURRENT\\dev\\shm\\rsync\\smp2\\smp\\World10\\" chunkname = map_directory + getchunkname(x, z) chunk = gzip.open(chunkname, 'r') output = read_tag(chunk) print output[0] try: for level in output[2]: # skip end tags if (level[0] == 0): continue for ...
print tag[1]
def map_chunk_slice(x, z, y = 64): map_directory = "D:\\Minemap\\!CURRENT\\dev\\shm\\rsync\\smp2\\smp\\World10\\" chunkname = map_directory + getchunkname(x, z) chunk = gzip.open(chunkname, 'r') output = read_tag(chunk) print output[0] try: for level in output[2]: # skip end tags if (level[0] == 0): continue for ...
print "Blocks retrieved" print "Blocks count: %d" % len(blocks) except: print "No blocks found"
except:
def map_chunk_slice(x, z, y = 64): map_directory = "D:\\Minemap\\!CURRENT\\dev\\shm\\rsync\\smp2\\smp\\World10\\" chunkname = map_directory + getchunkname(x, z) chunk = gzip.open(chunkname, 'r') output = read_tag(chunk) print output[0] try: for level in output[2]: # skip end tags if (level[0] == 0): continue for ...
cobblestone_block = terrain.crop(get_cropbox(0,1))
cobblestone = terrain.crop(get_cropbox(0,1))
def get_cropbox(x, y): return (x*16, y*16, x*16 + 16, y*16 + 16)
imageLU = map_chunk_slice(-10, 40, 70).crop((0,0,256,256)) imageRU = map_chunk_slice(-9, 40, 70).crop((0,0,256,256)) imageLD = map_chunk_slice(-10, 41, 70).crop((0,0,256,256)) imageRD = map_chunk_slice(-9, 41, 70).crop((0,0,256,256)) print "Image mode: %s" % imageLU.mode image = Image.new("RGB", (512, 512)) image.pas...
def get_cropbox(x, y): return (x*16, y*16, x*16 + 16, y*16 + 16)
saturation_cross_section_factor):
saturation_cross_section_factor, write_output):
def AT_IGK (self, n, E_MeV_u, particle_no, fluence_cm2, material_no, RDD_model, RDD_parameters, ER_model, ER_parameters, gamma_model, gamma_parameters, saturation_cross_section_factor): ''' Computes HCP response and RE/RBE using Katz\' Ion-Gamma-Kill approach according to Waligorski, 1988
self.E_MeV_u, self.particle_no, self.fluence_cm2, self.material_no, self.RDD_model, self.RDD_parameters, self.ER_model, self.ER_parameters, self.gamma_model, self.gamma_parameters, self.saturation_cross_section_factor)
self.E_MeV_u, self.particle_no, self.fluence_cm2, self.material_no, self.RDD_model, self.RDD_parameters, self.ER_model, self.ER_parameters, self.gamma_model, self.gamma_parameters, self.saturation_cross_section_factor, self.write_output)
def run(self): ''' RUN AT_IGK ''' self.results = self.AT_IGK(self.number_particles, self.E_MeV_u, self.particle_no, self.fluence_cm2, self.material_no, self.RDD_model, self.RDD_parameters, self.ER_model, self.ER_parameters, self.gamma_model, self.gamma_parameters, self.saturation_cross_section_factor) self.efficency = ...
ER_parameters_ctype,
def AT_SPISS (self, n, E_MeV_u, particle_no, fluence_cm2, material_no, RDD_model, RDD_parameters, ER_model, ER_parameters, gamma_model, gamma_parameters, n_runs, N2, fluence_factor, write_output, importance_sampling): ''' Computes HCP response and RE/RBE using compound Poison process and statistical sampling (CPP_SS, t...
ER_parameters_ctype,
def AT_GSM (self, n, E_MeV_u, particle_no, fluence_cm2, material_no, RDD_model, RDD_parameters, ER_model, ER_parameters, gamma_model, gamma_parameters, N_runs, N2, fluence_factor, write_output, nX, voxel_size_m, lethal_events_mode): ''' Computes HCP response and RE/RBE using summation of tracks an a Cartesian grid (the...
ER_parameters_ctype,
def AT_IGK (self, n, E_MeV_u, particle_no, fluence_cm2, material_no, RDD_model, RDD_parameters, ER_model, ER_parameters, gamma_model, gamma_parameters, saturation_cross_section_factor): ''' Computes HCP response and RE/RBE using Katz\' Ion-Gamma-Kill approach according to Waligorski, 1988
c_at_spiff = self.libamtrack.AT_SPIFF
c_at_spiff = libamtrack.AT_SPIFF
def AT_SPIFF (self, n, E_MeV_u, particle_no, fluence_cm2, material_no, RDD_model, RDD_parameters, ER_model, ER_parameters, gamma_model, gamma_parameters, N2, fluence_factor, write_output, shrink_tails, shrink_tails_under, adjust_N2, lethal_events_mode): ''' Computes HCP response and RE/RBE using compound Poison proces...
c_at_spiss = self.libamtrack.AT_SPISS
c_at_spiss = libamtrack.AT_SPISS
def AT_SPISS (self, n, E_MeV_u, particle_no, fluence_cm2, material_no, RDD_model, RDD_parameters, ER_model, ER_parameters, gamma_model, gamma_parameters, n_runs, N2, fluence_factor, write_output, importance_sampling): ''' Computes HCP response and RE/RBE using compound Poison process and statistical sampling (CPP_SS,...
c_at_gsm = self.libamtrack.AT_GSM
c_at_gsm = libamtrack.AT_GSM
def AT_GSM (self, n, E_MeV_u, particle_no, fluence_cm2, material_no, RDD_model, RDD_parameters, ER_model, ER_parameters, gamma_model, gamma_parameters, N_runs, N2, fluence_factor, write_output, nX, voxel_size_m, lethal_events_mode): ''' Computes HCP response and RE/RBE using summation of tracks an a Cartesian grid (the...
c_at_igk = self.libamtrack.AT_IGK
c_at_igk = libamtrack.AT_IGK
def AT_IGK (self, n, E_MeV_u, particle_no, fluence_cm2, material_no, RDD_model, RDD_parameters, ER_model, ER_parameters, gamma_model, gamma_parameters, saturation_cross_section_factor): ''' Computes HCP response and RE/RBE using Katz\' Ion-Gamma-Kill approach according to Waligorski, 1988
saturation_cross_section_factor_ctype = ctypes.c_float(saturation_cross_section_factor)
saturation_cross_section_factor_ctype = ctypes.byref(ctypes.c_float(saturation_cross_section_factor))
def AT_IGK (self, n, E_MeV_u, particle_no, fluence_cm2, material_no, RDD_model, RDD_parameters, ER_model, ER_parameters, gamma_model, gamma_parameters, saturation_cross_section_factor): ''' Computes HCP response and RE/RBE using Katz\' Ion-Gamma-Kill approach according to Waligorski, 1988
material_no = 51 n = 2 E_MeV_u = [100.0, 100.0] particle_no = [18,1] fluence_cm2 = [-10. ,-1.0] RDD_model = 3 RDD_parameters = [5e-8, 0] ER_model = 4 ER_parameters = [1] gamma_model = 4 gamma_parameters = [1, 10] N2 = 40 fluence_factor = 1.0 write_output = True shrink_tails = True shrink_tails_under = 1e-30 adjust_N2 ...
test_run = AmSpiffRun() print test_run.particle_no test_run.run() print 'Efficency: %.4f\n'%test_run.efficency print test_run.__dict__()
def test_suite(): ''' test script for pyamtrack, runs all functions in a row ''' print'\n----------\n- pyamtrack test run\n----------\n\n'
mb.class_( lambda x: x.name.startswith( 'HINSTANCE' ) ).include( )
def camel_convert(name): s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
mb.class_( "BaseParticleSystem" ).member_functions( "EmitterTransformation" ).call_policies = call_policies.return_internal_reference( )
mb.class_( "BaseParticleSystem" ).member_function( "EmitterTransformation", return_type = '::xfx::Mat4 &' ).call_policies = call_policies.return_internal_reference( )
def camel_convert(name): s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
mb.member_functions( lambda x: x.name.startswith( '_' ) ).exclude() mb.variables( lambda x: x.name.startswith( '_' ) ).exclude()
mb.decls( lambda x: x.name.startswith( '_' ) ).exclude()
def camel_convert(name): s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
mb.class_( "ITexture" ).member_functions( lambda x: x.name in ( "GetD3DTex", ) ).exclude( )
mb.class_( "Cmd" ).member_function( "RegisterVar" ).use_overload_macro = True
def camel_convert(name): s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
mb.namespace( lambda x: x.name.startswith( 'xfx' ) ).include( ) mb.class_( lambda x: x.name.startswith( 'HINSTANCE' ) ).include( ) mb.class_( lambda x: x.name.startswith( 'HWND' ) ).include( )
mb.namespace( 'xfx' ).include( )
def camel_convert(name): s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
mb.class_( "Cmd" ).member_function( "RegisterVar" ).exclude( )
mb.class_( "ITexture" ).member_functions( lambda x: x.name in ( "GetD3DTex", ) ).exclude( )
def camel_convert(name): s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
mb.class_( "ShaderParams" ).member_functions( "GetValue" ).add_transformation( ft.output( "value" ) ) mb.member_functions( "ParseEnvelope" ).add_transformation( ft.inout( "env" ), ft.inout( "pos" ) )
mb.class_( "AABBTree" ).member_functions( "TestIntersection", arg_types = [ 'float &', None, None, None ] ).add_transformation( ft.output( "t" ), ft.output( "normal" ), alias = 'test_intersection_ray' ) mb.class_( "Texture" ).member_functions( "GetFrameTexCoords" ).add_transformation( ft.output( "u0" ), ft.output( "v0"...
def camel_convert(name): s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
mb.class_( "FileIterator_t" ).opaque = True mb.class_( "TextureInfo" ).opaque = True
l = ( 'Triangle', 'AABB', 'Sphere', 'Plane' ) for s in l: f = mb.namespace( "Primitives" ).free_function( name = "TestIntersection", arg_types = [ 'float &', None, ''.join( ( '::xfx::Primitives::', s, ' const &' ) ), None, None ] ) f.add_transformation( ft.output( "t" ), ft.output( "norm" ), alias = ''.join( ( f.alias,...
def camel_convert(name): s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()