source: sasview/src/examples/data_generator/test_transfo.py @ f4e2f22

magnetic_scattrelease-4.2.2ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249unittest-saveload
Last change on this file since f4e2f22 was 959eb01, checked in by ajj, 8 years ago

normalising line endings

  • Property mode set to 100644
File size: 940 bytes
RevLine 
[959eb01]1import math
2
3# log(x)
4def from_log10(x, y=0):
5    return math.pow(10.0, x)
6def err_log10(x, y, dx, dy):
7    return math.pow(10.0, x)*dx
8
9# ln(x)
10def from_lnx(x, y=0):
11    return math.exp(x)
12def err_lnx(x, y, dx, dy):
13    return math.exp(x)*dx
14
15# x^2
16def from_x2(x, y=0):
17    return math.sqrt(x)
18def err_x2(x, y, dx, dy):
19    return 0.5*dx/math.sqrt(x)
20
21# 1/x
22def from_inv_x(x, y=0):
23    return 1.0/x
24def err_inv_x(x, y, dx, dy):
25    return 1.0/(x**2)*dx
26
27# 1/sqrt(y)
28def from_inv_sqrtx(x, y=0):
29    return 1.0/x**2
30def err_inv_sqrtx(x, y, dx, dy):
31    return 2.0*math.pow(x,-3.0)*dx
32
33# ln(xy)
34def from_lnxy(x, y):
35    return math.exp(x)/y
36def err_lnxy(x, y, dx, dy):
37    return math.exp(x)/y*dx
38
39# ln(xy2)
40def from_lnx2y(x, y):
41    return math.exp(x)/y**2
42def err_lnx2y(x, y, dx, dy):
43    return math.exp(x)/y**2*dx
44
45# ln(xy4)
46def from_lnx4y(x, y):
47    return math.exp(x)/y**4
48def err_lnx4y(x, y, dx, dy):
49    return math.exp(x)/y**4*dx
50
Note: See TracBrowser for help on using the repository browser.