Changeset 574adc7 in sasview for src/sas/sascalc/calculator/sas_gen.py
- Timestamp:
- Sep 22, 2017 4:01:32 PM (7 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, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 34d7b35
- Parents:
- 9706d88
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/calculator/sas_gen.py
rf2ea95a r574adc7 34 34 factor = MFACTOR_MT 35 35 else: 36 raise ValueError , "Invalid valueunit"36 raise ValueError("Invalid valueunit") 37 37 sld_m = factor * mag 38 38 return sld_m … … 100 100 """ 101 101 if self.data_vol is None: 102 raise 102 raise TypeError("data_vol is missing") 103 103 self.data_vol = volume 104 104 … … 174 174 if len(x[1]) > 0: 175 175 msg = "Not a 1D." 176 raise ValueError , msg176 raise ValueError(msg) 177 177 i_out = np.zeros_like(x[0]) 178 178 # 1D I is found at y =0 in the 2D pattern … … 181 181 else: 182 182 msg = "Q must be given as list of qx's and qy's" 183 raise ValueError , msg183 raise ValueError(msg) 184 184 185 185 def runXY(self, x=0.0): … … 196 196 else: 197 197 msg = "Q must be given as list of qx's and qy's" 198 raise ValueError , msg198 raise ValueError(msg) 199 199 200 200 def evalDistribution(self, qdist): … … 214 214 mesg = "evalDistribution is expecting an ndarray of " 215 215 mesg += "a list [qx,qy] where qx,qy are arrays." 216 raise RuntimeError , mesg216 raise RuntimeError(mesg) 217 217 218 218 class OMF2SLD(object): … … 313 313 :Params length: data length 314 314 """ 315 msg = "Error: Inconsistent data length." 316 if len(self.pos_x) != length: 317 raise ValueError, msg 318 if len(self.pos_y) != length: 319 raise ValueError, msg 320 if len(self.pos_z) != length: 321 raise ValueError, msg 322 if len(self.mx) != length: 323 raise ValueError, msg 324 if len(self.my) != length: 325 raise ValueError, msg 326 if len(self.mz) != length: 327 raise ValueError, msg 315 parts = (self.pos_x, self.pos_y, self.pos_z, self.mx, self.my, self.mz) 316 if any(len(v) != length for v in parts): 317 raise ValueError("Error: Inconsistent data length.") 328 318 329 319 def remove_null_points(self, remove=False, recenter=False): … … 415 405 msg = "Error: \n" 416 406 msg += "We accept only m as meshunit" 417 raise ValueError , msg407 raise ValueError(msg) 418 408 if s_line[0].lower().count("xbase") > 0: 419 409 xbase = s_line[1].lstrip() … … 485 475 msg = "%s is not supported: \n" % path 486 476 msg += "We accept only Text format OMF file." 487 raise RuntimeError , msg477 raise RuntimeError(msg) 488 478 489 479 class PDBReader(object): … … 605 595 return output 606 596 except: 607 raise RuntimeError , "%s is not a sld file" % path597 raise RuntimeError("%s is not a sld file" % path) 608 598 609 599 def write(self, path, data): … … 697 687 return output 698 688 except: 699 raise RuntimeError , "%s is not a sld file" % path689 raise RuntimeError("%s is not a sld file" % path) 700 690 701 691 def write(self, path, data): … … 706 696 """ 707 697 if path is None: 708 raise ValueError , "Missing the file path."698 raise ValueError("Missing the file path.") 709 699 if data is None: 710 raise ValueError , "Missing the data to save."700 raise ValueError("Missing the data to save.") 711 701 x_val = data.pos_x 712 702 y_val = data.pos_y
Note: See TracChangeset
for help on using the changeset viewer.