Changes in / [998ca90:ff3f5821] in sasview
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
docs/sphinx-docs/build_sphinx.py
r5dd7499 rdd72190 36 36 #/sasview-local-trunk/docs/sphinx-docs/build_sphinx.py 37 37 SASMODELS_SOURCE_PROLOG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc") 38 SASMODELS_SOURCE_GPU = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "gpu") 38 39 SASMODELS_SOURCE_SESANS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "sesans") 40 SASMODELS_SOURCE_SESANSIMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "sesans", "sesans_img") 39 41 SASMODELS_SOURCE_MAGNETISM = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "magnetism") 40 42 SASMODELS_SOURCE_MAGIMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "magnetism", "mag_img") … … 50 52 SASMODELS_DEST_IMG = os.path.join(SASMODELS_DEST_PROLOG, "user", "model-imgs", "new-models") 51 53 SASMODELS_DEST_MAGIMG = os.path.join(SASMODELS_DEST_PROLOG, "user", "mag_img") 54 SASMODELS_DEST_SESANSIMG = os.path.join(SASMODELS_DEST_PROLOG, "user", "sesans_img") 52 55 SASMODELS_DEST_BUILDIMG = os.path.join(SASMODELS_DEST_PROLOG, "user", "models", "img") 53 56 … … 190 193 tohere=os.path.join(SASMODELS_DEST_IMG,files) 191 194 shutil.copy(fromhere,tohere) 192 else: print "no source directorty",SASMODELS_SOURCE_AUTOIMG ,"was found"195 else: print "no source directory",SASMODELS_SOURCE_AUTOIMG ,"was found" 193 196 194 197 # And the rst prolog with the unit substitutions … … 204 207 shutil.copy(fromhere,tohere) 205 208 209 if os.path.exists(SASMODELS_SOURCE_GPU): 210 print "Found docs folder SASMODELS_SOURCE_GPU at ", SASMODELS_SOURCE_GPU 211 if os.path.exists(SPHINX_SOURCE_USER): 212 print "Found docs folder SPHINX_SOURCE_USER at ", SPHINX_SOURCE_USER 213 print "Copying sasmodels gpu files..." 214 for files in os.listdir(SASMODELS_SOURCE_GPU): 215 if files.endswith(".rst"): 216 fromhere=os.path.join(SASMODELS_SOURCE_GPU,files) 217 tohere=os.path.join(SPHINX_SOURCE_USER,files) 218 shutil.copy(fromhere,tohere) 219 220 206 221 if os.path.exists(SASMODELS_SOURCE_SESANS): 207 222 print "Found docs folder SASMODELS_SOURCE_SESANS at ", SASMODELS_SOURCE_SESANS … … 227 242 228 243 if os.path.exists(SASMODELS_SOURCE_MAGIMG): 229 print "Found img folder SASMODELS_SOURCE_MAGIMGat ", SASMODELS_SOURCE_MAGIMG244 print "Found img folder SASMODELS_SOURCE_MAGIMG at ", SASMODELS_SOURCE_MAGIMG 230 245 if not os.path.exists(SASMODELS_DEST_MAGIMG): 231 246 print "Missing docs folder SASMODELS_DEST_MAGIMG at ", SASMODELS_DEST_MAGIMG … … 237 252 tohere=os.path.join(SASMODELS_DEST_MAGIMG,files) 238 253 shutil.copy(fromhere,tohere) 239 else: print "no source directorty",SASMODELS_SOURCE_MAGIMG ,"was found" 254 else: print "no source directory",SASMODELS_SOURCE_MAGIMG ,"was found" 255 256 if os.path.exists(SASMODELS_SOURCE_SESANSIMG): 257 print "Found img folder SASMODELS_SOURCE_MAGIMG at ", SASMODELS_SOURCE_SESANSIMG 258 if not os.path.exists(SASMODELS_DEST_MAGIMG): 259 print "Missing docs folder SASMODELS_DEST_MAGIMG at ", SASMODELS_DEST_SESANSIMG 260 os.makedirs(SASMODELS_DEST_SESANSIMG) 261 print "created SASMODELS_DEST_SESANSIMG at ", SASMODELS_DEST_SESANSIMG 262 print "Copying sasmodels model auto-generated image files..." 263 for files in os.listdir(SASMODELS_SOURCE_SESANSIMG): 264 fromhere=os.path.join(SASMODELS_SOURCE_SESANSIMG,files) 265 tohere=os.path.join(SASMODELS_DEST_SESANSIMG,files) 266 shutil.copy(fromhere,tohere) 267 else: print "no source directory",SASMODELS_SOURCE_SESANSIMG ,"was found" 240 268 241 269 if os.path.exists(SASMODELS_SOURCE_REF_MODELS): -
src/sas/sascalc/dataloader/data_info.py
r45d7662 r1b1a1c1 881 881 raise ValueError, msg 882 882 # Here we could also extrapolate between data points 883 ZERO = 1.0e-12883 TOLERANCE = 0.01 884 884 for i in range(len(self.x)): 885 if math.fabs( self.x[i] - other.x[i]) > ZERO:885 if math.fabs((self.x[i] - other.x[i])/self.x[i]) > TOLERANCE: 886 886 msg = "Incompatible data sets: x-values do not match" 887 887 raise ValueError, msg … … 1093 1093 """ 1094 1094 err_other = None 1095 TOLERANCE = 0.01 1095 1096 if isinstance(other, Data2D): 1096 1097 # Check that data lengths are the same … … 1101 1102 raise ValueError, msg 1102 1103 for ind in range(len(self.data)): 1103 if self.qx_data[ind] != other.qx_data[ind]:1104 msg = "Incompatible data sets: qx-values do not match "1104 if math.fabs((self.qx_data[ind] - other.qx_data[ind])/self.qx_data[ind]) > TOLERANCE: 1105 msg = "Incompatible data sets: qx-values do not match: %s %s" % (self.qx_data[ind], other.qx_data[ind]) 1105 1106 raise ValueError, msg 1106 if self.qy_data[ind] != other.qy_data[ind]:1107 msg = "Incompatible data sets: qy-values do not match "1107 if math.fabs((self.qy_data[ind] - other.qy_data[ind])/self.qy_data[ind]) > TOLERANCE: 1108 msg = "Incompatible data sets: qy-values do not match: %s %s" % (self.qy_data[ind], other.qy_data[ind]) 1108 1109 raise ValueError, msg 1109 1110 -
src/sas/sasgui/guiframe/dataFitting.py
rd85c194 r9b6d62d 363 363 _str = "%s\n" % LoadData2D.__str__(self) 364 364 return _str 365 366 def _validity_check(self, other): 367 """ 368 Checks that the data lengths are compatible. 369 Checks that the x vectors are compatible. 370 Returns errors vectors equal to original 371 errors vectors if they were present or vectors 372 of zeros when none was found. 373 374 :param other: other data set for operation 375 376 :return: dy for self, dy for other [numpy arrays] 377 378 :raise ValueError: when lengths are not compatible 379 380 """ 381 err_other = None 382 if isinstance(other, Data2D): 383 # Check that data lengths are the same 384 if len(self.data) != len(other.data) or \ 385 len(self.qx_data) != len(other.qx_data) or \ 386 len(self.qy_data) != len(other.qy_data): 387 msg = "Unable to perform operation: data length are not equal" 388 raise ValueError, msg 389 #if len(self.data) < 1: 390 # msg = "Incompatible data sets: I-values do not match" 391 # raise ValueError, msg 392 for ind in range(len(self.data)): 393 if self.qx_data[ind] != other.qx_data[ind]: 394 msg = "Incompatible data sets: qx-values do not match" 395 raise ValueError, msg 396 if self.qy_data[ind] != other.qy_data[ind]: 397 msg = "Incompatible data sets: qy-values do not match" 398 raise ValueError, msg 399 400 # Check that the scales match 401 err_other = other.err_data 402 if other.err_data == None or \ 403 (len(other.err_data) != len(other.data)): 404 err_other = numpy.zeros(len(other.data)) 405 406 # Check that we have errors, otherwise create zero vector 407 err = self.err_data 408 if self.err_data == None or \ 409 (len(self.err_data) != len(self.data)): 410 err = numpy.zeros(len(other.data)) 411 412 return err, err_other 413 414 def _validity_check_union(self, other): 415 """ 416 Checks that the data lengths are compatible. 417 Checks that the x vectors are compatible. 418 Returns errors vectors equal to original 419 errors vectors if they were present or vectors 420 of zeros when none was found. 421 422 :param other: other data set for operation 423 424 :return: bool 425 426 :raise ValueError: when data types are not compatible 427 428 """ 429 if not isinstance(other, Data2D): 430 msg = "Unable to perform operation: different types of data set" 431 raise ValueError, msg 432 return True 433 365 434 366 def _perform_operation(self, other, operation): 435 367 """ -
src/sas/sasgui/perspectives/calculator/data_operator.py
r0e760e9 r61780e3 397 397 self._set_textctrl_color(self.data1_cbox, 'pink') 398 398 self._set_textctrl_color(self.data2_cbox, 'pink') 399 msg = "DataOperation: Data types must be same."399 msg = "DataOperation: %s" % sys.exc_value 400 400 self.send_warnings(msg, 'error') 401 401 self.output = None -
src/sas/sasgui/perspectives/fitting/fitting.py
re89aed5 r286c757 1742 1742 data_id=str(page_id) + " " + data.name + " unsmeared") 1743 1743 1744 self.create_theory_1D(x, unsmeared_data, page_id, model, data, state, 1745 data_description="Data unsmeared", 1746 data_id="Data " + data.name + " unsmeared", 1747 dy=unsmeared_error) 1744 if unsmeared_data is not None and unsmeared_error is not None: 1745 self.create_theory_1D(x, unsmeared_data, page_id, model, data, state, 1746 data_description="Data unsmeared", 1747 data_id="Data " + data.name + " unsmeared", 1748 dy=unsmeared_error) 1748 1749 1749 1750 if sq_model is not None and pq_model is not None: -
src/sas/sasgui/perspectives/fitting/model_thread.py
rca4d985 r286c757 179 179 unsmeared_output[first_bin:last_bin+1] = self.model.evalDistribution(mask) 180 180 output = self.smearer(unsmeared_output, first_bin, last_bin) 181 181 182 182 # Rescale data to unsmeared model 183 unsmeared_data = numpy.zeros((len(self.data.x))) 184 unsmeared_error = numpy.zeros((len(self.data.x))) 185 unsmeared_data[first_bin:last_bin+1] = self.data.y[first_bin:last_bin+1]\ 186 * unsmeared_output[first_bin:last_bin+1]\ 187 / output[first_bin:last_bin+1] 188 unsmeared_error[first_bin:last_bin+1] = self.data.dy[first_bin:last_bin+1]\ 189 * unsmeared_output[first_bin:last_bin+1]\ 190 / output[first_bin:last_bin+1] 191 unsmeared_output=unsmeared_output[index] 192 unsmeared_data=unsmeared_data[index] 193 unsmeared_error=unsmeared_error 183 # Check that the arrays are compatible. If we only have a model but no data, 184 # the length of data.y will be zero. 185 if isinstance(self.data.y, numpy.ndarray) and output.shape == self.data.y.shape: 186 unsmeared_data = numpy.zeros((len(self.data.x))) 187 unsmeared_error = numpy.zeros((len(self.data.x))) 188 unsmeared_data[first_bin:last_bin+1] = self.data.y[first_bin:last_bin+1]\ 189 * unsmeared_output[first_bin:last_bin+1]\ 190 / output[first_bin:last_bin+1] 191 unsmeared_error[first_bin:last_bin+1] = self.data.dy[first_bin:last_bin+1]\ 192 * unsmeared_output[first_bin:last_bin+1]\ 193 / output[first_bin:last_bin+1] 194 unsmeared_output=unsmeared_output[index] 195 unsmeared_data=unsmeared_data[index] 196 unsmeared_error=unsmeared_error 194 197 else: 195 198 output[index] = self.model.evalDistribution(self.data.x[index])
Note: See TracChangeset
for help on using the changeset viewer.