xraypy/xraylarch

[larix] `process_normalization` fails

Closed this issue · 4 comments

@newville

Related to what I was observing in #501, I have tested with the latest master version and I have the same problem with process_normalization when loading files.

With specfile_importer:

  File "/home/mauro/devel/xraylarch/larch/wxlib/specfile_importer.py", line 547, in onOK
    self.read_ok_cb(script, self.path, scanlist,
  File "/home/mauro/devel/xraylarch/larch/wxxas/xasgui.py", line 1266, in onReadSpecfile_OK
    dgroup = self.install_group(gname, displayname, journal=jrnl)
  File "/home/mauro/devel/xraylarch/larch/wxxas/xasgui.py", line 1642, in install_group
    self.ShowFile(groupname=groupname, filename=filename,
  File "/home/mauro/devel/xraylarch/larch/wxxas/xasgui.py", line 460, in ShowFile
    self.process_normalization(dgroup, force=True, use_form=False)
  File "/home/mauro/devel/xraylarch/larch/wxxas/xasgui.py", line 398, in process_normalization
    self.get_nbpage('xasnorm')[1].process(dgroup, force=force, use_form=use_form)
  File "/home/mauro/devel/xraylarch/larch/wxxas/xasnorm_panel.py", line 936, in process
    val = f"{int(form[attr])}"
ValueError: invalid literal for int() with base 10: 'linear'
Encode Warning: generic object dump for  <larch.io.specfile_reader.DataSourceSpecH5 object at 0x7f3ae430b940>

With columnframe:

  File "/home/mauro/devel/xraylarch/larch/wxlib/columnframe.py", line 1127, in onOK
    self.read_ok_cb(script, self.path, conf)
  File "/home/mauro/devel/xraylarch/larch/wxxas/xasgui.py", line 1509, in onRead_OK
    self.install_group(groupname, filename, source=path, journal=journal)
  File "/home/mauro/devel/xraylarch/larch/wxxas/xasgui.py", line 1642, in install_group
    self.ShowFile(groupname=groupname, filename=filename,
  File "/home/mauro/devel/xraylarch/larch/wxxas/xasgui.py", line 460, in ShowFile
    self.process_normalization(dgroup, force=True, use_form=False)
  File "/home/mauro/devel/xraylarch/larch/wxxas/xasgui.py", line 398, in process_normalization
    self.get_nbpage('xasnorm')[1].process(dgroup, force=force, use_form=use_form)
  File "/home/mauro/devel/xraylarch/larch/wxxas/xasnorm_panel.py", line 936, in process
    val = f"{int(form[attr])}"
ValueError: invalid literal for int() with base 10: 'linear'

Do you have an idea why this is happening? I am afraid this should fixed before next release.

@maurov ack, okay, I think this is now fixed... doing a bunch of testing of various inputs now.

@newville thanks for looking into this. I updated to latest master but I still get an error:

Traceback (most recent call last):
  File "/home/mauro/devel/xraylarch/larch/wxxas/xasnorm_panel.py", line 463, in set_nnorm_widget
    nnorm = int(nnorm)
ValueError: invalid literal for int() with base 10: 'linear'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mauro/devel/xraylarch/larch/wxlib/columnframe.py", line 1127, in onOK
    self.read_ok_cb(script, self.path, conf)
  File "/home/mauro/devel/xraylarch/larch/wxxas/xasgui.py", line 1509, in onRead_OK
    self.install_group(groupname, filename, source=path, journal=journal)
  File "/home/mauro/devel/xraylarch/larch/wxxas/xasgui.py", line 1642, in install_group
    self.ShowFile(groupname=groupname, filename=filename,
  File "/home/mauro/devel/xraylarch/larch/wxxas/xasgui.py", line 480, in ShowFile
    cur_panel.fill_form(dgroup)
  File "/home/mauro/devel/xraylarch/larch/wxxas/xasnorm_panel.py", line 421, in fill_form
    self.set_nnorm_widget(opts.get('nnorm'))
  File "/home/mauro/devel/xraylarch/larch/wxxas/xasnorm_panel.py", line 465, in set_nnorm_widget
    nnorm = nnorm_default
UnboundLocalError: local variable 'nnorm_default' referenced before assignment

@maurov Thanks for checking... Can you send an example file? Apparently, I am not triggering those bugs with the files I'm using for testing.

@newville I was checking with the files in examples/xafsdata/beamlines. b577bc6 seems have fixed the problem.