ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change
on this file since baf1ef3 was
f7f6886,
checked in by Gervaise Alina <gervyh@…>, 13 years ago
|
working on batch fit
|
-
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 | |
---|
| 6 | def get_weight(data, is2d, flag=None): |
---|
| 7 | """ |
---|
| 8 | Received flag and compute error on data. |
---|
| 9 | :param flag: flag to transform error of data. |
---|
| 10 | :param is2d: flag to distinguish 1D to 2D Data |
---|
| 11 | """ |
---|
| 12 | weight = None |
---|
| 13 | if is2d: |
---|
| 14 | dy_data = data.err_data |
---|
| 15 | data = data.data |
---|
| 16 | else: |
---|
| 17 | dy_data = data.dy |
---|
| 18 | data = data.y |
---|
| 19 | if flag == 0: |
---|
| 20 | weight = numpy.ones_like(dy_data) |
---|
| 21 | elif flag == 1: |
---|
| 22 | weight = dy_data |
---|
| 23 | elif flag == 2: |
---|
[f7f6886] | 24 | weight = numpy.sqrt(numpy.abs(data)) |
---|
[f7ef313] | 25 | elif flag == 3: |
---|
| 26 | weight = numpy.abs(data) |
---|
| 27 | return weight |
---|
Note: See
TracBrowser
for help on using the repository browser.