-
Notifications
You must be signed in to change notification settings - Fork 26
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
A more user friendly initialization method for material.Material objects #561
Comments
I do support a simpler interface. If you have improvements then do submit a PR! I will point you to
|
hmmmmm......... I didn't know about this. I might try wrapping a part of this into a generator. My fear is that drastic changes are going to break some part of HEXRD I am unfamiliar with, and because HEXRD isn't fully covered by tests, It won't be obvious until someone reports some catastrophic break to their pipeline I hadn't considered. My approach would retain all the existing keyword inputs, so it's guaranteed (in theory) not to break anything currently in place. Modeling off the CL version is much nicer though, and having the CL and module methods use identical functions for generation would be a big improvement for maintainable code..... I'll try both ways, see what happens, and start a PR. |
@argerlt I would like to incorporate these changes into our upcoming restructuring of the library. Is this still on your radar? Would like to sync up about it at some point over the migration process. |
@ZackAttack614, Sorry for the slow response. It is, but it took a major back seat to other work. I can submit a PR of how I think such the class should be laid out, and you can keep/toss what you want. Just let me know what branch is best to work off of, in light of the restructuring. Also, if I'm going slow, feel free to lap me and do it yourself, I'm working on finishing my Thesis right now so I'm a bit slow in general. In short though, I think as long as the end result:
I will be happy. |
I had a feature I wanted to add, but I want to make sure it doesn't already exist in a way I don't know about, and possibly have some experts weigh in on what to watch out for so I don't break any important features.
@donald-e-boyce @psavery @saransh13
Elevator Pitch of the Issue:
Allow users to more easily initalize
Material
Class objects without initializing from an h5 or CIF.The method commonly used in example scripts involves creating a default Nickel material, then selectively overwriting the relevant attributes. This requires some a-priori understanding of how the Materials class is organized and calculated in HEXRD, and can occasionally cause program-breaking errors if additional hidden attributes (eg,
PlaneData
andUnitCell
objects) are not also overwritten in the correct order.Longer Description
currently, initializing a material class WITHOUT an already existing hdf5 or cif calls Materials.init with the following defaults:
If users want to create a new material outside of hexrdgui (say, testing a toy problem with randomly generated crystal structures or testing different beam energies), the easiest way is usually:
Often, users will write some variation of a generator function like the one below to automate this:
This works, but it's clunky, and its also alienating to new users who do not know a priori how this function works or how to properly overwrite the correct values.
Synopsis of My Solution:
Instead of 20-odd default values that clutter up the namespace, there should just be a default values dictionary, and users should be able to selectively overwrite the values they want on initialization, as opposed to after the fact. this can be done both through custom dictionaries of changed values, or just by passing in wildcard keywords
Initial rules should stay unchanged: all the same inputs are still allowed, and values taken from a CIF or HDF5 still overwrite defaults. All I want is the ability to pass any of the following single lines and have all of them give a reasonable result
DO NOTE: I am aware now that there are ways to initialize these materials using HEXRD as is, but they are not well documented or intuitive, and they slowed me down a lot while learning. this is less about expanding the capabilities, and more about simplifying the process and adding documentation so new users can have an easier time learning on their own.
The text was updated successfully, but these errors were encountered: