Error initializing simulation with times
Hello, I've run into a problem when trying to initialize a simulation object with a start time and finish time. My code is: import yt from yt.units import Myr simulation = yt.simulation("DD0005/output_0005", 'Enzo') simulation.get_time_series(initial_time= 284.098 * Myr, final_time= 284.292 * Myr, redshift_data=False) Trying to run this script results in the following error: Traceback (most recent call last): File "mini_test.py", line 5, in <module> simulation.get_time_series(initial_time= 284.098 * Myr, final_time= 284.292 * Myr, redshift_data=False) File "/opt/apps/pkgs/cpython/3.7.1/intel64/intel_2019.2/lib/python3.7/site-packages/yt/frontends/enzo/simulation_handling.py", line 292, in get_time_series my_initial_time.convert_to_units("s") UnboundLocalError: local variable 'my_initial_time' referenced before assignment Any help on this issue would be much appreciated. Many thanks, Sam Patrick
Hi Sam, it was a bug. I filed https://github.com/yt-project/yt/issues/2578 to track it and there's a corresponding fix here: https://github.com/yt-project/yt/pull/2579. If you cannot apply that patch locally to the yt installation on that machine (e.g. it's a cluster administered by someone else), I'm afraid you'll have to install a development version of yt and pull that change. Cheers, Kacper On 5/5/20 11:15 AM, Sam Patrick via yt-users wrote:
Hello,
I've run into a problem when trying to initialize a simulation object with a start time and finish time. My code is:
import yt from yt.units import Myr
simulation = yt.simulation("DD0005/output_0005", 'Enzo') simulation.get_time_series(initial_time= 284.098 * Myr, final_time= 284.292 * Myr, redshift_data=False)
Trying to run this script results in the following error:
Traceback (most recent call last): File "mini_test.py", line 5, in <module> simulation.get_time_series(initial_time= 284.098 * Myr, final_time= 284.292 * Myr, redshift_data=False) File "/opt/apps/pkgs/cpython/3.7.1/intel64/intel_2019.2/lib/python3.7/site-packages/yt/frontends/enzo/simulation_handling.py", line 292, in get_time_series my_initial_time.convert_to_units("s") UnboundLocalError: local variable 'my_initial_time' referenced before assignment
Any help on this issue would be much appreciated.
Many thanks, Sam Patrick _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org https://mail.python.org/mailman3/lists/yt-users.python.org/ Member address: xarthisius.kk@gmail.com
participants (2)
-
Kacper Kowalik
-
Sam Patrick