Changeset d744767 in sasview for src/sas/qtgui/Plotting/DataTransform.py
- Timestamp:
- Mar 16, 2018 2:05:42 PM (7 years ago)
- Branches:
- 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
- Children:
- 47bf906
- Parents:
- 477c473 (diff), e4c475b7 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Plotting/DataTransform.py
re7a0b2f rd744767 24 24 """ 25 25 if not x > 0: 26 raise ValueError , "Transformation only accepts positive values."26 raise ValueError("Transformation only accepts positive values.") 27 27 else: 28 28 return x … … 50 50 """ 51 51 if not x >= 0: 52 raise ValueError , "square root of a negative value "52 raise ValueError("square root of a negative value ") 53 53 else: 54 54 return math.sqrt(x) … … 76 76 """ 77 77 if not x >= 0: 78 raise ValueError , "double square root of a negative value "78 raise ValueError("double square root of a negative value ") 79 79 else: 80 80 return math.sqrt(math.sqrt(x)) … … 90 90 """ 91 91 if not x > 0: 92 raise ValueError , "Log(x)of a negative value "92 raise ValueError("Log(x)of a negative value ") 93 93 else: 94 94 return math.log(x) … … 100 100 return 1 / x 101 101 else: 102 raise ValueError , "cannot divide by zero"102 raise ValueError("cannot divide by zero") 103 103 104 104 … … 109 109 return 1 / math.sqrt(y) 110 110 else: 111 raise ValueError , "transform.toOneOverSqrtX: cannot be computed"111 raise ValueError("transform.toOneOverSqrtX: cannot be computed") 112 112 113 113 … … 118 118 return math.log(y * (x ** 2)) 119 119 else: 120 raise ValueError , "transform.toLogYX2: cannot be computed"120 raise ValueError("transform.toLogYX2: cannot be computed") 121 121 122 122 … … 127 127 return math.log(math.pow(x, 4) * y) 128 128 else: 129 raise ValueError , "transform.toLogYX4: input error"129 raise ValueError("transform.toLogYX4: input error") 130 130 131 131 … … 149 149 """ 150 150 if not (x * y) > 0: 151 raise ValueError , "Log(X*Y)of a negative value "151 raise ValueError("Log(X*Y)of a negative value ") 152 152 else: 153 153 return math.log(x * y) … … 162 162 163 163 """ 164 if dx ==None:164 if dx is None: 165 165 dx = 0 166 166 return dx … … 175 175 176 176 """ 177 if dx ==None:177 if dx is None: 178 178 dx = 0 179 179 return dx … … 188 188 189 189 """ 190 if dx !=None:190 if dx is not None: 191 191 err = 2 * x * dx 192 192 return math.fabs(err) … … 204 204 """ 205 205 if x > 0: 206 if dx !=None:206 if dx is not None: 207 207 err = dx / (2 * math.sqrt(x)) 208 208 else: … … 211 211 else: 212 212 msg = "transform.errFromX2: can't compute error of negative x" 213 raise ValueError , msg213 raise ValueError(msg) 214 214 215 215 … … 222 222 223 223 """ 224 if dx !=None:224 if dx is not None: 225 225 err = 4 * math.pow(x, 3) * dx 226 226 return math.fabs(err) … … 238 238 """ 239 239 if x > 0: 240 if dx !=None:240 if dx is not None: 241 241 err = dx / (4 * math.pow(x, 3 / 4)) 242 242 else: … … 245 245 else: 246 246 msg = "transform.errFromX4: can't compute error of negative x" 247 raise ValueError , msg247 raise ValueError(msg) 248 248 249 249 … … 256 256 257 257 """ 258 if dx ==None:258 if dx is None: 259 259 dx = 0 260 260 … … 264 264 msg = "Transformation does not accept" 265 265 msg += " point that are consistent with zero." 266 raise ValueError , msg266 raise ValueError(msg) 267 267 if x != 0: 268 268 dx = dx / (x * math.log(10)) 269 269 else: 270 raise ValueError , "errToLogX: divide by zero"270 raise ValueError("errToLogX: divide by zero") 271 271 return dx 272 272 … … 280 280 281 281 """ 282 if dx ==None:282 if dx is None: 283 283 dx = 0 284 284 … … 287 287 dx = dx / x 288 288 else: 289 raise ValueError , "errToLogX: divide by zero"289 raise ValueError("errToLogX: divide by zero") 290 290 return dx 291 291 … … 294 294 """ 295 295 """ 296 if dx ==None:297 dx = 0 298 if dy ==None:296 if dx is None: 297 dx = 0 298 if dy is None: 299 299 dy = 0 300 300 err = math.sqrt((2 * x * y * dx) ** 2 + ((x ** 2) * dy) ** 2) … … 312 312 msg = "Transformation does not accept point " 313 313 msg += " that are consistent with zero." 314 raise ValueError , msg314 raise ValueError(msg) 315 315 if x != 0 and y != 0: 316 if dx ==None:316 if dx is None: 317 317 dx = 0 318 if dy ==None:318 if dy is None: 319 319 dy = 0 320 320 err = (dx / x) ** 2 + (dy / y) ** 2 321 321 else: 322 raise ValueError , "cannot compute this error"322 raise ValueError("cannot compute this error") 323 323 324 324 return math.sqrt(math.fabs(err)) … … 335 335 msg = "Transformation does not accept point" 336 336 msg += " that are consistent with zero." 337 raise ValueError , msg337 raise ValueError(msg) 338 338 if x > 0 and y > 0: 339 if dx ==None:339 if dx is None: 340 340 dx = 0 341 if dy ==None:341 if dy is None: 342 342 dy = 0 343 343 err = (2.0 * dx / x) ** 2 + (dy / y) ** 2 344 344 else: 345 raise ValueError , "cannot compute this error"345 raise ValueError("cannot compute this error") 346 346 return math.sqrt(math.fabs(err)) 347 347 … … 353 353 """ 354 354 if x != 0: 355 if dx ==None:355 if dx is None: 356 356 dx = 0 357 357 err = dx / x ** 2 358 358 else: 359 raise ValueError , "Cannot compute this error"359 raise ValueError("Cannot compute this error") 360 360 return math.fabs(err) 361 361 … … 367 367 """ 368 368 if x > 0: 369 if dx ==None:369 if dx is None: 370 370 dx = 0 371 371 err = -1 / 2 * math.pow(x, -3.0 / 2.0) * dx 372 372 else: 373 raise ValueError , "Cannot compute this error"373 raise ValueError("Cannot compute this error") 374 374 return math.fabs(err) 375 375 … … 387 387 msg = "Transformation does not accept point " 388 388 msg += " that are consistent with zero." 389 raise ValueError , msg390 if dx ==None:391 dx = 0 392 if dy ==None:389 raise ValueError(msg) 390 if dx is None: 391 dx = 0 392 if dy is None: 393 393 dy = 0 394 394 err = math.sqrt((4.0 * dx / x) ** 2 + (dy / y) ** 2) … … 406 406 # within errors 407 407 408 if dx ==None:409 dx = 0 410 if dy ==None:408 if dx is None: 409 dx = 0 410 if dy is None: 411 411 dy = 0 412 412 err = math.sqrt((dy * pow(x, 4)) ** 2 + (4 * y * dx * math.pow(x, 3)) ** 2)
Note: See TracChangeset
for help on using the changeset viewer.