xraypy / xraylarch

Larch: Applications and Python Library for Data Analysis of X-ray Absorption Spectroscopy (XAS, XANES, XAFS, EXAFS), X-ray Fluorescence (XRF) Spectroscopy and Imaging, and more.
https://xraypy.github.io/xraylarch
Other
127 stars 62 forks source link

Standard error is not calculated correctly if non used parameter is added #473

Closed Ameyanagi closed 7 months ago

Ameyanagi commented 8 months ago

@newville

The standard error is not calculated correctly if the non-used parameter is added to the fit.

model:

image

Correct fit with parameters matching with the model:

image

Standard error not correctly calculated when a none used parameter is added:

image
newville commented 8 months ago

@Ameyanagi Thanks - I'll fix this, and to push the "skip unused parameters" from happening in the GUI, when entering Path Parameter expressions to also happening within feffit(), so that unused parameters are skipped.

Ameyanagi commented 8 months ago

Thank you very much.

newville commented 8 months ago

@Ameyanagi I believe this is now fixed in the master branch.

Ameyanagi commented 8 months ago

@newville

I was trying to check the modification (from the master branch), but I couldn't do it because there were some issues in the feffit panel. Were there any changes that prevents auto inclusion of the parameters to the Parameter window?

If I remember correctly, when we include the path to the feff fitting window, the parameters were automatically loaded to the parameters tab. However, this is not happening now, and I couldn't change the setting of the parameters from the parameters tab.

I can look into detail, but I just wanted to know if you also have the same issue that can be resolved easily.

The instruction to reproduce:

  1. load foil
  2. calculate EXAFS
  3. Run calculation from "Browse CIF Structure, Run Feff"
  4. import first path

The parameters not loaded after importing the first path in the feff calculation:

image
newville commented 8 months ago

Hm, that should work... I will try to look at it.

Ameyanagi commented 8 months ago

I will try recreating the environment.

Ameyanagi commented 8 months ago

@newville

I just reinstalled everything and it didn't work out. I need to look into the detail.

At this moment, following error messages comes out when I click on the "Edit Parameters" in the "Parameters" tab. There is something happening in the wxpython, but I am not sure at this moment. I followed the same instruction with the manual, except that I used pip install git+https://github.com/xraypy/xraylarch. I am using M1 mac with x86_64 emulation.

Traceback (most recent call last):
  File "/Users/ryuichi/mambaforge_x86_64/envs/xraylarch/lib/python3.11/site-packages/larch/wxxas/feffit_panel.py", line 494, in onEditParams
    self.feffit_panel.show_subframe('edit_params', EditParamsFrame,
  File "/Users/ryuichi/mambaforge_x86_64/envs/xraylarch/lib/python3.11/site-packages/larch/wxxas/taskpanel.py", line 291, in show_subframe
    self.subframes[name] = frameclass(self, **opts)
                           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ryuichi/mambaforge_x86_64/envs/xraylarch/lib/python3.11/site-packages/larch/wxxas/feffit_panel.py", line 316, in __init__
    self.dvc.EnsureVisible(self.model.GetItem(0))
                           ^^^^^^^^^^^^^^^^^^^^^
wx._core.wxAssertionError: C++ assertion ""row < m_hash.GetCount()"" failed at /Users/runner/miniforge3/conda-bld/wxpython_1689356222433/work/ext/wxWidgets/src/common/datavcmn.cpp(552) in GetItem(): invalid index
newville commented 8 months ago

@Ameyanagi sorry for the trouble, silly mistake, and I think this is fixed now!

Ameyanagi commented 8 months ago

@newville

I confirmed that it is fixed in the master branch. Thank you very much!!

newville commented 7 months ago

OK, fixed in 0.9.73