Closed celiotine closed 2 months ago
Here is an example of the POSYDONError output if error_checking_verbose = True
(set in the BinaryPopulation kwargs). These errors are written to the error file if running on a cluster:
Traceback (most recent call last):
File "/home/cel2717/.conda/envs/posydon-source/lib/python3.11/site-packages/posydon/popsyn/binarypopulation.py", line 293, in _safe_evolve
binary.evolve()
File "/home/cel2717/.conda/envs/posydon-source/lib/python3.11/site-packages/posydon/binary_evol/binarystar.py", line 208, in evolve
self.run_step()
File "/home/cel2717/.conda/envs/posydon-source/lib/python3.11/site-packages/posydon/binary_evol/binarystar.py", line 239, in run_step
next_step(self)
File "/home/cel2717/.conda/envs/posydon-source/lib/python3.11/site-packages/posydon/binary_evol/MESA/step_mesa.py", line 1420, in __call__
raise GridError('CO_HMS_RLO binary outside grid and coming from detached')
posydon.utils.posydonerror.GridError:
CO_HMS_RLO binary outside grid and coming from detached
Failed Binary Initial Conditions:
S1 mass: 8.295469052017607
S2 mass: 6.835704315429796
S1 state: H-rich_Core_H_burning
S2 state: H-rich_Core_H_burning
orbital period: 2.291721595471205
eccentricity: 0.0
binary state: detached
binary event: detached
S1 natal kick array: [None, None, None, None]
S2 natal kick array: [None, None, None, None]
The "failed binary initial conditions" provide all information needed to re-run the binary individually in a notebook and reproduce the corresponding error, which is especially helpful for debugging.
NOTE: for all errors that are not POSYDONErrors, error output in this format will always be written to the error file, even if error_checking_verbose = False
.
We have added a POSYDONError module into the utils directory. This module exists to except errors that arise due to the limitations of POSYDON, e.g. numerical errors, grid matching errors, etc.
We have also changed the method of excepting errors when running BinaryPopulation. Now, all errors that are thrown in the POSYDONError category are "silently" excepted, unless the user designates they want to print the errors and failed binary initial conditions through the "error_checking_verbose" input parameter (added to the BinaryPopulation kwargs). For all errors that are not POSYDONErrors, the traceback and binary initial conditions are automatically printed, as these errors arise from "real" bugs in the code and should be addressed.
We have gone through most code files related to evolving a binary population and have preemptively changed all raised errors to POSYDONErrors, if appropriate.
We note that developers can and should add POSYDONErrors to parts of the code they deem relevant, as we have currently implemented this functionality for error checking in BinaryPopulation, but not, for example, the post processing. In addition, if developers feel a raised error should be changed to/from a POSYDONError, they should do so accordingly.