Changeset 785c8233 in sasview for sansview/perspectives/fitting
- Timestamp:
- Aug 10, 2009 9:42:20 AM (15 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:
- 7e752fe
- Parents:
- fd0d30fd
- Location:
- sansview/perspectives/fitting
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/fit_thread.py
r60c1943 r785c8233 146 146 cpage= self.cpage, 147 147 elapsed=elapsed ) 148 148 149 149 except KeyboardInterrupt: 150 150 # Thread was interrupted, just proceed and re-raise. … … 155 155 except : 156 156 #Stop on exception during fitting. Todo: need to put some mssg and reset progress bar. 157 wx.PostEvent(self.parent, StatusEvent(status=" Fit exception occurred..." ,type="stop")) 157 msg= " Fit Error occurred... %s"%sys.exc_value 158 wx.PostEvent(self.parent, StatusEvent(status= msg,type="stop")) 158 159 #raise 159 160 -
sansview/perspectives/fitting/gui_thread.py
r077809c r785c8233 62 62 res=[] 63 63 try: 64 res = self.fitdata.residuals(self.model. run)64 res = self.fitdata.residuals(self.model.evalDistribution) 65 65 sum=0 66 66 for item in res: … … 133 133 res=[] 134 134 try: 135 res = self.fitdata.residuals(self.model. run)135 res = self.fitdata.residuals(self.model.evalDistribution) 136 136 sum=0 137 137 for item in res: -
sansview/perspectives/fitting/model_thread.py
rb293683 r785c8233 54 54 index_model = (self.qmin <= radius)&(radius<= self.qmax) 55 55 56 ## receive only list of 2 numpy array 57 ## One must reshape to vertical and the other to horizontal 58 value = self.model.evalDistribution([self.y_array,self.x_array] ) 59 ## for data ignore the qmax 60 if self.data == None: 61 # Only qmin value will be consider for the detector 62 output = value *index_data 63 else: 64 # The user can define qmin and qmax for the detector 65 output = value*index_model 66 56 try: 57 ## receive only list of 2 numpy array 58 ## One must reshape to vertical and the other to horizontal 59 value = self.model.evalDistribution([self.y_array,self.x_array] ) 60 ## for data ignore the qmax 61 if self.data == None: 62 # Only qmin value will be consider for the detector 63 output = value *index_data 64 else: 65 # The user can define qmin and qmax for the detector 66 output = value*index_model 67 except: 68 raise 69 70 67 71 elapsed = time.time()-self.starttime 68 72 self.complete( image = output, … … 74 78 qstep = self.qstep ) 75 79 76 def compute_point(self): 77 """ 78 Compute the data given a model function. Loop through each point 79 of x and y to compute the model 80 @return output : is a matrix of size x*y 81 """ 82 output = numpy.zeros((len(self.x),len(self.y))) 83 84 for i_x in range(len(self.x)): 85 # Check whether we need to bail out 86 self.update(output=output ) 87 self.isquit() 88 89 for i_y in range(int(len(self.y))): 90 radius = math.sqrt(self.x[i_x]*self.x[i_x]+self.y[i_y]*self.y[i_y]) 91 ## for data ignore the qmax 92 if self.data == None: 93 if self.qmin <= radius : 94 value = self.model.runXY( [self.x[i_x], self.y[i_y]] ) 95 output[i_y][i_x] =value 96 else: 97 output[i_y][i_x] =0 98 else: 99 if self.qmin <= radius and radius<= self.qmax: 100 value = self.model.runXY( [self.x[i_x], self.y[i_y]] ) 101 output[i_y][i_x] =value 102 else: 103 output[i_y][i_x] =0 104 return output 105 80 106 81 107 82 … … 138 113 self.starttime = time.time() 139 114 140 index= (self.qmin <= self.x)& (self.x <= self.qmax) 141 output = self.model.evalDistribution(self.x[index]) 142 115 try: 116 index= (self.qmin <= self.x)& (self.x <= self.qmax) 117 output = self.model.evalDistribution(self.x[index]) 118 except: 119 raise 120 121 143 122 ##smearer the ouput of the plot 144 123 if self.smearer!=None: … … 150 129 151 130 elapsed = time.time()-self.starttime 152 131 153 132 self.complete(x= self.x, y= output, 154 133 elapsed=elapsed, model= self.model, data=self.data) 155 134 156 def compute_point(self): 157 """ 158 Compute the data given a model function. Loop through each point 159 of x compute the model 160 @return output : is a numpy vector of size x 161 """ 162 output = numpy.zeros(len(self.x)) 163 # Loop through each q of data.x 164 for i_x in range(len(self.x)): 165 self.update(x= self.x, output=output ) 166 # Check whether we need to bail out 167 self.isquit() 168 if self.qmin <= self.x[i_x] and self.x[i_x] <= self.qmax: 169 value = self.model.run(self.x[i_x]) 170 output[i_x] = value 171 172 return output 173 135 174 136 175 137 class CalcCommandline:
Note: See TracChangeset
for help on using the changeset viewer.