-
Notifications
You must be signed in to change notification settings - Fork 62
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
Jupyter example how to export groups to an Athena project and a Larix file #496
Comments
@newville I have seen 430603d, thanks for including such example, it is great, but what I was looking for is an example how to initialize a Larix session programmatically without the GUI, add groups to it and then save to a |
@maurov Yep, I understand, just have not gotten that done yet. But also, if you look at that example and the Making a session by hand would "just be" creating a "config" section, a "command history" section (that could be empty) and then a "symbol table" - a Group of datasets and Groups, and with the important For Larix to be able to work with a Group, it is probably important to check that it has arrays called "xdat", "ydat", "energy" and "mu". It might also assume some other data that normally would be generated with the "install group" method..... I may have time to work on this today, but I'm not certain. |
@newville thanks for explaining it. This is not urgent, so I propose to postpone this to later release. |
@newville I am having hard time to correctly read Athena project files (in Larix or via Here a minimal/conceptual example to show what I am doing: #to write
apj = AthenaProject(fname_out)
for something in my_list_of_data:
g = Group(
gname = "my_group_name_that_can_be_a_long_string_but_UNIQUE_123"
id=gname,
name=gname,
groupname=gname,
filename=gname,
xdat=my_energy_array
ydat=my_mu_array
energy=my_energy_array
mu=my_mu_array
datatype='xas')
apj.add_group(g)
apj.save()
#to read back
prj = read_athena(fname_out)
print(prj.groups.keys())
#sometimes like: dict_keys(['fhigt', 'quxkx', 'gamrg', 'rbqec', 'upiyt']) Do you have a recommendation how to correctly write groups to an Athena project file programmatically in order that they will be correctly read back by Larix, avoiding the hash key names? I think it would be much easier if a group could have only |
@maurov Hmm, I'm not 100% certain. A five-letter random string is assigned to each dataset in an Athena Project. That hash key is how Athena keys the data, so that's needed to have Athena reliably read these files. Athena also keeps a long dictionary of attributes. One of these is called "label". But here is the basic route: On saving a Larch group to and Athena file, if the group has a On reading the Athena project, if there is a Well maybe "should" if not "will" ;) The intention is to set group.filename. But something like:
should work. |
@newville thanks for the detailed explanation! Now it is much clear to me. I will use |
For exchanging data with users still working with Athena/Artemis, it would be nice to show how to export groups to an Athena project file programmatically.
Furthermore, we should also show how to create a Larix session and save data in it without the GUI.
The text was updated successfully, but these errors were encountered: