
Hi Daniel, Not sure if this will help, but I have run into some problems with velocity (due to negative values), so I always make sure to put these two lines at the top of my code (because I am too lazy to check if either/both work): logs = {('gas','velocity_z'):False} ds.field_info['gas','velocity_z'].take_log = False Best, Stephanie -- Dr. Stephanie Tonnesen Associate Research Scientist CCA, Flatiron Institute New York, NY stonnes@gmail.com On Fri, Apr 24, 2020 at 10:13 AM Daniel DeFelippis <dad2183@columbia.edu> wrote:
Hello,
I'm trying to create a projection plot of velocity (e.g. velocity_x) for a halo from IllustrisTNG ('cutout_478037.hdf5' below). I'm using the demeshened version of yt (yt-4.0). When I try to do this it fails with the following error message. This only seems to occur when I try to make a projection of a quantity with positive and negative values. If I instead use 'density' or 'temperature' for example, it works fine. Any suggestions?
Thank you, Daniel
ds = yt.load('cutout_478037.hdf5') yt.ProjectionPlot(ds,'x',('gas','velocity_x'),width=(400,'kpc'))
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) ~/anaconda3/lib/python3.6/site-packages/numpy/core/function_base.py in linspace(start, stop, num, endpoint, retstep, dtype, axis) 116 try: --> 117 num = operator.index(num) 118 except TypeError:
TypeError: 'numpy.float64' object cannot be interpreted as an integer
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last) <ipython-input-21-7770240b54f8> in <module> 1 ds = yt.load('cutout_478037.hdf5') ----> 2 yt.ProjectionPlot(ds,'x',('gas','velocity_x'),width=(400,'kpc')) 3 #slc.save('testplot.pdf') 4 #slc.set_zlim(('gas','radial_velocity'),-200,200) 5 #slc.annotate_title(title)
~/yt/yt/visualization/plot_window.py in __init__(self, ds, axis, fields, center, width, axes_unit, weight_field, max_level, origin, right_handed, fontsize, field_parameters, data_source, method, proj_style, window_size, buff_size, aspect) 1609 PWViewerMPL.__init__(self, proj, bounds, fields=fields, origin=origin, 1610 right_handed=right_handed, fontsize=fontsize, window_size=window_size, -> 1611 aspect=aspect, buff_size=buff_size) 1612 if axes_unit is None: 1613 axes_unit = get_axes_unit(width, ds)
~/yt/yt/visualization/plot_window.py in __init__(self, *args, **kwargs) 780 self._plot_type = kwargs.pop("plot_type") 781 self._splat_color = kwargs.pop("splat_color", None) --> 782 PlotWindow.__init__(self, *args, **kwargs) 783 784 def _setup_origin(self):
~/yt/yt/visualization/plot_window.py in __init__(self, data_source, bounds, buff_size, antialias, periodic, origin, oblique, right_handed, window_size, fields, fontsize, aspect, setup) 215 self._field_transform[field] = linear_transform 216 self.setup_callbacks() --> 217 self._setup_plots() 218 219 def __iter__(self):
~/yt/yt/visualization/plot_window.py in _setup_plots(self) 1066 else: # symlog_transform 1067 flinthresh = 10**np.floor( np.log10( self.plots[f].cb.norm.linthresh ) ) -> 1068 mticks = self.plots[f].image.norm( get_symlog_minorticks(flinthresh, vmin, vmax) ) 1069 self.plots[f].cax.yaxis.set_ticks(mticks, minor=True) 1070 else:
~/yt/yt/visualization/plot_container.py in get_symlog_minorticks(linthresh, vmin, vmax) 129 return np.hstack((-get_log_minorticks(linthresh,-vmin)[::-1], 0) ) 130 else: --> 131 return np.hstack((-get_log_minorticks(linthresh,-vmin)[::-1], 0, 132 get_log_minorticks(linthresh, vmax))) 133
~/yt/yt/visualization/plot_container.py in get_log_minorticks(vmin, vmax) 105 expA += 1 106 else: --> 107 lmticks = np.hstack( (lmticks, np.linspace(cofA, cofB, cofB-cofA+1)*10**expA) ) 108 expA += 1 109 return np.array(lmticks)
<__array_function__ internals> in linspace(*args, **kwargs)
~/anaconda3/lib/python3.6/site-packages/numpy/core/function_base.py in linspace(start, stop, num, endpoint, retstep, dtype, axis) 119 raise TypeError( 120 "object of type {} cannot be safely interpreted as an integer." --> 121 .format(type(num))) 122 123 if num < 0:
TypeError: object of type <class 'numpy.float64'> cannot be safely interpreted as an integer. _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org