Hi yt-users! I have two ProfilePlot issues. I have updated to yt version 3.5 dev0 to try and get the standard_error on a ProfilePlot, but now am running into other problems. Basically, I am trying to get the same result two ways, and have run into two problems. 1) The linewidth call no longer works. This code worked in my old yt version, but now gives me an error unless I take out the linewidth command: profiles = [] labels = [] plot_specs = [] linest = ['-','--','-.','-','--'] cols = ['red','red','red','green','green'] lws = ['2','2','2','2','2'] i =0 while i < len(loop): ds = yt.load("/mnt/ceph/users/stonnesen/data1/"+loopfile[i]+"/DD"+loop[i]+"/"+loopfile[i]+loop[i]) disk = ds.disk([0.5,0.5,0.5],[0,0,-1.0],(40,"kpc"),(2,"kpc")) profiles.append(yt.create_profile( data_source=disk, bin_fields=["radius"], fields=["density"], n_bins=52, units=dict(radius="kpc", density="g/cm**3"), logs=dict(radius=False), weight_field='ones', extrema=dict(radius=(0,40)), )) labels.append("%s" % looptext[i]) plot_specs.append(dict(linestyle=linest[i],linewidth=lws[i],color=cols[i])) i = i+1 plot = yt.ProfilePlot.from_profiles(profiles,labels=labels,plot_specs=plot_specs) plot.set_ylim('density',1e-27,1e-22) plot.save() I get this error: yt : [INFO ] 2017-11-06 16:44:12,585 Gathering a field list (this may take a moment.) Traceback (most recent call last): File "yt_diskprofile_oplotdiffruns.py", line 61, in <module> plot = yt.ProfilePlot.from_profiles(profiles,labels=labels,plot_specs=plot_specs) File "/mnt/home/stonnesen/yt-conda/yt/yt/visualization/profile_plotter.py", line 443, in from_profiles return cls._initialize_instance(obj, profiles, labels, plot_specs, y_log) File "/mnt/home/stonnesen/yt-conda/yt/yt/visualization/profile_plotter.py", line 393, in _initialize_instance obj._setup_plots() File "/mnt/home/stonnesen/yt-conda/yt/yt/visualization/profile_plotter.py", line 355, in _setup_plots label=self.label[i], **self.plot_spec[i]) File "/mnt/xfs1/home/stonnesen/yt-conda/lib/python3.6/site-packages/matplotlib/__init__.py", line 1710, in inner return func(ax, *args, **kwargs) File "/mnt/xfs1/home/stonnesen/yt-conda/lib/python3.6/site-packages/matplotlib/axes/_axes.py", line 1437, in plot for line in self._get_lines(*args, **kwargs): File "/mnt/xfs1/home/stonnesen/yt-conda/lib/python3.6/site-packages/matplotlib/axes/_base.py", line 404, in _grab_next_args for seg in self._plot_args(this, kwargs): File "/mnt/xfs1/home/stonnesen/yt-conda/lib/python3.6/site-packages/matplotlib/axes/_base.py", line 394, in _plot_args seg = func(x[:, j % ncx], y[:, j % ncy], kw, kwargs) File "/mnt/xfs1/home/stonnesen/yt-conda/lib/python3.6/site-packages/matplotlib/axes/_base.py", line 301, in _makeline seg = mlines.Line2D(x, y, **kw) File "/mnt/xfs1/home/stonnesen/yt-conda/lib/python3.6/site-packages/matplotlib/lines.py", line 396, in __init__ self.set_linestyle(linestyle) File "/mnt/xfs1/home/stonnesen/yt-conda/lib/python3.6/site-packages/matplotlib/lines.py", line 1115, in set_linestyle self._us_dashOffset, self._us_dashSeq, self._linewidth) File "/mnt/xfs1/home/stonnesen/yt-conda/lib/python3.6/site-packages/matplotlib/lines.py", line 69, in _scale_dashes scaled_offset = offset * lw TypeError: can't multiply sequence by non-int of type 'float' 2) the plot copying the cookbook example ( http://yt-project.org/doc/cookbook/simple_plots.html?highlight=profileplot%2...) is giving me 0s and nans instead of the correct values: profiles = [] labels = [] plot_specs = [] linest = ['-','--','-.','-','--'] cols = ['red','red','red','green','green'] lw = ['2','2','2','2','2'] i =0 while i < len(loop): ds = yt.load("/mnt/ceph/users/stonnesen/data1/"+loopfile[i]+"/DD"+loop[i]+"/"+loopfile[i]+loop[i]) disk = ds.disk([0.5,0.5,0.5],[0,0,-1.0],(40,"kpc"),(2,"kpc")) prof = yt.create_profile(disk,'radius',('gas','density'), units={'radius':'kpc'}, extrema={'radius':((0.0,'kpc'),(40.0,'kpc'))},weight_field='ones') radius = prof.x mean = prof['gas','density'] std = prof.standard_deviation['gas','density'] plt.semilogy(radius,mean,color=cols[i])#,linewidth=lw[i],linestyle=linest[i]) print (mean) print (radius) labels.append("%s" % looptext[i]) i = i+1 plt.ylim(1e-27,1e-21) plt.xlabel('r (kpc)') plt.ylabel(r'density') plt.legend() plt.savefig('density_profiles_gasmassmatch.png') plt.clf() The mean values are all zero, and the radius values are all nan. The code will finish (unless I use the linewidth command), but of course the plots have nothing on them!! Any ideas for these issues? I would be happy to send my full scripts or output files. Thanks! Stephanie -- Dr. Stephanie Tonnesen Associate Research Scientist CCA, Flatiron Institute New York, NY stonnes@gmail.com
These both sound like bugs. Can you please open two issues on github so we
don't lose track? Please also use datasets from yt-project.org/data or
include links to outputs so we can reproduce the issues locally.
-Nathan
On Mon, Nov 6, 2017 at 3:59 PM, Stephanie Tonnesen
Hi yt-users!
I have two ProfilePlot issues. I have updated to yt version 3.5 dev0 to try and get the standard_error on a ProfilePlot, but now am running into other problems. Basically, I am trying to get the same result two ways, and have run into two problems.
1) The linewidth call no longer works. This code worked in my old yt version, but now gives me an error unless I take out the linewidth command:
profiles = [] labels = [] plot_specs = [] linest = ['-','--','-.','-','--'] cols = ['red','red','red','green','green'] lws = ['2','2','2','2','2']
i =0 while i < len(loop): ds = yt.load("/mnt/ceph/users/stonnesen/data1/"+loopfile[i]+ "/DD"+loop[i]+"/"+loopfile[i]+loop[i]) disk = ds.disk([0.5,0.5,0.5],[0,0,-1.0],(40,"kpc"),(2,"kpc"))
profiles.append(yt.create_profile( data_source=disk, bin_fields=["radius"], fields=["density"], n_bins=52, units=dict(radius="kpc", density="g/cm**3"), logs=dict(radius=False), weight_field='ones', extrema=dict(radius=(0,40)), )) labels.append("%s" % looptext[i]) plot_specs.append(dict(linestyle=linest[i],linewidth= lws[i],color=cols[i]))
i = i+1
plot = yt.ProfilePlot.from_profiles(profiles,labels=labels,plot_ specs=plot_specs) plot.set_ylim('density',1e-27,1e-22) plot.save()
I get this error: yt : [INFO ] 2017-11-06 16:44:12,585 Gathering a field list (this may take a moment.) Traceback (most recent call last): File "yt_diskprofile_oplotdiffruns.py", line 61, in <module> plot = yt.ProfilePlot.from_profiles(profiles,labels=labels,plot_ specs=plot_specs) File "/mnt/home/stonnesen/yt-conda/yt/yt/visualization/profile_plotter.py", line 443, in from_profiles return cls._initialize_instance(obj, profiles, labels, plot_specs, y_log) File "/mnt/home/stonnesen/yt-conda/yt/yt/visualization/profile_plotter.py", line 393, in _initialize_instance obj._setup_plots() File "/mnt/home/stonnesen/yt-conda/yt/yt/visualization/profile_plotter.py", line 355, in _setup_plots label=self.label[i], **self.plot_spec[i]) File "/mnt/xfs1/home/stonnesen/yt-conda/lib/python3.6/site- packages/matplotlib/__init__.py", line 1710, in inner return func(ax, *args, **kwargs) File "/mnt/xfs1/home/stonnesen/yt-conda/lib/python3.6/site- packages/matplotlib/axes/_axes.py", line 1437, in plot for line in self._get_lines(*args, **kwargs): File "/mnt/xfs1/home/stonnesen/yt-conda/lib/python3.6/site- packages/matplotlib/axes/_base.py", line 404, in _grab_next_args for seg in self._plot_args(this, kwargs): File "/mnt/xfs1/home/stonnesen/yt-conda/lib/python3.6/site- packages/matplotlib/axes/_base.py", line 394, in _plot_args seg = func(x[:, j % ncx], y[:, j % ncy], kw, kwargs) File "/mnt/xfs1/home/stonnesen/yt-conda/lib/python3.6/site- packages/matplotlib/axes/_base.py", line 301, in _makeline seg = mlines.Line2D(x, y, **kw) File "/mnt/xfs1/home/stonnesen/yt-conda/lib/python3.6/site-packages/matplotlib/lines.py", line 396, in __init__ self.set_linestyle(linestyle) File "/mnt/xfs1/home/stonnesen/yt-conda/lib/python3.6/site-packages/matplotlib/lines.py", line 1115, in set_linestyle self._us_dashOffset, self._us_dashSeq, self._linewidth) File "/mnt/xfs1/home/stonnesen/yt-conda/lib/python3.6/site-packages/matplotlib/lines.py", line 69, in _scale_dashes scaled_offset = offset * lw TypeError: can't multiply sequence by non-int of type 'float'
2) the plot copying the cookbook example (http://yt-project.org/doc/ cookbook/simple_plots.html?highlight=profileplot%20standard%20deviation) is giving me 0s and nans instead of the correct values:
profiles = [] labels = [] plot_specs = [] linest = ['-','--','-.','-','--'] cols = ['red','red','red','green','green'] lw = ['2','2','2','2','2']
i =0 while i < len(loop): ds = yt.load("/mnt/ceph/users/stonnesen/data1/"+loopfile[i]+ "/DD"+loop[i]+"/"+loopfile[i]+loop[i]) disk = ds.disk([0.5,0.5,0.5],[0,0,-1.0],(40,"kpc"),(2,"kpc"))
prof = yt.create_profile(disk,'radius',('gas','density'), units={'radius':'kpc'}, extrema={'radius':((0.0,'kpc') ,(40.0,'kpc'))},weight_field='ones')
radius = prof.x mean = prof['gas','density'] std = prof.standard_deviation['gas','density'] plt.semilogy(radius,mean,color=cols[i])#,linewidth=lw[ i],linestyle=linest[i]) print (mean) print (radius)
labels.append("%s" % looptext[i]) i = i+1
plt.ylim(1e-27,1e-21) plt.xlabel('r (kpc)') plt.ylabel(r'density') plt.legend() plt.savefig('density_profiles_gasmassmatch.png') plt.clf()
The mean values are all zero, and the radius values are all nan. The code will finish (unless I use the linewidth command), but of course the plots have nothing on them!!
Any ideas for these issues? I would be happy to send my full scripts or output files.
Thanks! Stephanie
-- Dr. Stephanie Tonnesen Associate Research Scientist CCA, Flatiron Institute New York, NY
stonnes@gmail.com
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi Nathan!
Okay, so the linewidth problem is just a small edit: instead of
lw = ['2']
it needs to be set as
lw = [2]
--not sure why that changed, but not a big deal. I can't remember or find
if the first version is in the docs or if I got it some other way.
I have submitted the other issue as a bug report with the working and
failing scripts attached!
Thanks! Best,
Stephanie
--
Dr. Stephanie Tonnesen
Associate Research Scientist
CCA, Flatiron Institute
New York, NY
stonnes@gmail.com
On Mon, Nov 6, 2017 at 5:17 PM, Nathan Goldbaum
These both sound like bugs. Can you please open two issues on github so we don't lose track? Please also use datasets from yt-project.org/data or include links to outputs so we can reproduce the issues locally.
-Nathan
On Mon, Nov 6, 2017 at 3:59 PM, Stephanie Tonnesen
wrote: Hi yt-users!
I have two ProfilePlot issues. I have updated to yt version 3.5 dev0 to try and get the standard_error on a ProfilePlot, but now am running into other problems. Basically, I am trying to get the same result two ways, and have run into two problems.
1) The linewidth call no longer works. This code worked in my old yt version, but now gives me an error unless I take out the linewidth command:
profiles = [] labels = [] plot_specs = [] linest = ['-','--','-.','-','--'] cols = ['red','red','red','green','green'] lws = ['2','2','2','2','2']
i =0 while i < len(loop): ds = yt.load("/mnt/ceph/users/stonnesen/data1/"+loopfile[i]+"/DD" +loop[i]+"/"+loopfile[i]+loop[i]) disk = ds.disk([0.5,0.5,0.5],[0,0,-1.0],(40,"kpc"),(2,"kpc"))
profiles.append(yt.create_profile( data_source=disk, bin_fields=["radius"], fields=["density"], n_bins=52, units=dict(radius="kpc", density="g/cm**3"), logs=dict(radius=False), weight_field='ones', extrema=dict(radius=(0,40)), )) labels.append("%s" % looptext[i]) plot_specs.append(dict(linestyle=linest[i],linewidth=lws[i], color=cols[i]))
i = i+1
plot = yt.ProfilePlot.from_profiles(profiles,labels=labels,plot_spe cs=plot_specs) plot.set_ylim('density',1e-27,1e-22) plot.save()
I get this error: yt : [INFO ] 2017-11-06 16:44:12,585 Gathering a field list (this may take a moment.) Traceback (most recent call last): File "yt_diskprofile_oplotdiffruns.py", line 61, in <module> plot = yt.ProfilePlot.from_profiles(profiles,labels=labels,plot_spe cs=plot_specs) File "/mnt/home/stonnesen/yt-conda/yt/yt/visualization/profile_plotter.py", line 443, in from_profiles return cls._initialize_instance(obj, profiles, labels, plot_specs, y_log) File "/mnt/home/stonnesen/yt-conda/yt/yt/visualization/profile_plotter.py", line 393, in _initialize_instance obj._setup_plots() File "/mnt/home/stonnesen/yt-conda/yt/yt/visualization/profile_plotter.py", line 355, in _setup_plots label=self.label[i], **self.plot_spec[i]) File "/mnt/xfs1/home/stonnesen/yt-conda/lib/python3.6/site-packages/matplotlib/__init__.py", line 1710, in inner return func(ax, *args, **kwargs) File "/mnt/xfs1/home/stonnesen/yt-conda/lib/python3.6/site-packages/matplotlib/axes/_axes.py", line 1437, in plot for line in self._get_lines(*args, **kwargs): File "/mnt/xfs1/home/stonnesen/yt-conda/lib/python3.6/site-packages/matplotlib/axes/_base.py", line 404, in _grab_next_args for seg in self._plot_args(this, kwargs): File "/mnt/xfs1/home/stonnesen/yt-conda/lib/python3.6/site-packages/matplotlib/axes/_base.py", line 394, in _plot_args seg = func(x[:, j % ncx], y[:, j % ncy], kw, kwargs) File "/mnt/xfs1/home/stonnesen/yt-conda/lib/python3.6/site-packages/matplotlib/axes/_base.py", line 301, in _makeline seg = mlines.Line2D(x, y, **kw) File "/mnt/xfs1/home/stonnesen/yt-conda/lib/python3.6/site-packages/matplotlib/lines.py", line 396, in __init__ self.set_linestyle(linestyle) File "/mnt/xfs1/home/stonnesen/yt-conda/lib/python3.6/site-packages/matplotlib/lines.py", line 1115, in set_linestyle self._us_dashOffset, self._us_dashSeq, self._linewidth) File "/mnt/xfs1/home/stonnesen/yt-conda/lib/python3.6/site-packages/matplotlib/lines.py", line 69, in _scale_dashes scaled_offset = offset * lw TypeError: can't multiply sequence by non-int of type 'float'
2) the plot copying the cookbook example (http://yt-project.org/doc/coo kbook/simple_plots.html?highlight=profileplot%20standard%20deviation) is giving me 0s and nans instead of the correct values:
profiles = [] labels = [] plot_specs = [] linest = ['-','--','-.','-','--'] cols = ['red','red','red','green','green'] lw = ['2','2','2','2','2']
i =0 while i < len(loop): ds = yt.load("/mnt/ceph/users/stonnesen/data1/"+loopfile[i]+"/DD" +loop[i]+"/"+loopfile[i]+loop[i]) disk = ds.disk([0.5,0.5,0.5],[0,0,-1.0],(40,"kpc"),(2,"kpc"))
prof = yt.create_profile(disk,'radius',('gas','density'), units={'radius':'kpc'}, extrema={'radius':((0.0,'kpc') ,(40.0,'kpc'))},weight_field='ones')
radius = prof.x mean = prof['gas','density'] std = prof.standard_deviation['gas','density'] plt.semilogy(radius,mean,color=cols[i])#,linewidth=lw[i], linestyle=linest[i]) print (mean) print (radius)
labels.append("%s" % looptext[i]) i = i+1
plt.ylim(1e-27,1e-21) plt.xlabel('r (kpc)') plt.ylabel(r'density') plt.legend() plt.savefig('density_profiles_gasmassmatch.png') plt.clf()
The mean values are all zero, and the radius values are all nan. The code will finish (unless I use the linewidth command), but of course the plots have nothing on them!!
Any ideas for these issues? I would be happy to send my full scripts or output files.
Thanks! Stephanie
-- Dr. Stephanie Tonnesen Associate Research Scientist CCA, Flatiron Institute New York, NY
stonnes@gmail.com
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (2)
-
Nathan Goldbaum
-
Stephanie Tonnesen