create_profile of linear fields
Hi all, Is there a way to specify the log/non-log scaling of a y-axis variable in create_profile or ProfilePlot.from_profiles? I have some profiles that start flat at an initial time and so the velocity_magnitude is everywhere 0. create_profile succeeds, but ProfilePlot.from_profiles generates a Matplotlib error before I have the ability to specify a scaling: sph = ds.sphere(ds.domain_center, ds.domain_width[0]/2) profile = yt.create_profile(sph, "radius", ["density", "temperature", "velocity_magnitude", "dx"], extrema={'radius':(ds.domain_width[0]/ds.num_grid,ds.domain_width[0]/2.)}, n_bins=int(ds.domain_width[0]*2.**(ds.max_level-1)), logs={'radius':False}, units={'radius':'pc'}) plot = yt.ProfilePlot.from_profiles(profile) Relevant part of the dump: /software/python-2.7-2014q3-el6-x86_64/lib/python2.7/site-packages/matplotlib-1.4.0-py2.7-linux-x86_64.egg/matplotlib/ticker.pyc in view_limits(self, vmin, vmax) 1523 if minpos <= 0 or not np.isfinite(minpos): 1524 raise ValueError( -> 1525 "Data has no positive values, and therefore can not be " 1526 "log-scaled.") 1527 Douglas Rudd Scientific Computing Consultant Research Computing Center drudd@uchicago.edu
What happens if you use the 'logs' keyword for create_profile to control
the logging for temperature, velocity_magnitude, and dx?
On Fri, Oct 31, 2014 at 2:08 PM, Douglas Harvey Rudd
Hi all,
Is there a way to specify the log/non-log scaling of a y-axis variable in create_profile or ProfilePlot.from_profiles? I have some profiles that start flat at an initial time and so the velocity_magnitude is everywhere 0. create_profile succeeds, but ProfilePlot.from_profiles generates a Matplotlib error before I have the ability to specify a scaling:
sph = ds.sphere(ds.domain_center, ds.domain_width[0]/2) profile = yt.create_profile(sph, "radius", ["density", "temperature", "velocity_magnitude", "dx"],
extrema={'radius':(ds.domain_width[0]/ds.num_grid,ds.domain_width[0]/2.)},
n_bins=int(ds.domain_width[0]*2.**(ds.max_level-1)), logs={'radius':False}, units={'radius':'pc'}) plot = yt.ProfilePlot.from_profiles(profile)
Relevant part of the dump: /software/python-2.7-2014q3-el6-x86_64/lib/python2.7/site-packages/matplotlib-1.4.0-py2.7-linux-x86_64.egg/matplotlib/ticker.pyc in view_limits(self, vmin, vmax) 1523 if minpos <= 0 or not np.isfinite(minpos): 1524 raise ValueError( -> 1525 "Data has no positive values, and therefore can not be " 1526 "log-scaled.") 1527
Douglas Rudd Scientific Computing Consultant Research Computing Center drudd@uchicago.edu
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
I believe it only works for axis fields. From the docstrings:
logs : dict of boolean values
Whether or not to log the bin_fields for the profiles.
The keys correspond to the field names. Defaults to the take_log
attribute of the field.
and adding velocity_magnitude to logs generates the same error as before.
Douglas Rudd
Scientific Computing Consultant
Research Computing Center
drudd@uchicago.edumailto:drudd@uchicago.edu
On Oct 31, 2014, at 4:10 PM, Nathan Goldbaum
For profiles where at least one data point is positive I can alter the log-edness once I have the ProfilePlot object using set_log.
Douglas Rudd
Scientific Computing Consultant
Research Computing Center
drudd@uchicago.edumailto:drudd@uchicago.edu
On Oct 31, 2014, at 4:18 PM, Douglas Harvey Rudd
I see how this works now: ProfilePlot by default will take the logging
behavior from the take_log attribute of the FieldInfo instance associated
with the field.
This is definitely a bug: ProfilePlot should at least be smart enough to
see that all of the data values are zero or negative and automatically
switch the logging behavior so you can at least create a plot without
erroring out inside matplotlib.
A quick fix would be to manually change take_log for the field you're
plotting, or to create an alias derived field that has a custom take_log
choice.
I could also see an argument for adding a keyword argument to control the
plot field logging in the ProfilePlot constructor - although we usually
have a pretty high bar for solving problems by adding new keyword arguments.
On Fri, Oct 31, 2014 at 2:23 PM, Douglas Harvey Rudd
For profiles where at least one data point is positive I can alter the log-edness once I have the ProfilePlot object using set_log.
Douglas Rudd Scientific Computing Consultant Research Computing Center drudd@uchicago.edu
On Oct 31, 2014, at 4:18 PM, Douglas Harvey Rudd
wrote: I believe it only works for axis fields. From the docstrings:
logs : dict of boolean values Whether or not to log the bin_fields for the profiles. The keys correspond to the field names. Defaults to the take_log attribute of the field.
and adding velocity_magnitude to logs generates the same error as before.
Douglas Rudd Scientific Computing Consultant Research Computing Center drudd@uchicago.edu
On Oct 31, 2014, at 4:10 PM, Nathan Goldbaum
wrote: What happens if you use the 'logs' keyword for create_profile to control the logging for temperature, velocity_magnitude, and dx?
On Fri, Oct 31, 2014 at 2:08 PM, Douglas Harvey Rudd
wrote: Hi all,
Is there a way to specify the log/non-log scaling of a y-axis variable in create_profile or ProfilePlot.from_profiles? I have some profiles that start flat at an initial time and so the velocity_magnitude is everywhere 0. create_profile succeeds, but ProfilePlot.from_profiles generates a Matplotlib error before I have the ability to specify a scaling:
sph = ds.sphere(ds.domain_center, ds.domain_width[0]/2) profile = yt.create_profile(sph, "radius", ["density", "temperature", "velocity_magnitude", "dx"],
extrema={'radius':(ds.domain_width[0]/ds.num_grid,ds.domain_width[0]/2.)},
n_bins=int(ds.domain_width[0]*2.**(ds.max_level-1)), logs={'radius':False}, units={'radius':'pc'}) plot = yt.ProfilePlot.from_profiles(profile)
Relevant part of the dump: /software/python-2.7-2014q3-el6-x86_64/lib/python2.7/site-packages/matplotlib-1.4.0-py2.7-linux-x86_64.egg/matplotlib/ticker.pyc in view_limits(self, vmin, vmax) 1523 if minpos <= 0 or not np.isfinite(minpos): 1524 raise ValueError( -> 1525 "Data has no positive values, and therefore can not be " 1526 "log-scaled.") 1527
Douglas Rudd Scientific Computing Consultant Research Computing Center drudd@uchicago.edu
_______________________________________________ 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
_______________________________________________ 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
Well I had originally tried adding to logs just as you had suggested, so that seems to be a logical solution that doesn’t require a new keyword.
Douglas Rudd
Scientific Computing Consultant
Research Computing Center
drudd@uchicago.edumailto:drudd@uchicago.edu
On Oct 31, 2014, at 4:29 PM, Nathan Goldbaum
participants (2)
-
Douglas Harvey Rudd
-
Nathan Goldbaum