In [1]:
%matplotlib inline
from matplotlib import pyplot as plt
plt.rcParams['figure.figsize'] = (10.0, 8.0)
plt.rcParams['font.size'] = 18
In [2]:
import pandas
store = pandas.HDFStore('/home/ppzsb1/quickdata/GAMA_9_all_combined_gama_only_bd6.h5')
data = store['data']
In [3]:
#[c for c in data.columns if 'MAG' in c]
In [4]:
data = data[data['MAG_GALFIT'] < 18.0]
len(data)
Out[4]:
In [5]:
allbands = 'ugrizYJHK'
band_wl = numpy.array([3543,4770,6231,7625,9134,10395,12483,16313,22010])
normband = 'K'
bands = 'ugrizYJH'
band_wl = numpy.array([3543,4770,6231,7625,9134,10395,12483,16313])
#normband = 'Z'
#bands = 'ugriYJHK'
#band_wl = numpy.array([3543,4770,6231,7625,10395,12483,16313,22010])
In [6]:
normsed = data[['MAG_GALFIT_BAND_{}'.format(b.upper()) for b in bands]]
normsed = normsed.sub(data['MAG_GALFIT_BAND_{}'.format(normband)], axis='index')
#normsed = normsed[:nsel]
print len(normsed)
In [7]:
normsed_single = data[['SINGLE_MAG_GALFIT_{}'.format(b.upper()) for b in bands]]
normsed_single = normsed_single.sub(data['SINGLE_MAG_GALFIT_{}'.format(normband)], axis='index')
good_single = ((normsed_single > -50) &
(normsed_single < 50)).T.all()
good_single &= ((data['SINGLE_MAG_GALFIT_{}'.format(normband)] > -50) &
(data['SINGLE_MAG_GALFIT_{}'.format(normband)] < 50))
normsed_single = normsed_single[good_single]
#normsed_single = normsed_single[:nsel]
print len(normsed_single)
In [8]:
normsed = normsed[good_single]
print len(normsed)
In [9]:
normsed[:100].T.plot(x=band_wl, ylim=(5,-2), legend=False)
Out[9]:
In [10]:
normsed_single[:100].T.plot(x=band_wl, ylim=(5,-2), legend=False)
Out[10]:
In [11]:
plt.subplot(121)
boxplot = normsed.boxplot()
plt.axis(ymin=8, ymax=-5)
plt.subplot(122)
boxplot = normsed_single.boxplot()
_ = plt.axis(ymin=8, ymax=-5)
In [12]:
from statsmodels.graphics.boxplots import beanplot, violinplot
wl = np.log10(band_wl)*10
#p = beanplot(normsed.T.values, labels=bands[:-1], positions=np.log10(band_wl[:-1])*10,
# side='left', plot_opts={'bean_color':'none', 'violin_width':0.5})
# #jitter=True, {'jitter_marker_size':0})
p = violinplot(normsed.T.values, labels=bands, positions=wl,
side='left', show_boxplot=False,
plot_opts={'violin_width':0.5, 'violin_fc':'green', 'violin_ec':'darkgreen',
'cutoff':True, 'cutoff_val':10.05})
p = violinplot(normsed_single.T.values, ax=plt.gca(), labels=bands,
positions=wl,
side='right', show_boxplot=False,
plot_opts={'violin_width':0.5, 'violin_fc':'orange', 'violin_ec':'darkorange',
'cutoff':True, 'cutoff_val':10.05})
_ = plt.axis(ymin=6, ymax=-3)