Skip to content

Commit

Permalink
make sure attribute is set when processing XAS data
Browse files Browse the repository at this point in the history
  • Loading branch information
newville committed Aug 6, 2024
1 parent bb3e10b commit 337aba4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 5 additions & 0 deletions larch/wxxas/taskpanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,11 @@ def ensure_xas_processed(self, dgroup):
if self.is_xasgroup(dgroup) and (not hasattr(dgroup, 'norm') or
not hasattr(dgroup, 'e0')):
self.parent.process_normalization(dgroup, force=True)
if not hasattr(dgroup, 'xplot'):
if hasattr(dgroup, 'xdat'):
dgroup.xplot = deepcopy(dgroup.xdat)
elif hasattr(dgroup, 'energy'):
dgroup.xplot = deepcopy(dgroup.energy)

def make_fit_xspace_widgets(self, elo=-1, ehi=1):
self.wids['fitspace_label'] = SimpleText(self.panel, 'Fit Range (eV):')
Expand Down
7 changes: 1 addition & 6 deletions larch/wxxas/xasnorm_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def get_auto_nnorm(norm1, norm2):
if nrange < 30: nnorm = 0
return nnorm


class XASNormPanel(TaskPanel):
"""XAS normalization Panel"""
def __init__(self, parent, controller=None, **kws):
Expand Down Expand Up @@ -1083,11 +1082,7 @@ def plot(self, dgroup, title=None, plot_yarrays=None, yoff=0,
if groupname is None:
return

if not hasattr(dgroup, 'xplot'):
if hasattr(dgroup, 'xdat'):
dgroup.xplot = deepcopy(dgroup.xdat)
elif hasattr(dgroup, 'energy'):
dgroup.xplot = deepcopy(dgroup.energy)
self.ensure_xas_processed(dgroup)

if ((getattr(dgroup, 'plot_yarrays', None) is None or
getattr(dgroup, 'energy', None) is None or
Expand Down

0 comments on commit 337aba4

Please sign in to comment.