Issue with fitting data #12

Closed
opened 2020-10-20 10:37:34 +02:00 by usov_i · 1 comment
usov_i commented 2020-10-20 10:37:34 +02:00 (Migrated from gitlab.psi.ch)

Created by: ivan-usov

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:
18ba623fd8/pyzebra/fit2.py (L138)

*Created by: ivan-usov* 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
usov_i commented 2020-10-22 12:08:44 +02:00 (Migrated from gitlab.psi.ch)

Created by: ivan-usov

Fixed in 6722ee601e

*Created by: ivan-usov* Fixed in 6722ee601e925575c8f1e5308a235305ed71f5f1
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: zebra/pyzebra#12
No description provided.