-
Notifications
You must be signed in to change notification settings - Fork 18
Closed
Labels
feature requestAn issue that improves the user interface.An issue that improves the user interface.
Milestone
Description
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
"I'm always frustrated when" I want to instantiate an Isotope, but have to remember that it lives at montepy.data_inputs.isotope.Isotope. It should be a top-level object.
Also annoying is that the representation uses the "Element-Z" convention, but instantiation has to use ZAID.
Example
>>> montepy.data_inputs.isotope.Isotope("1001.00c")
Isotope('H-1.00c')
>>> Isotope('H-1.00c')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'Isotope' is not defined
>>> montepy.data_inputs.isotope.Isotope("H-1.00c")
Traceback (most recent call last):
File "montepy/data_inputs/isotope.py", line 34, in __init__
int(parts[0])
ValueError: invalid literal for int() with base 10: 'H-1'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "montepy/data_inputs/isotope.py", line 36, in __init__
raise ValueError(f"ZAID: {ZAID} could not be parsed as a valid isotope")
ValueError: ZAID: H-1.00c could not be parsed as a valid isotopeDescribe the solution you'd like
- Import the
Isotopeclass into the top-level namespace, in montepy/init.py - Allow instantiation from, e.g.,
montepy.Isotope("H-1.00c"),montepy.Isotope("H1.01c"), etc.
Additional context
Someone changed the repr in #473, but didn't bother to update __init__ accordingly.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
feature requestAn issue that improves the user interface.An issue that improves the user interface.