Changeset f668101 in sasview for src/sas/sascalc/fit


Ignore:
Timestamp:
Dec 7, 2016 9:16:33 AM (8 years ago)
Author:
jhbakker
Branches:
master, 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, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
c6728e1
Parents:
1cad8a4 (diff), 5231948 (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 'master' into Jurtest

Location:
src/sas/sascalc/fit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/fit/BumpsFitting.py

    r7988501 rf668101  
    44import os 
    55from datetime import timedelta, datetime 
     6import traceback 
    67 
    78import numpy 
     
    292293            R.success = result['success'] 
    293294            if R.success: 
    294                 R.stderr = numpy.hstack((result['stderr'][fitted_index], 
    295                                          numpy.NaN*numpy.ones(len(fitness.computed_pars)))) 
     295                if result['stderr'] is None: 
     296                    R.stderr = numpy.NaN*numpy.ones(len(param_list)) 
     297                else: 
     298                    R.stderr = numpy.hstack((result['stderr'][fitted_index], 
     299                                             numpy.NaN*numpy.ones(len(fitness.computed_pars)))) 
    296300                R.pvec = numpy.hstack((result['value'][fitted_index], 
    297301                                      [p.value for p in fitness.computed_pars])) 
     
    305309                R.uncertainty_state = result['uncertainty'] 
    306310            all_results.append(R) 
     311        all_results[0].mesg = result['errors'] 
    307312 
    308313        if q is not None: 
     
    343348    try: 
    344349        best, fbest = fitdriver.fit() 
    345     except: 
    346         import traceback; traceback.print_exc() 
    347         raise 
     350        errors = [] 
     351    except Exception as exc: 
     352        best, fbest = None, numpy.NaN 
     353        errors = [str(exc), traceback.traceback.format_exc()] 
    348354    finally: 
    349355        mapper.stop_mapper(fitdriver.mapper) 
     
    355361 
    356362    success = best is not None 
     363    try: 
     364        stderr = fitdriver.stderr() if success else None 
     365    except Exception as exc: 
     366        errors.append(str(exc)) 
     367        errors.append(traceback.format_exc()) 
     368        stderr = None 
    357369    return { 
    358370        'value': best if success else None, 
    359         'stderr': fitdriver.stderr() if success else None, 
     371        'stderr': stderr, 
    360372        'success': success, 
    361373        'convergence': convergence, 
    362374        'uncertainty': getattr(fitdriver.fitter, 'state', None), 
     375        'errors': '\n'.join(errors), 
    363376        } 
    364377 
  • src/sas/sascalc/fit/AbstractFitEngine.py

    rfc18690 r7988501  
    131131        a way to get residuals from data. 
    132132    """ 
    133     def __init__(self, x, y, dx=None, dy=None, smearer=None, data=None): 
     133    def __init__(self, x, y, dx=None, dy=None, smearer=None, data=None, lam=None, dlam=None): 
    134134        """ 
    135135            :param smearer: is an object of class QSmearer or SlitSmearer 
     
    152152                 
    153153        """ 
    154         Data1D.__init__(self, x=x, y=y, dx=dx, dy=dy) 
     154        Data1D.__init__(self, x=x, y=y, dx=dx, dy=dy, lam=lam,dlam=dlam) 
    155155        self.num_points = len(x) 
    156156        self.sas_data = data 
Note: See TracChangeset for help on using the changeset viewer.