Changeset fa05c6c1 in sasview for src


Ignore:
Timestamp:
May 8, 2018 4:23:59 AM (6 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
acd9c311, bac81f4, fca1f50
Parents:
42787fb
Message:

Minor stability fixes for some calculators

Location:
src/sas/qtgui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Calculators/ResolutionCalculatorPanel.py

    raed0532 rfa05c6c1  
    327327                return 
    328328 
    329             try: 
    330                 basename = os.path.basename(datafile) 
     329            basename = os.path.basename(datafile) 
     330 
     331            input_f = open(datafile, 'r') 
     332            buff = input_f.read() 
     333            lines = buff.split('\n') 
     334 
     335            wavelength = [] 
     336            intensity = [] 
     337 
     338            for line in lines: 
     339                toks = line.split() 
     340                try: 
     341                    wave = float(toks[0]) 
     342                    intens = float(toks[1]) 
     343                    wavelength.append(wave) 
     344                    intensity.append(intens) 
     345                except: 
     346                    logging.info('Could not extract values from file') 
     347            if wavelength and intensity: 
    331348                if basename not in list(self.spectrum_dic.keys()): 
    332349                    self.cbCustomSpectrum.addItem(basename) 
    333  
    334                 input_f = open(datafile, 'r') 
    335                 buff = input_f.read() 
    336                 lines = buff.split('\n') 
    337  
    338                 wavelength = [] 
    339                 intensity = [] 
    340  
    341                 for line in lines: 
    342                     toks = line.split() 
    343                     try: 
    344                         wave = float(toks[0]) 
    345                         intens = float(toks[1]) 
    346                         wavelength.append(wave) 
    347                         intensity.append(intens) 
    348                     except: 
    349                         logging.info('Could not extract values from file') 
    350             except: 
    351                 raise 
    352  
    353             self.spectrum_dic[basename] = [wavelength, intensity] 
    354             self.resolution.set_spectrum(self.spectrum_dic[basename]) 
     350                self.spectrum_dic[basename] = [wavelength, intensity] 
     351                self.resolution.set_spectrum(self.spectrum_dic[basename]) 
    355352        return 
    356353 
  • src/sas/qtgui/Calculators/SlitSizeCalculator.py

    raed0532 rfa05c6c1  
    115115            xdata = data.x 
    116116            ydata = data.y 
    117             #if xdata == [] or xdata is None or ydata == [] or ydata is None: 
    118             if (not xdata or xdata is None) or (not ydata or ydata is None): 
     117            if xdata == [] or xdata is None or ydata == [] or ydata is None: 
    119118                msg = "The current data is empty please check x and y" 
    120119                logging.error(msg) 
  • src/sas/qtgui/MainWindow/GuiManager.py

    raed0532 rfa05c6c1  
    602602        """ 
    603603        """ 
    604         #self.DVCalculator.show() 
    605604        self.KIESSIGCalculator.show() 
    606605 
     
    613612        """ 
    614613        """ 
    615         self.ResolutionCalculator.show() 
     614        try: 
     615            self.ResolutionCalculator.show() 
     616        except Exception as ex: 
     617            logging.error(str(ex)) 
     618            return 
    616619 
    617620    def actionGeneric_Scattering_Calculator(self): 
    618621        """ 
    619622        """ 
    620         self.GENSASCalculator.show() 
     623        try: 
     624            self.GENSASCalculator.show() 
     625        except Exception as ex: 
     626            logging.error(str(ex)) 
     627            return 
    621628 
    622629    def actionPython_Shell_Editor(self): 
Note: See TracChangeset for help on using the changeset viewer.