Changeset d744767 in sasview for src/sas/sascalc


Ignore:
Timestamp:
Mar 16, 2018 2:05:42 PM (7 years ago)
Author:
krzywon
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:
47bf906
Parents:
477c473 (diff), e4c475b7 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'ESS_GUI' into ESS_GUI_Pr

Location:
src/sas/sascalc
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/calculator/resolution_calculator.py

    r574adc7 r8f83719f  
    10071007        try: 
    10081008            detector_offset = self.sample2detector_distance[1] 
    1009         except: 
    1010             logger.error(sys.exc_value) 
     1009        except Exception as ex: 
     1010            logger.error(ex) 
    10111011 
    10121012        # detector size in [no of pix_x,no of pix_y] 
     
    10571057        # qx_value and qy_value values in array 
    10581058        qx_value = qx_value.repeat(detector_pix_nums_y) 
    1059         qx_value = qx_value.reshape(detector_pix_nums_x, detector_pix_nums_y) 
     1059        qx_value = qx_value.reshape(int(detector_pix_nums_x), int(detector_pix_nums_y)) 
    10601060        qy_value = qy_value.repeat(detector_pix_nums_x) 
    1061         qy_value = qy_value.reshape(detector_pix_nums_y, detector_pix_nums_x) 
     1061        qy_value = qy_value.reshape(int(detector_pix_nums_y), int(detector_pix_nums_x)) 
    10621062        qy_value = qy_value.transpose() 
    10631063 
     
    10941094            output.qx_data = qx_value 
    10951095            output.qy_data = qy_value 
    1096         except: 
    1097             logger.error(sys.exc_value) 
     1096        except Exception as ex: 
     1097            logger.error(ex) 
    10981098 
    10991099        return output 
  • src/sas/sascalc/dataloader/data_info.py

    r9e6aeaf r749b715  
    775775        clone.meta_data = deepcopy(self.meta_data) 
    776776        clone.errors = deepcopy(self.errors) 
     777        clone.isSesans = self.isSesans 
    777778 
    778779        return clone 
  • src/sas/sascalc/dataloader/readers/danse_reader.py

    raf3e9f5 rcee5c78  
    191191        x_vals = np.tile(x_vals, (size_y, 1)).flatten() 
    192192        y_vals = np.tile(y_vals, (size_x, 1)).T.flatten() 
    193         if (np.all(self.current_dataset.err_data == None) 
     193        if (np.all(self.current_dataset.err_data is None) 
    194194                or np.any(self.current_dataset.err_data <= 0)): 
    195195            new_err_data = np.sqrt(np.abs(self.current_dataset.data)) 
  • src/sas/sascalc/fit/AbstractFitEngine.py

    r574adc7 r63319b0  
    300300            self.qmax = math.sqrt(x_max * x_max + y_max * y_max) 
    301301        ## new error image for fitting purpose 
    302         if self.err_data is None or self.err_data == []: 
     302        if self.err_data is None or not self.err_data: 
    303303            self.res_err_data = np.ones(len(self.data)) 
    304304        else: 
  • src/sas/sascalc/fit/expression.py

    r574adc7 re4c475b7  
    210210 
    211211    #print("Function: "+functiondef) 
    212     exec functiondef in globals,locals 
     212    # Python 2.7 
     213    #exec (functiondef in globals,locals) 
     214    # Python 3.5 
     215    exec (functiondef, globals, locals) 
     216 
    213217    retfn = locals['eval_expressions'] 
    214218 
  • src/sas/sascalc/fit/models.py

    rb963b20 rfa81e94  
    139139        if type is not None and issubclass(type, py_compile.PyCompileError): 
    140140            print("Problem with", repr(value)) 
    141             raise type, value, tb 
     141            raise (type, value, tb) 
    142142        return 1 
    143143 
  • src/sas/sascalc/pr/invertor.py

    rd04ac05 r8f83719f  
    481481            float(chi2) 
    482482        except: 
    483             chi2 = -1.0 
     483            chi2 = [-1.0] 
    484484        self.chi2 = chi2 
    485485 
     
    500500            cov = np.linalg.pinv(inv_cov) 
    501501            err = math.fabs(chi2 / float(npts - nfunc)) * cov 
    502         except: 
     502        except Exception as ex: 
    503503            # We were not able to estimate the errors 
    504504            # Return an empty error matrix 
    505             logger.error(sys.exc_value) 
     505            logger.error(ex) 
    506506 
    507507        # Keep a copy of the last output 
     
    540540 
    541541        """ 
    542         from num_term import NTermEstimator 
     542        from sas.sascalc.pr.num_term import NTermEstimator 
    543543        estimator = NTermEstimator(self.clone()) 
    544544        try: 
    545545            return estimator.num_terms(isquit_func) 
    546         except: 
     546        except Exception as ex: 
    547547            # If we fail, estimate alpha and return the default 
    548548            # number of terms 
    549549            best_alpha, _, _ = self.estimate_alpha(self.nfunc) 
    550             logger.warning("Invertor.estimate_numterms: %s" % sys.exc_value) 
     550            logger.warning("Invertor.estimate_numterms: %s" % ex) 
    551551            return self.nfunc, best_alpha, "Could not estimate number of terms" 
    552552 
     
    634634                return best_alpha, message, elapsed 
    635635 
    636         except: 
    637             message = "Invertor.estimate_alpha: %s" % sys.exc_value 
     636        except Exception as ex: 
     637            message = "Invertor.estimate_alpha: %s" % ex 
    638638            return 0, message, elapsed 
    639639 
     
    754754                        self.cov[i][i] = float(toks2[1]) 
    755755 
    756             except: 
    757                 msg = "Invertor.from_file: corrupted file\n%s" % sys.exc_value 
     756            except Exception as ex: 
     757                msg = "Invertor.from_file: corrupted file\n%s" % ex 
    758758                raise RuntimeError(msg) 
    759759        else: 
  • src/sas/sascalc/pr/num_term.py

    ra1b8fee r8f83719f  
    183183                data_y = np.append(data_y, test_y) 
    184184                data_err = np.append(data_err, err) 
    185             except: 
    186                 logger.error(sys.exc_value) 
     185            except Exception as ex: 
     186                logger.error(ex) 
    187187 
    188188    return data_x, data_y, data_err 
Note: See TracChangeset for help on using the changeset viewer.