-
Notifications
You must be signed in to change notification settings - Fork 13
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
Uncaught iterator error in Fill #601
Comments
I found the issue: the issue is when the input is underdefined. in [7]: import montepy
In [8]: cell = montepy.Cell("1 0 2 fill=0:1 0:1 0:2 1")
---------------------------------------------------------------------------
StopIteration Traceback (most recent call last)
Cell In[8], line 1
----> 1 cell = montepy.Cell("1 0 2 fill=0:1 0:1 0:2 1")
File ~/mambaforge/lib/python3.12/site-packages/montepy/mcnp_object.py:51, in _ExceptionContextAdder._wrap_attr_call.<locals>.wrapped(*args, **kwargs)
49 self._handling_exception = True
50 try:
---> 51 add_line_number_to_exception(e, self)
52 finally:
53 del self._handling_exception
File ~/mambaforge/lib/python3.12/site-packages/montepy/errors.py:227, in add_line_number_to_exception(error, broken_robot)
225 # avoid calling this n times recursively
226 if hasattr(error, "montepy_handled"):
--> 227 raise error
228 error.montepy_handled = True
229 args = error.args
File ~/mambaforge/lib/python3.12/site-packages/montepy/mcnp_object.py:43, in _ExceptionContextAdder._wrap_attr_call.<locals>.wrapped(*args, **kwargs)
40 @functools.wraps(func)
41 def wrapped(*args, **kwargs):
42 try:
---> 43 return func(*args, **kwargs)
44 except Exception as e:
45 if len(args) > 0 and isinstance(args[0], MCNP_Object):
File ~/mambaforge/lib/python3.12/site-packages/montepy/cell.py:146, in Cell.__init__(self, input, number)
144 self._is_atom_dens = not self._density_node.is_negative
145 self._parse_geometry()
--> 146 self._parse_keyword_modifiers()
File ~/mambaforge/lib/python3.12/site-packages/montepy/mcnp_object.py:51, in _ExceptionContextAdder._wrap_attr_call.<locals>.wrapped(*args, **kwargs)
49 self._handling_exception = True
50 try:
---> 51 add_line_number_to_exception(e, self)
52 finally:
53 del self._handling_exception
File ~/mambaforge/lib/python3.12/site-packages/montepy/errors.py:227, in add_line_number_to_exception(error, broken_robot)
225 # avoid calling this n times recursively
226 if hasattr(error, "montepy_handled"):
--> 227 raise error
228 error.montepy_handled = True
229 args = error.args
File ~/mambaforge/lib/python3.12/site-packages/montepy/mcnp_object.py:43, in _ExceptionContextAdder._wrap_attr_call.<locals>.wrapped(*args, **kwargs)
40 @functools.wraps(func)
41 def wrapped(*args, **kwargs):
42 try:
---> 43 return func(*args, **kwargs)
44 except Exception as e:
45 if len(args) > 0 and isinstance(args[0], MCNP_Object):
File ~/mambaforge/lib/python3.12/site-packages/montepy/cell.py:166, in Cell._parse_keyword_modifiers(self)
164 key = str(value["classifier"]).lower()
165 found_class_prefixes.add(value["classifier"].prefix.value.lower())
--> 166 input = input_class(in_cell_block=True, key=key, value=value)
167 if not getattr(self, attr).set_in_cell_block:
168 setattr(self, attr, input)
File ~/mambaforge/lib/python3.12/site-packages/montepy/mcnp_object.py:51, in _ExceptionContextAdder._wrap_attr_call.<locals>.wrapped(*args, **kwargs)
49 self._handling_exception = True
50 try:
---> 51 add_line_number_to_exception(e, self)
52 finally:
53 del self._handling_exception
File ~/mambaforge/lib/python3.12/site-packages/montepy/errors.py:227, in add_line_number_to_exception(error, broken_robot)
225 # avoid calling this n times recursively
226 if hasattr(error, "montepy_handled"):
--> 227 raise error
228 error.montepy_handled = True
229 args = error.args
File ~/mambaforge/lib/python3.12/site-packages/montepy/mcnp_object.py:43, in _ExceptionContextAdder._wrap_attr_call.<locals>.wrapped(*args, **kwargs)
40 @functools.wraps(func)
41 def wrapped(*args, **kwargs):
42 try:
---> 43 return func(*args, **kwargs)
44 except Exception as e:
45 if len(args) > 0 and isinstance(args[0], MCNP_Object):
File ~/mambaforge/lib/python3.12/site-packages/montepy/data_inputs/fill.py:51, in Fill.__init__(self, input, in_cell_block, key, value)
49 if self.in_cell_block:
50 if key:
---> 51 self._parse_cell_input(key, value)
52 elif input:
53 self._old_numbers = []
File ~/mambaforge/lib/python3.12/site-packages/montepy/mcnp_object.py:51, in _ExceptionContextAdder._wrap_attr_call.<locals>.wrapped(*args, **kwargs)
49 self._handling_exception = True
50 try:
---> 51 add_line_number_to_exception(e, self)
52 finally:
53 del self._handling_exception
File ~/mambaforge/lib/python3.12/site-packages/montepy/errors.py:227, in add_line_number_to_exception(error, broken_robot)
225 # avoid calling this n times recursively
226 if hasattr(error, "montepy_handled"):
--> 227 raise error
228 error.montepy_handled = True
229 args = error.args
File ~/mambaforge/lib/python3.12/site-packages/montepy/mcnp_object.py:43, in _ExceptionContextAdder._wrap_attr_call.<locals>.wrapped(*args, **kwargs)
40 @functools.wraps(func)
41 def wrapped(*args, **kwargs):
42 try:
---> 43 return func(*args, **kwargs)
44 except Exception as e:
45 if len(args) > 0 and isinstance(args[0], MCNP_Object):
File ~/mambaforge/lib/python3.12/site-packages/montepy/data_inputs/fill.py:150, in Fill._parse_cell_input(self, key, value)
147 self._hidden_transform = True
149 else:
--> 150 get_universe(value)
File ~/mambaforge/lib/python3.12/site-packages/montepy/data_inputs/fill.py:98, in Fill._parse_cell_input.<locals>.get_universe(value)
96 def get_universe(value):
97 if ":" in value["data"].nodes:
---> 98 self._parse_matrix(value)
99 else:
100 data = value["data"]
File ~/mambaforge/lib/python3.12/site-packages/montepy/mcnp_object.py:51, in _ExceptionContextAdder._wrap_attr_call.<locals>.wrapped(*args, **kwargs)
49 self._handling_exception = True
50 try:
---> 51 add_line_number_to_exception(e, self)
52 finally:
53 del self._handling_exception
File ~/mambaforge/lib/python3.12/site-packages/montepy/errors.py:251, in add_line_number_to_exception(error, broken_robot)
249 args = (message,) + args[1:]
250 error.args = args
--> 251 raise error.with_traceback(trace)
File ~/mambaforge/lib/python3.12/site-packages/montepy/mcnp_object.py:43, in _ExceptionContextAdder._wrap_attr_call.<locals>.wrapped(*args, **kwargs)
40 @functools.wraps(func)
41 def wrapped(*args, **kwargs):
42 try:
---> 43 return func(*args, **kwargs)
44 except Exception as e:
45 if len(args) > 0 and isinstance(args[0], MCNP_Object):
File ~/mambaforge/lib/python3.12/site-packages/montepy/data_inputs/fill.py:193, in Fill._parse_matrix(self, value)
191 for j in self._axis_range(1):
192 for k in self._axis_range(2):
--> 193 val = next(words)
194 try:
195 val._convert_to_int()
StopIteration:
Error came from Fill: Universe: None, transform: None from an unknown file. So really this exception just needs to be caught and then re-raise as a |
The plot thickens. I don't believe you need to specify every universe in the matrix. See section 5.5.5.3.1 of the 6.3.1 manual. The multi-universe fill is given by:
I think this means you can underspecify all matrix components. Am I right @tjlaboss. |
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
A short code snippet of what you have ran. Please change or remove any specific values or anything that can't be public. For example:
Error Message (if any)
If an error message was printed please include the entire stacktrace. If it includes any specific values please change or remove them. For example:
MCNP input file snippet
MWE in progresssee belowVersion
The text was updated successfully, but these errors were encountered: