[yt-svn] commit/yt-3.0: MatthewTurk: Adding an exception for when particles are multi-mass in rockstar.
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Tue Oct 1 05:37:57 PDT 2013
1 new commit in yt-3.0:
https://bitbucket.org/yt_analysis/yt-3.0/commits/59d6af464edc/
Changeset: 59d6af464edc
Branch: yt-3.0
User: MatthewTurk
Date: 2013-09-30 15:02:04
Summary: Adding an exception for when particles are multi-mass in rockstar.
Affected #: 2 files
diff -r ace052c7aae2ef2c5b4ac0d92aaa4d5d3d61a1a7 -r 59d6af464edc0cb7d6322e930999bf715e54766f yt/analysis_modules/halo_finding/rockstar/rockstar.py
--- a/yt/analysis_modules/halo_finding/rockstar/rockstar.py
+++ b/yt/analysis_modules/halo_finding/rockstar/rockstar.py
@@ -18,6 +18,7 @@
ParallelAnalysisInterface, ProcessorPool, Communicator
from yt.analysis_modules.halo_finding.halo_objects import * #Halos & HaloLists
from yt.config import ytcfg
+from yt.utilities.exceptions import YTRockstarMultiMassNotSupported
import rockstar_interface
@@ -229,8 +230,11 @@
particle_mass = self.particle_mass
if particle_mass is None:
- particle_mass = dd.quantities["Extrema"](
- (ptype, "ParticleMassMsun"), non_zero = True)[0][0]
+ pmass_min, pmass_max = dd.quantities["Extrema"](
+ (ptype, "ParticleMassMsun"), non_zero = True)[0]
+ if pmass_min != pmass_max:
+ raise YTRockstarMultiMassNotSupported
+ particle_mass = pmass_min
# NOTE: We want to take our Msun and turn it into Msun/h . Its value
# should be such that dividing by little h gives the original value.
particle_mass *= tpf.hubble_constant
diff -r ace052c7aae2ef2c5b4ac0d92aaa4d5d3d61a1a7 -r 59d6af464edc0cb7d6322e930999bf715e54766f yt/utilities/exceptions.py
--- a/yt/utilities/exceptions.py
+++ b/yt/utilities/exceptions.py
@@ -298,3 +298,16 @@
v = r"The object type '%s' is not implemented for the parameter file "
v += r"'%s'."
return v % (self.obj_name, self.pf)
+
+class YTRockstarMultiMassNotSupported(YTException):
+ def __init__(self, mi, ma, ptype):
+ self.mi = mi
+ self.ma = ma
+ self.ptype = ptype
+
+ def __str__(self):
+ v = "Particle type '%s' has minimum mass %0.3e and maximum " % (
+ self.ptype, self.mi)
+ v += "mass %0.3e. Multi-mass particles are not currently supported." % (
+ self.ma)
+ return v
Repository URL: https://bitbucket.org/yt_analysis/yt-3.0/
--
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