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
MIT License
138 stars 68 forks source link

Bm16 bliss update #501

Closed maurov closed 8 months ago

maurov commented 8 months ago

Update for reading BLISS files from ESRF/BM16

maurov commented 8 months ago

@newville this mainly handles the case when some of the Y arrays do not have the same size of the X array. I think it is safe to merge. It would be great if you could have a quick check too.

This said, I get an error with the GUI after loading the data that I do not know how to solve. Here the trace:

Traceback (most recent call last):
  File "/home/opd16/devel/xraylarch/larch/wxlib/specfile_importer.py", line 547, in onOK
    self.read_ok_cb(script, self.path, scanlist,
  File "/home/opd16/devel/xraylarch/larch/wxxas/xasgui.py", line 1246, in onReadSpecfile_OK
    dgroup = self.install_group(gname, displayname, journal=jrnl)
  File "/home/opd16/devel/xraylarch/larch/wxxas/xasgui.py", line 1582, in install_group
    self.ShowFile(groupname=groupname, filename=filename,
  File "/home/opd16/devel/xraylarch/larch/wxxas/xasgui.py", line 459, in ShowFile
    self.process_normalization(dgroup, force=True, use_form=False)
  File "/home/opd16/devel/xraylarch/larch/wxxas/xasgui.py", line 397, in process_normalization
    self.get_nbpage('xasnorm')[1].process(dgroup, force=force, use_form=use_form)
  File "/home/opd16/devel/xraylarch/larch/wxxas/xasnorm_panel.py", line 937, in process
    copts.append(fmt % (attr, form[attr]))
TypeError: %d format: a number is required, not str
Encode Warning: generic object dump for  <larch.io.specfile_reader.DataSourceSpecH5 object at 0x7f630062a820>
Traceback (most recent call last):
  File "/home/opd16/devel/xraylarch/larch/wxxas/xasgui.py", line 459, in ShowFile
    self.process_normalization(dgroup, force=True, use_form=False)
  File "/home/opd16/devel/xraylarch/larch/wxxas/xasgui.py", line 397, in process_normalization
    self.get_nbpage('xasnorm')[1].process(dgroup, force=force, use_form=use_form)
  File "/home/opd16/devel/xraylarch/larch/wxxas/xasnorm_panel.py", line 937, in process
    copts.append(fmt % (attr, form[attr]))
TypeError: %d format: a number is required, not str

If you have an idea, it would be great, otherwise I still propose to merge this for next release, as it works nicely without the GUI.

newville commented 8 months ago

@maurov this may be fixed in the master branch, though I have not tested with a Bliss file on this branch.

newville commented 8 months ago

@maurov Happy to merge, and hoping the GUI part is fixed (if not, we can address that)