[yt-svn] commit/yt: 2 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Fri Jun 6 05:55:12 PDT 2014
2 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/008838121a10/
Changeset: 008838121a10
Branch: yt
User: chummels
Date: 2014-05-31 18:14:10
Summary: Adding in minimum and maximum star ages as filters in annotate_particles() plot modification.
Affected #: 1 file
diff -r c03ad444c015fd586f7b6be140f9b900aadb5232 -r 008838121a1068950542a30769cc9de46534dece yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -1056,7 +1056,8 @@
"""
annotate_particles(width, p_size=1.0, col='k', marker='o', stride=1.0,
ptype=None, stars_only=False, dm_only=False,
- minimum_mass=None, alpha=1.0)
+ minimum_mass=None, alpha=1.0, min_star_age=None,
+ max_star_age=None)
Adds particle positions, based on a thick slab along *axis* with a
*width* along the line of sight. *p_size* controls the number of
@@ -1064,14 +1065,16 @@
restrict plotted particles to only those that are of a given type.
*minimum_mass* will require that the particles be of a given mass,
calculated via ParticleMassMsun, to be plotted. *alpha* determines
- each particle's opacity.
+ each particle's opacity. If stars are plotted, min_star_age and
+ max_star_age filter them (in years).
"""
_type_name = "particles"
region = None
_descriptor = None
def __init__(self, width, p_size=1.0, col='k', marker='o', stride=1.0,
ptype=None, stars_only=False, dm_only=False,
- minimum_mass=None, alpha=1.0):
+ minimum_mass=None, alpha=1.0, min_star_age=None,
+ max_star_age=None):
PlotCallback.__init__(self)
self.width = width
self.p_size = p_size
@@ -1083,10 +1086,12 @@
self.dm_only = dm_only
self.minimum_mass = minimum_mass
self.alpha = alpha
+ self.min_star_age = min_star_age
+ self.max_star_age = max_star_age
def __call__(self, plot):
data = plot.data
- # we construct a recantangular prism
+ # we construct a rectangular prism
x0, x1 = plot.xlim
y0, y1 = plot.ylim
xx0, xx1 = plot._axes.get_xlim()
@@ -1108,6 +1113,16 @@
if self.minimum_mass is not None:
gg &= (reg["ParticleMassMsun"] >= self.minimum_mass)
if gg.sum() == 0: return
+ if self.min_star_age is not None:
+ current_time = plot.pf.current_time
+ age_in_years = (current_time - reg["creation_time"]) * (plot.pf['Time'] / 3.155e7)
+ gg &= (age_in_years >= self.min_star_age)
+ if gg.sum() == 0: return
+ if self.max_star_age is not None:
+ current_time = plot.pf.current_time
+ age_in_years = (current_time - reg["creation_time"]) * (plot.pf['Time'] / 3.155e7)
+ gg &= (age_in_years <= self.max_star_age)
+ if gg.sum() == 0: return
plot._axes.hold(True)
px, py = self.convert_to_plot(plot,
[reg[field_x][gg][::self.stride],
https://bitbucket.org/yt_analysis/yt/commits/320eea1e3d72/
Changeset: 320eea1e3d72
Branch: yt
User: chummels
Date: 2014-05-31 19:01:57
Summary: Merging.
Affected #: 1 file
diff -r 1f9ca06815d0a525d08e7c0e0ec0d92b9ef1cec1 -r 320eea1e3d72dcb96663329f2a083a04fc146dc9 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -1069,7 +1069,8 @@
"""
annotate_particles(width, p_size=1.0, col='k', marker='o', stride=1.0,
ptype=None, stars_only=False, dm_only=False,
- minimum_mass=None, alpha=1.0)
+ minimum_mass=None, alpha=1.0, min_star_age=None,
+ max_star_age=None)
Adds particle positions, based on a thick slab along *axis* with a
*width* along the line of sight. *p_size* controls the number of
@@ -1077,14 +1078,16 @@
restrict plotted particles to only those that are of a given type.
*minimum_mass* will require that the particles be of a given mass,
calculated via ParticleMassMsun, to be plotted. *alpha* determines
- each particle's opacity.
+ each particle's opacity. If stars are plotted, min_star_age and
+ max_star_age filter them (in years).
"""
_type_name = "particles"
region = None
_descriptor = None
def __init__(self, width, p_size=1.0, col='k', marker='o', stride=1.0,
ptype=None, stars_only=False, dm_only=False,
- minimum_mass=None, alpha=1.0):
+ minimum_mass=None, alpha=1.0, min_star_age=None,
+ max_star_age=None):
PlotCallback.__init__(self)
self.width = width
self.p_size = p_size
@@ -1096,10 +1099,12 @@
self.dm_only = dm_only
self.minimum_mass = minimum_mass
self.alpha = alpha
+ self.min_star_age = min_star_age
+ self.max_star_age = max_star_age
def __call__(self, plot):
data = plot.data
- # we construct a recantangular prism
+ # we construct a rectangular prism
x0, x1 = plot.xlim
y0, y1 = plot.ylim
xx0, xx1 = plot._axes.get_xlim()
@@ -1121,6 +1126,16 @@
if self.minimum_mass is not None:
gg &= (reg["ParticleMassMsun"] >= self.minimum_mass)
if gg.sum() == 0: return
+ if self.min_star_age is not None:
+ current_time = plot.pf.current_time
+ age_in_years = (current_time - reg["creation_time"]) * (plot.pf['Time'] / 3.155e7)
+ gg &= (age_in_years >= self.min_star_age)
+ if gg.sum() == 0: return
+ if self.max_star_age is not None:
+ current_time = plot.pf.current_time
+ age_in_years = (current_time - reg["creation_time"]) * (plot.pf['Time'] / 3.155e7)
+ gg &= (age_in_years <= self.max_star_age)
+ if gg.sum() == 0: return
plot._axes.hold(True)
px, py = self.convert_to_plot(plot,
[reg[field_x][gg][::self.stride],
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list