Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'energy' during restore_energy(orientation, diffractometer) #216

Closed
prjemian opened this issue Jun 2, 2022 · 6 comments · Fixed by #241
Closed

KeyError: 'energy' during restore_energy(orientation, diffractometer) #216

prjemian opened this issue Jun 2, 2022 · 6 comments · Fixed by #241
Assignees
Labels
Milestone

Comments

@prjemian
Copy link
Contributor

prjemian commented Jun 2, 2022

@gfabbris reported was raised KeyError: 'energy' by this sequence:

orientation = run_orientation_info(cat[63])["fourc"]
restore_energy(orientation, diffractometer)

On inspection of the orientation object, the energy key is missing:

In [23]: orientation
Out[23]: 
{'energy_units': 'keV',
 'energy_offset': 0,
 'geometry_name': 'E4CV',
 'class_name': 'FourCircleDiffractometer',
 'sample_name': 'Na2IrO3',

The diffractometer was configured with fourc.energy.kind = "omitted".

@prjemian prjemian added the bug label Jun 2, 2022
@prjemian prjemian added this to the v1.1 milestone Jun 2, 2022
@prjemian prjemian self-assigned this Jun 2, 2022
@prjemian
Copy link
Contributor Author

prjemian commented Jun 2, 2022

Should hklpy ignore the .kind? Or should the user suffer the consequences of this unplanned setting?

@prjemian
Copy link
Contributor Author

prjemian commented Jun 2, 2022

Might be trickier than it seems to ignore the .kind setting. At this time, we put the orientation information in the primary stream, in the configuration.

hklpy/hkl/util.py

Lines 300 to 303 in c99a17d

run_conf = run.primary.config
for device in sorted(run_conf):
conf = run_conf[device].read()
if f"{device}_orientation_attrs" in conf:

@prjemian
Copy link
Contributor Author

prjemian commented Jun 2, 2022

Maybe this means we should reconsider how to store the orientation so that the details are secure against this type of reconfiguration.

@prjemian
Copy link
Contributor Author

prjemian commented Jun 2, 2022

Should be considered with #189.

@prjemian
Copy link
Contributor Author

hkl.util.list_orientation_runs(cat) can take a long time for large catalogs. Add a progress bar?

@prjemian
Copy link
Contributor Author

For now, raise an error when a key is missing.

prjemian added a commit that referenced this issue Jun 22, 2022
prjemian added a commit that referenced this issue Jun 22, 2022
@prjemian prjemian modified the milestones: v1.2, v1.1 Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant