Пример #1
0
	def attlen_calculate_clicked(self,widget):
		el = self.wTree.get_widget("element_combo_box").get_active_text()
		energy = self.wTree.get_widget("attlen_energy_box").get_text()
		[self.E,self.attlen] = nx.calclengths([el],energy)

		if eval(energy) in self.E[el]:
			i = self.E[el].index(eval(energy))
			self.wTree.get_widget("attlen_box").set_text(str(self.attlen[el][i]) + ' cm')
		else:
			print "Some carazy happened. Bailing!"
Пример #2
0
	def efflen_calculate_clicked(self,widget):
		el = self.wTree.get_widget("element_combo_box3").get_active_text()
		energy = self.wTree.get_widget("efflen_energy_entry").get_text()
		abs = eval(self.wTree.get_widget("efflen_absorption_entry").get_text())/100.0

		[self.E,self.attlen] = nx.calclengths([el],energy)

		if eval(energy) in self.E[el]:
			i = self.E[el].index(eval(energy))
			al = self.attlen[el][i] / 100 # convert to m

			length = -al * math.log(1 - abs)

			#print abs,al,math.log(1-abs),length

			self.wTree.get_widget("efflen_len_entry").set_text(str(length) + " m")
Пример #3
0
	def abseff_calculate_clicked(self,widget):
		el = self.wTree.get_widget("element_combo_box2").get_active_text()
		energy = self.wTree.get_widget("abseff_energy_entry").get_text()
		length = eval(self.wTree.get_widget("abseff_thickness_entry").get_text())
		[self.E,self.attlen] = nx.calclengths([el],energy)

		if eval(energy) in self.E[el]:
			i = self.E[el].index(eval(energy))
			al = self.attlen[el][i] / 100 # convert to m

			eff = (1 - math.exp(-length/al)) * 100
			effstr = "%3.2f %% Absorption" % (eff)
			
			self.wTree.get_widget("abseff_eff_entry").set_text(effstr)
		else:
			print "I'm a outta here!"
Пример #4
0
	def button1_clicked(self,widget):
		self.graphview.remove(self.canvas) # important else they just get inserted again each time (not replaced)
		self.axis.cla()
		eltext = self.wTree.get_widget("ElementText").get_text()
		if eltext.find(',') == -1:
			el = self.wTree.get_widget("ElementText").get_text().split()
		else:
			el = self.wTree.get_widget("ElementText").get_text().split(',')		
		
		[self.E,self.attlen] = nx.calclengths(el)
		for e in self.attlen.keys():
			self.axis.loglog(self.E[e],self.attlen[e],label=e);
		self.axis.set_xlabel('Energy (MeV)')
		self.axis.set_ylabel('Attenuation Length (cm)')
		self.axis.set_title('Attenuation Lengths vs Energy')
		self.axis.legend(loc='lower right')
		self.axis.grid(True)
		self.canvas.destroy()
                self.canvas = FigureCanvasGTK(self.figure)
                self.canvas.show()
		self.graphview = self.wTree.get_widget("vbox1")
                self.graphview.pack_end(self.canvas, True, True)