def init_peak(self,line,guess=True,**kws): """ Create a new peak given an xrf line Parameters: ----------- * line: Can be either a string representation of the line e.g. 'Mn ka', 'Fe ka', 'Fe kb' (see xrf_lookup.py) or an energy (as float). * guess: If guess is true the peak amplitude and fwhm will be estimated * kws: Passed to peak """ # create peak_params dict peak_params = {} peak_params.update(kws) # get energy from line or # convert line to energy if type(line)==types.StringType: line = line.strip() en = xrf_lookup.lookup_xrf_line(line) else: try: en = float(line) except: en = None if en == None: print "Error setting energy for line" return else: peak_params['energy'] = en # create label if not specified if peak_params.has_key('label') == False: label = str(line) label.strip() peak_params['label']=label self._init_peak(peak_params=peak_params,guess=guess) return
def on_XrfLine_select(self, event): "select an xrf line" if self.init_xrf_lines == True: self.init_XrfLineItems() #print "do update" return else: line = self.components.XrfLine.stringSelection en = xrf_lookup.lookup_xrf_line(line) if en: en = str(en) else: en = '' self.components.PkLbl.text = line self.components.PkEn.text = en self.components.PkAmp.text = '0.0' self.components.PkFWHM.text = '0.0' self.components.PkEnFlag.stringSelection = '1' self.components.PkFwhmFlag.stringSelection = '1' self.components.PkAmpFactor.text = '0.0' self.components.PkIgnore.checked = False return