ukaea / neutronics_material_maker

A tool for making parametric material cards for use in neutronics codes. Original developed for the Paramak
19 stars 10 forks source link

material library access instead of package level access #133

Open eepeterson opened 3 years ago

eepeterson commented 3 years ago

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 commented 3 years ago

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