paulscherrerinstitute / pyzebra

GNU General Public License v3.0
3 stars 2 forks source link

Issue with fitting data #12

Closed ivan-usov closed 4 years ago

ivan-usov commented 4 years ago

Trying to fit test data in zebra2020n000039.ccl, measurement 19, yields the following error:

....
  File "/das/home/usov_i/pyzebra/pyzebra/fit2.py", line 135, in fitccl
    fit_area = u.ufloat(result.params["g_amp"].value, result.params["g_amp"].stderr)
  File "/das/work/p15/p15876/miniconda3/envs/pyz/lib/python3.6/site-packages/uncertainties/core.py", line 3274, in ufloat
    final_ufloat = ufloat_obsolete(nominal_value, tag_arg)
  File "/das/work/p15/p15876/miniconda3/envs/pyz/lib/python3.6/site-packages/uncertainties/core.py", line 3217, in ufloat_obsolete
    return ufloat_fromstr(representation, tag)
  File "/das/work/p15/p15876/miniconda3/envs/pyz/lib/python3.6/site-packages/uncertainties/core.py", line 3201, in ufloat_fromstr
    representation.strip())
AttributeError: 'numpy.float64' object has no attribute 'strip'

Checking the values in result shows that result.params["g_amp"].stderr is None, which causes an exception in u.ufloat.

Probably, the order of code needs an adjustment, because right after there is the check for result.params["g_amp"].stderr being None: https://github.com/paulscherrerinstitute/pyzebra/blob/18ba623fd84d8f9707886e8d7b6a5868e14337b5/pyzebra/fit2.py#L138

ivan-usov commented 4 years ago

Fixed in 6722ee601e925575c8f1e5308a235305ed71f5f1