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

material library access instead of package level access #133

Open
eepeterson opened this issue Apr 14, 2021 · 1 comment
Open

material library access instead of package level access #133

eepeterson opened this issue Apr 14, 2021 · 1 comment

Comments

@eepeterson
Copy link

There are a couple of simplifications I think that could be made to improve accessing materials. I think if the user wants to access a specific material contained in one of the json files included in the repo they should do so through a class method on Material rather than through the constructor itself. This would more or less work like so:
import neutronics_material_maker as nmm eurofer = nmm.Material.from_library(material_name='eurofer', library='pnnl')
I think this would help make it clear that the material is coming from an external dataset. You could also make the default library='all' which would allow a user to only specify the material_name and search all the libraries by default.

Likewise, I think it would help to create constants in the nmm module like so `nmm.LIBRARIES = {dict with keys as library names and values as dictionaries of materials}.

Methods like nmm.get_available_materials() could be used to return a list of names or something

The last few points here are just thoughts and I'm happy to discuss it more, but the main point is separating the library access and constructor functions.

@shimwell
Copy link
Collaborator

Thanks Ethan, really appreciate the suggestions, it has been a while since this code was refactored and these are really nice suggestions. I shall get them done soon

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