[Yt-svn] yt: StarAnalysis now can get the volume for a HOPHalo.
hg at spacepope.org
hg at spacepope.org
Fri Mar 26 11:17:39 PDT 2010
hg Repository: yt
details: yt/rev/050d464da7b7
changeset: 1483:050d464da7b7
user: Stephen Skory <stephenskory at yahoo.com>
date:
Fri Mar 26 11:17:26 2010 -0700
description:
StarAnalysis now can get the volume for a HOPHalo.
diffstat:
yt/extensions/StarAnalysis.py | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diffs (23 lines):
diff -r 0ea10be4b283 -r 050d464da7b7 yt/extensions/StarAnalysis.py
--- a/yt/extensions/StarAnalysis.py Thu Mar 25 23:29:56 2010 -0700
+++ b/yt/extensions/StarAnalysis.py Fri Mar 26 11:17:26 2010 -0700
@@ -114,11 +114,18 @@
"""
fp = open(name, "w")
if self.mode == 'data_source':
- vol = self._data_source.volume('mpc')
+ try:
+ vol = self._data_source.volume('mpc')
+ except AttributeError:
+ # If we're here, this is probably a HOPHalo object, and we
+ # can get the volume this way.
+ ds = self._data_source.get_sphere()
+ vol = ds.volume('mpc')
elif self.mode == 'provided':
vol = self.volume
tc = self._pf["Time"]
# Use the center of the time_bin, not the left edge.
+ fp.write("#time\tlookback\tredshift\tMsol/yr\tMsol/yr/Mpc3\tMsol\tcumMsol\t\n")
for i, time in enumerate((self.time_bins[1:] + self.time_bins[:-1])/2.):
line = "%1.5e\t%1.5e\t%1.5e\t%1.5e\t%1.5e\t%1.5e\t%1.5e\n" % \
(time * tc / YEAR, # Time
More information about the yt-svn
mailing list