# -*- coding: utf-8 -*-
# Time-stamp: <2020-12-24 18:21 ycopin@lyonovae03>
"""
.. _sim140425:
Simulation 140425
=================
Interface elements to `Simulation 140425
<http://euclid.roe.ac.uk/projects/ou-spe/wiki/SimulationData>`_.
"""
__author__ = "Yannick Copin <y.copin@ipnl.in2p3.fr>"
import numpy as N
from . import statistics as S
[docs]def fig_hist_survey(data, title=''):
"""
Plot various histograms (Z, Ha, etc.) vs. morphological types
"""
import matplotlib.pyplot as P
# Morphological type
morphtypes = {
(1, 2, 3): 'High activity 1',
(4, 5, 6): 'High activity 2',
(7, 8, 9): 'Intermediate activity 1',
(10, 11, 12): 'Intermediate activity 2',
(13, 14, 15): 'Quiescent 1',
(16, 17, 18): 'Quiescent 2'
}
# Simplified morphological type classification
types = (
("High 1", N.in1d(data['type'], list(range(1, 4)))),
("High 2", N.in1d(data['type'], list(range(4, 7)))),
("Intermediate", N.in1d(data['type'], list(range(7, 13)))),
("Quiescent", N.in1d(data['type'], list(range(13, 19)))),
)
# Histogram range
bkw = dict(range=(3., 97.), percentiles=True)
fig = P.figure()
axz = fig.add_subplot(2, 2, 1,
xlabel="Redshift")
axz.hist([ data['z'][idxs] for lbl, idxs in types],
bins=S.hist_bins(data['z'], **bkw),
histtype='stepfilled', stacked=True)
axf = fig.add_subplot(2, 2, 2,
xlabel="Hα flux")
axf.hist([ data['fHa'][idxs] for lbl, idxs in types],
bins=S.hist_bins(data['fHa'], **bkw),
histtype='stepfilled', stacked=True,
label=[ "%s (%d)" % (lbl, len(idxs[idxs]))
for lbl, idxs in types ])
axf.legend(loc='upper right', fontsize='x-small')
axe = fig.add_subplot(2, 2, 3,
xlabel="Hα EW")
axe.hist([ data['ewHa'][idxs] for lbl, idxs in types],
bins=S.hist_bins(data['ewHa'], **bkw),
histtype='stepfilled', stacked=True)
axm = fig.add_subplot(2, 2, 4,
xlabel="Mag")
axm.hist([ data['mag'][idxs] for lbl, idxs in types],
bins=S.hist_bins(data['mag'], **bkw),
histtype='stepfilled', stacked=True)
if title:
fig.suptitle(title)
return fig