Changeset 2f4b430 in sasview for src/sas/perspectives/fitting/fit_thread.py
- Timestamp:
- Mar 4, 2015 3:39:45 PM (10 years ago)
- 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, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 74f419d
- Parents:
- 2f732b0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/perspectives/fitting/fit_thread.py
r386ffe1 r2f4b430 9 9 Execute class.function and return result 10 10 """ 11 return getattr(classInstance, classFunc)(*args)11 return getattr(classInstance, classFunc)(*args) 12 12 13 13 def map_apply(arguments): … … 16 16 class FitThread(CalcThread): 17 17 """Thread performing the fit """ 18 19 def __init__(self, 18 19 def __init__(self, 20 20 fn, 21 21 page_id, … … 24 24 batch_inputs=None, 25 25 pars=None, 26 completefn =None,27 updatefn =None,28 yieldtime =0.03,29 worktime =0.03,30 reset_flag =False):26 completefn=None, 27 updatefn=None, 28 yieldtime=0.03, 29 worktime=0.03, 30 reset_flag=False): 31 31 CalcThread.__init__(self, 32 32 completefn, … … 44 44 #Relative error desired in the sum of squares. 45 45 self.reset_flag = reset_flag 46 46 47 47 def isquit(self): 48 48 """ 49 49 :raise KeyboardInterrupt: when the thread is interrupted 50 50 51 51 """ 52 52 try: … … 55 55 msg = "Fitting: terminated by the user." 56 56 raise KeyboardInterrupt, msg 57 57 58 58 def compute(self): 59 59 """ 60 Perform a fit 60 Perform a fit 61 61 """ 62 62 msg = "" … … 64 64 import copy 65 65 list_handler = [] 66 list_curr_thread = [] 66 list_curr_thread = [] 67 67 list_reset_flag = [] 68 68 list_map_get_attr = [] … … 78 78 #from multiprocessing import Pool 79 79 inputs = zip(list_map_get_attr, self.fitter, list_fit_function, 80 list_q, list_q, list_handler, list_curr_thread,80 list_q, list_q, list_handler, list_curr_thread, 81 81 list_reset_flag) 82 result = 83 82 result = map(map_apply, inputs) 83 84 84 self.complete(result=result, 85 85 batch_inputs=self.batch_inputs, 86 86 batch_outputs=self.batch_outputs, 87 87 page_id=self.page_id, 88 pars =self.pars,89 elapsed=time.time() -self.starttime)90 88 pars=self.pars, 89 elapsed=time.time() - self.starttime) 90 91 91 except KeyboardInterrupt, msg: 92 92 # Thread was interrupted, just proceed and re-raise. … … 95 95 #Stop on exception during fitting. Todo: need to put 96 96 #some mssg and reset progress bar. 97 97 98 98 if self.handler is not None: 99 99 self.handler.stop(msg=msg) … … 102 102 if self.handler is not None: 103 103 self.handler.error(msg=traceback.format_exc()) 104 105 106 104 105 106
Note: See TracChangeset
for help on using the changeset viewer.