xraypy/xraylarch

`nvict` not saved with other pre-edge attributes

Closed this issue · 2 comments

When calling pre_edge, the settings used (excluding e0 and step/edge_step which are set on the main group) are set as attributes on pre_edge_details:

group.pre_edge_details = Group()
for attr in ('pre1', 'pre2', 'norm1', 'norm2', 'nnorm', 'nvict'):
setattr(group.pre_edge_details, attr, pre_dat.get(attr, None))

If you then save this as an Athena project, the list of keys to save from this group does not include nvict:

bkg_map = dict(nnorm='nnorm', nor1='norm1', nor2='norm2', pre1='pre1',
pre2='pre2')
if hasattr(group, 'pre_edge_details'):
for aname, lname in bkg_map.items():
val = getattr(group.pre_edge_details, lname, None)
if val is not None:
args['bkg_%s' % aname] = val

As a result I do not have a record of the value I used in my Athena project (so it will default to 0, when I would expect to be able to access the old settings like the other attributes in that group) when it gets read (i.e. here or one of the equivalent functions in athena_project.py):

if key.startswith('bkg_'):
setattr(this.athena_params.bkg, key[4:], asfloat(val))

I noticed #449 made reference to nvict not persisting, but that seems to be in a different part of the code base - so potentially not relevant here.

@patrick-austin Ah, thanks -- will fix.

@patrick-austin this is fixed in master. A new release is coming soon.