From 9269b9b00139c00a90e64516fa30f2c391005ad6 Mon Sep 17 00:00:00 2001 From: Jordan Mirocha Date: Thu, 10 Sep 2015 13:32:20 -0700 Subject: [PATCH] DerivedQuantities now yields total heat in units of energy/time/co-moving volume, not proper volume. --- ares/analysis/DerivedQuantities.py | 5 +++-- ares/analysis/Global21cmSet.py | 2 +- ares/analysis/ModelSet.py | 21 ++++++++++++++------- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/ares/analysis/DerivedQuantities.py b/ares/analysis/DerivedQuantities.py index 9952be6ef..373dfd289 100644 --- a/ares/analysis/DerivedQuantities.py +++ b/ares/analysis/DerivedQuantities.py @@ -48,8 +48,9 @@ def total_heat(data): n = data['igm_n_%s' % sp] - # Multiply by number density of absorbers - heat += n * data[heat_by_pop] + # Multiply by number density of absorbers, convert to + # co-moving units + heat += n * data[heat_by_pop] / (1. + data['z'])**3 return heat diff --git a/ares/analysis/Global21cmSet.py b/ares/analysis/Global21cmSet.py index eac34c091..9bcc39aad 100644 --- a/ares/analysis/Global21cmSet.py +++ b/ares/analysis/Global21cmSet.py @@ -280,7 +280,7 @@ def TurningPointConstraints(self, pts=None, mp=None, fig=1, return mp # Draw the 120 MHz cutoff for DARE - if pts == 'D' or list('BCD'): + if pts == 'D' or (pts == list('BCD')): mp.grid[4].plot([120]*2, mp.grid[4].get_ylim(), color='k', ls='--') mp.grid[10].plot([120]*2, mp.grid[10].get_ylim(), color='k', ls='--') diff --git a/ares/analysis/ModelSet.py b/ares/analysis/ModelSet.py index ed30ce886..f8dce3ff8 100644 --- a/ares/analysis/ModelSet.py +++ b/ares/analysis/ModelSet.py @@ -2177,10 +2177,17 @@ def ContourScatter(self, x, y, c, z=None, Nscat=1e4, take_log=False, return ax, scat, cb - def extract_panel(self, panel, mp, fig=99): + def extract_panel(self, panel, mp, rotate_x=45, rotate_y=45, ax=None, + fig=99): """ Save panel of a triangle plot as separate file. + panel : int, str + Integer or letter corresponding to plot panel you want. + mp : MultiPlot instance + Object representation of the triangle plot + fig : int + Figure number. """ @@ -2196,7 +2203,7 @@ def extract_panel(self, panel, mp, fig=99): ax = self.PosteriorPDF(info['axes'], z=info['z'], bins=info['bins'], multiplier=info['multiplier'], take_log=info['take_log'], - fig=fig, **kw) + fig=fig, ax=ax, **kw) ax.set_xticks(mp.grid[panel].get_xticks()) ax.set_yticks(mp.grid[panel].get_yticks()) @@ -2205,13 +2212,13 @@ def extract_panel(self, panel, mp, fig=99): for i, x in enumerate(mp.grid[panel].get_xticklabels()): xt.append(x.get_text()) - ax.set_xticklabels(xt) + ax.set_xticklabels(xt, rotation=rotate_x) yt = [] for i, x in enumerate(mp.grid[panel].get_yticklabels()): yt.append(x.get_text()) - ax.set_yticklabels(yt) + ax.set_yticklabels(yt, rotation=rotate_y) ax.set_xlim(mp.grid[panel].get_xlim()) ax.set_ylim(mp.grid[panel].get_ylim()) @@ -2223,9 +2230,9 @@ def extract_panel(self, panel, mp, fig=99): def TrianglePlot(self, pars=None, z=None, panel_size=(0.5,0.5), padding=(0,0), show_errors=False, take_log=False, multiplier=1, fig=1, inputs={}, tighten_up=0.0, ticks=5, bins=20, mp=None, skip=0, - skim=1, top=None, oned=True, twod=True, filled=True, box=None, rotate_x=45, - rotate_y=45, add_cov=False, label_panels='upper right', fix=True, - skip_panels=[], stop=None, **kwargs): + skim=1, top=None, oned=True, twod=True, filled=True, box=None, + rotate_x=45, rotate_y=45, add_cov=False, label_panels='upper right', + fix=True, skip_panels=[], stop=None, **kwargs): """ Make an NxN panel plot showing 1-D and 2-D posterior PDFs.