Hi all, I'm trying to write a simple piece of code which produces a phase plot of the entire dataset. I'm currently using yt version 3.5.0 and Python version 3.7.1. Essentially what I have is: val, loc = ds.find_max('density') ad = ds.all_data() plot = yt.PhasePlot(ad, "density", "temperature", "cell_mass", weight_field=None) plot.set_unit('cell_mass', 'Msun') filename = "phase_plot_z={:.2f}.png".format(ds.current_redshift) plot.save(filename) However when I try running the code I get the following error: Traceback (most recent call last): File "phase_plot.py", line 14, in <module> plot = yt.PhasePlot(ad, "density", "temperature", "cell_mass", weight_field=None) File "/opt/apps/yt/jan19/lib/python3.7/site-packages/yt/visualization/profile_plotter.py", line 931, in __init__ fractional=fractional) File "/opt/apps/yt/jan19/lib/python3.7/site-packages/yt/data_objects/profiles.py", line 1207, in create_profile obj.add_fields([field for field in fields]) File "/opt/apps/yt/jan19/lib/python3.7/site-packages/yt/data_objects/profiles.py", line 129, in add_fields self._bin_chunk(chunk, fields, temp_storage) File "/opt/apps/yt/jan19/lib/python3.7/site-packages/yt/data_objects/profiles.py", line 627, in _bin_chunk bin_ind_y = np.digitize(bf_y, self.y_bins) - 1 ValueError: bins must be monotonically increasing or decreasing I'm not entirely sure what's happening since there's no part of the code which is interfacing with binning directly. Any light shed on this issue would be much appreciated. Many thanks, Sam Patrick
Hi Sam, That's because this error is caused by yt doing something incorrect when interfacing with NumPy internally. Whenever yt raises a mysterious exception like this from something its doing internally it's almost certainly due to a bug in yt or yt failing to convert the internal error into a more understandable user-facing error. First, try updating yt, the newest version is 3.5.1 and it's possible that your issue has already been fixed. If that doesn't work, can you make a full runnable example that triggers this issue? If you can, use one of the public test datasets on yt-project.org/data but if its somehow related to properties of the data you are working with, you can share a dataset using the "yt upload" subcommand: $ yt upload some_file.tar.gz That will print out a URL you can share once its done uploading. Once you have that you should open a bug report on yt's github including the full example that triggers the issue: https://github.com/yt-project.org/yt/issues/new Best, Nathan On Wed, Jun 12, 2019 at 9:55 AM Sam Patrick via yt-users < yt-users@python.org> wrote:
Hi all,
I'm trying to write a simple piece of code which produces a phase plot of the entire dataset. I'm currently using yt version 3.5.0 and Python version 3.7.1. Essentially what I have is:
val, loc = ds.find_max('density') ad = ds.all_data() plot = yt.PhasePlot(ad, "density", "temperature", "cell_mass", weight_field=None) plot.set_unit('cell_mass', 'Msun') filename = "phase_plot_z={:.2f}.png".format(ds.current_redshift) plot.save(filename)
However when I try running the code I get the following error:
Traceback (most recent call last): File "phase_plot.py", line 14, in <module> plot = yt.PhasePlot(ad, "density", "temperature", "cell_mass", weight_field=None) File "/opt/apps/yt/jan19/lib/python3.7/site-packages/yt/visualization/profile_plotter.py",
line 931, in __init__ fractional=fractional) File "/opt/apps/yt/jan19/lib/python3.7/site-packages/yt/data_objects/profiles.py",
line 1207, in create_profile obj.add_fields([field for field in fields]) File "/opt/apps/yt/jan19/lib/python3.7/site-packages/yt/data_objects/profiles.py",
line 129, in add_fields self._bin_chunk(chunk, fields, temp_storage) File "/opt/apps/yt/jan19/lib/python3.7/site-packages/yt/data_objects/profiles.py",
line 627, in _bin_chunk bin_ind_y = np.digitize(bf_y, self.y_bins) - 1 ValueError: bins must be monotonically increasing or decreasing
I'm not entirely sure what's happening since there's no part of the code which is interfacing with binning directly. Any light shed 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
participants (2)
-
Nathan Goldbaum
-
Sam Patrick