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

Add command for init a new Larix session #524

Open
maurov opened this issue Jul 18, 2024 · 2 comments
Open

Add command for init a new Larix session #524

maurov opened this issue Jul 18, 2024 · 2 comments

Comments

@maurov
Copy link
Member

maurov commented Jul 18, 2024

Originally posted by @newville in #496 (comment)

@maurov Yep, I understand, just have not gotten that done yet. But also, if you look at that example and the save_session code at https://github.com/xraypy/xraylarch/blob/master/larch/io/save_restore.py#L69. it is probably not that hard, though maybe we want to break that function apart.

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 _xasgroups group for Larix to map "displayed file name" to "group name". And then using the "encode4js" function as in save_session. Again, we could think about breaking that up so it did not assume a Larch session. For example, currently "Sesssion" is just a namedtuple, but it could be turned into a class with load/save methods.

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
Copy link
Member

@maurov Yeah, sorry, I should have updated #496.

I added arguments to larch.io.save_session() (https://github.com/xraypy/xraylarch/blob/master/larch/io/save_restore.py#L69)
to give a limited list of "symbols", and also to modify the history buffer. There is an auto_xasgroups to create a corresponding _xasgroups dict: Groups that have both a "filename" (the string to display as "this data set") and "groupname" (the name of the Python object), will then be included (_xasgroups being {filename: groupname}).

I really wanted to get a release out (it's been too long, but things are very busy at the beamlines this month), but the plan here is to be able to save Partial Sessions, especially for auto-generating scripts and Jupyter Notebooks. That is, the hard part of "we did Feffit/Pre-edge Peak Fit/etc, now save a Jupyter Notebook" is actually "where did the data come from.
And, I think that for the Jupyter Notebooks, if there is a cell that is "read the data into a group and do the processing to get chi(k)/Normalized Mu(E)/etc", that we can separately document/show how to do that, but have the auto-generated notebooks save a corresponding mini-session ".larix" file, and then read from that.

Also: for separating XAS and "Raw Data", I renamed that "XY Data", and most of the code is refactored from "xdat/ydat" to "xplot/yplot" (because most parts of the code use those only for plotting). It took a while to get that refactoring stable, and I did a lot of testing by hand. I think I tested all the panels, but I probably missed something.

Also: I did a lot of testing with Linux with Gtk3. The GUI layouts needed a lot of tweaking for font sizes and "up/down" buttons for numbers. These now look much better for me (Redhat 9), but let me know if you see issues.

Does that all seem OK to you??

Also, I think the Larch developer's meetings are on Summer Vacation (and APS-upgrade panic). Do you agree? But, if you want to chat, let me know!

@maurov
Copy link
Member Author

maurov commented Jul 18, 2024

@newville thanks for the update and the latest release. Everything seems OK to me, it is great, thanks! I was just doing some cleaning of the open issues, otherwise I get lost. We will further discuss after summer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants