Last change
on this file since 6af411b was
d85c194,
checked in by Piotr Rozyczko <piotr.rozyczko@…>, 9 years ago
|
Remaining modules refactored
|
-
Property mode set to
100644
|
File size:
694 bytes
|
Rev | Line | |
---|
[f7ef313] | 1 | """ |
---|
| 2 | Module contains functions frequently used in this package |
---|
| 3 | """ |
---|
| 4 | import numpy |
---|
| 5 | |
---|
[f32d144] | 6 | |
---|
[f7ef313] | 7 | def get_weight(data, is2d, flag=None): |
---|
| 8 | """ |
---|
| 9 | Received flag and compute error on data. |
---|
| 10 | :param flag: flag to transform error of data. |
---|
| 11 | :param is2d: flag to distinguish 1D to 2D Data |
---|
| 12 | """ |
---|
| 13 | weight = None |
---|
| 14 | if is2d: |
---|
[f32d144] | 15 | dy_data = data.err_data |
---|
[f7ef313] | 16 | data = data.data |
---|
| 17 | else: |
---|
| 18 | dy_data = data.dy |
---|
| 19 | data = data.y |
---|
| 20 | if flag == 0: |
---|
[7ee79cb] | 21 | weight = numpy.ones_like(data) |
---|
[f7ef313] | 22 | elif flag == 1: |
---|
| 23 | weight = dy_data |
---|
| 24 | elif flag == 2: |
---|
[f7f6886] | 25 | weight = numpy.sqrt(numpy.abs(data)) |
---|
[f7ef313] | 26 | elif flag == 3: |
---|
| 27 | weight = numpy.abs(data) |
---|
[f32d144] | 28 | return weight |
---|
Note: See
TracBrowser
for help on using the repository browser.