In [8]:
import numpy as np
import wisps
import wisps.simulations as wispsim
import pandas as pd
import splat
import matplotlib.pyplot as plt
import astropy.units as u
from astropy.coordinates import SkyCoord
from scipy.interpolate import interp1d
import numba
from tqdm import tqdm
%matplotlib inline

In [9]:
#dfcand=pd.read_csv(wisps.LIBRARIES+'/candidates.csv')

In [10]:
SIMULATED_DIST=wispsim.simulate_spts()

In [11]:
import wisps.simulations.effective_numbers as ef

In [12]:
data=ef.simulation_outputs()

In [13]:
MASSES=SIMULATED_DIST['mass']

In [14]:
NORM = 0.005/ len(MASSES[np.logical_and(MASSES>0.09, MASSES <=0.1)])

In [15]:
def custom_histogram(things, grid):
    n=[]
    for g in grid:
        n.append(len(things[np.logical_and(g<=things, things< g+1)]))
    return np.array(n)

In [16]:
nobs0=custom_histogram((SIMULATED_DIST['spts'][0][:,0]), data['spgrid'])

In [17]:
nobs0


Out[17]:
array([ 6248,  5119,  4174,  2742,  2527,  2258,  2118,  2176,  1940,
        2008,  1876,  1674,  1450,  1229,  1209,  1561,  2185,  3322,
        5406,  8674, 12882, 18924,     0,     0,     0])

In [18]:
drop_nan=ef.drop_nan

In [19]:
import splat.empirical as spem

In [20]:
SIMULATED_DIST.keys()


Out[20]:
dict_keys(['mass', 'ages', 'teffs', 'spts', 'norm', 'betas'])

In [21]:
idx0=np.isnan(SIMULATED_DIST['teffs'])[0]

In [22]:
nan_masses=SIMULATED_DIST['mass'][idx0]
nan_ages=(SIMULATED_DIST['ages'][0])[idx0]

In [23]:
import seaborn as sns

In [24]:
cmap=sns.light_palette((260, 75, 60), input="husl", as_cmap=True)

In [25]:
c=plt.scatter(SIMULATED_DIST['mass'],SIMULATED_DIST['teffs'][4], c=SIMULATED_DIST['ages'][4], marker='+', cmap=cmap, alpha=.5)
plt.xlabel('Mass (Msun)', fontsize=18)
plt.ylabel('Teff ', fontsize=18)
c=plt.colorbar()
c.ax.set_title('Age (Gyr)', fontsize=18)


Out[25]:
Text(0.5, 1.0, 'Age (Gyr)')

In [114]:
from matplotlib.ticker import MultipleLocator
import seaborn as sns
ml1 = MultipleLocator(1.)
ml2 = MultipleLocator(10.)
cmap = sns.cubehelix_palette(reverse=True, as_cmap=True)

In [115]:
cands_df=(wisps.datasets['candidates']).reset_index(drop=True)

In [125]:
#(cands_df[cands_df.spt=='T9.0']).dropna()

In [127]:
extra_cols_cands=((wisps.datasets['stars'])[wisps.datasets['stars'].grism_id.isin(cands_df.grism_id)]).reset_index(drop=True)

In [128]:
cands_df[cands_df.grism_id != extra_cols_cands.grism_id]


Out[128]:
CH_4/H-Cont CH_4/H_2O-1 CH_4/H_2O-2 CH_4/J-Cont H-cont/H_2O-1 H-cont/H_2O-2 H-cont/J-Cont H_2O-1/J-Cont H_2O-2/H_2O-1 H_2O-2/J-Cont ... star_flag class_star F110 F140 F160 RA DEC survey x pointing

0 rows × 30 columns


In [129]:
(cands_df[cands_df.spt=='T9.0']).dropna()


Out[129]:
CH_4/H-Cont CH_4/H_2O-1 CH_4/H_2O-2 CH_4/J-Cont H-cont/H_2O-1 H-cont/H_2O-2 H-cont/J-Cont H_2O-1/J-Cont H_2O-2/H_2O-1 H_2O-2/J-Cont ... star_flag class_star F110 F140 F160 RA DEC survey x pointing
99 (0.34495428310708803, 0.0) (12.304450800502602, 0.0) (2.315147992447637, 0.0) (0.1760608252366899, 0.0) (35.669801486948906, 0.0) (6.711463245490185, 0.0) (0.5103888655936282, 0.0) (0.014308710570771536, 0.0) (5.314757778181604, 0.0) (0.07604733080175735, 0.0) ... 0.03 0.03 (23.12, 0.035) (23.045, 0.027999999999999997) (22.653000000000002, 0.051) 196.356232 -25.6413 WISP 0.077305 par32

1 rows × 30 columns


In [130]:
for column in ['survey', 'snr2', 'spt', 'F110', 'F160', 'F140']:
    cands_df[column]= extra_cols_cands[column]

In [131]:
cands_df=wisps.Annotator.reformat_table(cands_df)

In [132]:
(cands_df[cands_df.spt=='T9.0']).dropna()


Out[132]:
CH_4/H-Cont CH_4/H_2O-1 CH_4/H_2O-2 CH_4/J-Cont H-cont/H_2O-1 H-cont/H_2O-2 H-cont/J-Cont H_2O-1/J-Cont H_2O-2/H_2O-1 H_2O-2/J-Cont ... star_flag class_star F110 F140 F160 RA DEC survey x pointing
99 0.344954 12.304451 2.315148 0.176061 35.669801 6.711463 0.510389 0.014309 5.314758 0.076047 ... 0.03 0.03 23.12 23.045 22.653 196.356232 -25.6413 WISP 0.077305 par32

1 rows × 30 columns


In [133]:
from matplotlib.colors import Normalize

In [134]:
hs=data['hs']

In [135]:
cnorm=Normalize(hs[0], hs[-1])

In [236]:
#bin in orders of 5 spts

def bin_by_spt_bin(sp_types, number):
    ranges=[[17, 20], [20, 25], [25, 30], [30, 35], [35, 40]]
    numbers=[]
    for r in ranges:
        idx= np.logical_and((r[0]<=sp_types), (r[1]>sp_types))
        numbers.append(np.nansum(number[idx]))
    return numbers

def stay_within_limits(row):
    #print (row)
    flag=True
    if row.survey.lower()=='wisp':
        if (row.F110>wisps.MAG_LIMITS['wisps']['F110W'][0] or row.F110<wisps.MAG_LIMITS['wisps']['F110W'][1]):
            flag=False
        if np.isnan(row.F110):
            flag=True
    if row.survey.lower()=='hst3d':
        if (row.F140>wisps.MAG_LIMITS['hst3d']['F140W'][0] or row.F140<wisps.MAG_LIMITS['hst3d']['F140W'][1]):
            flag=False
        if np.isnan(row.F140):
            flag=True
    if splat.typeToNum(row.spt)<17.:
        flag=False
    return flag

In [231]:
cands_df['stay_flag']=True

In [239]:
flags=cands_df.apply(stay_within_limits, axis=1).values

In [244]:
cdf_to_use=cands_df[flags]

In [245]:
cdf_to_use.shape, cands_df.shape


Out[245]:
((90, 31), (190, 31))

In [248]:
nobs=custom_histogram(cdf_to_use.spt.apply(wisps.make_spt_number), data['spgrid'])

In [250]:
nobs.


Out[250]:
array([39, 16,  2,  5,  6,  0,  0,  4,  3,  0,  0,  1,  0,  1,  1,  0,  1,
        1,  0,  0,  0,  1,  9,  0,  0])

In [168]:
cdf_to_use.spt.apply(wisps.make_spt_number)

In [199]:
(cands_df[cands_df.spt.apply(wisps.make_spt_number)==39]).grism_id.dropna().shape


Out[199]:
(19,)

nobs


In [144]:
nobs.shape, (data['spgrid']).shape


Out[144]:
((25,), (25,))

In [145]:
spgrid2=['M7-L0', 'L0-L5', 'L5-T0', 'T0-T5', 'T5-Y0']

In [154]:
for x, y in zip(data['spgrid'],nobs):
    print (x, y)


17 39
18 16
19 2
20 5
21 6
22 0
23 0
24 4
25 3
26 0
27 0
28 1
29 0
30 1
31 1
32 0
33 1
34 1
35 0
36 0
37 0
38 1
39 9
40 0
41 0

In [152]:
fig, (ax, ax1)=plt.subplots(ncols=2, figsize=(12, 4))

for x, y in zip(data['spgrid'],nobs):
    if y>0:
        dy=np.sqrt(y)
        dyerr=(y/dy)*np.log10(2.7)*0.5
        #ax.errorbar(x,y, yerr=np.sqrt(y), label='observations',fmt='o', color='k')
        ax.errorbar(x, np.log10(y), yerr=dyerr,  label='observations',fmt='o', color='k')
    if y==0:
        pass
        #ax.plot(x, y, linestyle='none', marker=r'$\downarrow$',   label='observations', color='k')
        
for idx in np.arange(len(hs)):
        
        if hs[idx]==100:
            ax.step(data['spgrid'], np.log10(data['n'][idx]*(data['vol'].T)[idx]*NORM),   where='mid', 
                    label='h={} pc'.format(hs[idx]),color='#FF851B')
            ax1.step(spgrid2, np.log10(bin_by_spt_bin(data['spgrid'], (data['n'][idx])*((data['vol'].T)[idx]*NORM))), 
                     where='mid', label='h={} pc'.format(hs[idx]), color='#FF851B')
            
        elif hs[idx]==1000:
            ax.step(data['spgrid'], np.log10(data['n'][idx]*(data['vol'].T)[idx]*NORM),  
                    where='mid', label='h={} pc'.format(hs[idx]), color='#FF851B', linestyle='--')
            ax1.step(spgrid2, np.log10(bin_by_spt_bin(data['spgrid'], (data['n'][idx])*((data['vol'].T)[idx]*NORM))), 
                     where='mid', label='h={} pc'.format(hs[idx]), 
             color='#FF851B', linestyle='--')
            
        else:
            ax.step(data['spgrid'], np.log10(data['n'][idx]*(data['vol'].T)[idx]*NORM),  
                    where='mid', label='h={} pc'.format(hs[idx]), color=cmap(cnorm(hs[idx])) )
            ax1.step(spgrid2, np.log10(bin_by_spt_bin(data['spgrid'], (data['n'][idx])*((data['vol'].T)[idx]*NORM))), 
                     where='mid', label='h={} pc'.format(hs[idx]), color=cmap(cnorm(hs[idx])))
   


#ax1.errorbar(spgrid2,bin_by_spt_bin(data['spgrid'],nobs),yerr=np.sqrt(bin_by_spt_bin(data['spgrid'],nobs)),
#            label='observations',fmt='o', color='k')

ax1.errorbar(spgrid2,np.log10(bin_by_spt_bin(data['spgrid'],nobs)),
            label='observations',fmt='o', color='k')
             
ax1.legend( fontsize = 15., loc=(1.01, 0.))

ax.minorticks_on()

ax1.minorticks_on()
ax.set_ylim([-.5, 2.1])
ax1.set_ylim([-.5, 2.7])

ax1.tick_params(axis='x', which='minor', bottom=False)


ax.set_ylabel('Log N (SpT)', fontsize=18)
ax1.set_ylabel('Log N (SpT)', fontsize=18)
ax.set_xlabel('SpT', fontsize=18)
ax1.set_xlabel('SpT', fontsize=18)

plt.savefig(wisps.OUTPUT_FIGURES+'/oberved_numbers.pdf', bbox_inches='tight')



In [76]:
wisps.MAG_LIMITS


Out[76]:
{'wisps': {'F110W': [22.0, 18.0],
  'F140W': [21.5, 16.0],
  'F160W': [21.5, 16.0]},
 'hst3d': {'F140W': [22.5, 16.0], 'F160W': [22.5, 16.0]}}

In [77]:
co_sl_prob=np.array(data['sl_prob'])
co_dist=np.array(data['dists'])
co_f140=np.array(data['appf140s'])
co_snrj=np.array(data['snrjs'])

In [78]:
co_sl_prob[0].shape, co_dist.shape


Out[78]:
((97705,), (7, 97705))

In [79]:
rdf=pd.DataFrame()
rdf['mags0']=np.concatenate(co_f140)
rdf['mags1']=np.concatenate(data['appf160s'])

In [80]:
flags0=rdf.mags0.between(18, 22.5).values
flags1=rdf.mags1.between(16, 21.5).values

In [81]:
flag=np.logical_or(flags0, flags1)

In [82]:
flag.shape, flags0.shape, flags1.shape, rdf.shape


Out[82]:
((683935,), (683935,), (683935,), (683935, 2))

In [83]:
rdf[flag].shape


Out[83]:
(540160, 2)

In [84]:
cmap_diverge=sns.diverging_palette(118, 33, n=9, as_cmap=True)

In [85]:
fig, ax=plt.subplots(ncols=3, sharey=True, figsize=(12, 4))

p=ax[0].scatter( np.array(data['appf110s']), np.log10(co_snrj), s=1., marker=',', c=co_sl_prob, cmap='viridis', alpha=0.01)
p=ax[1].scatter( np.array(data['appf140s']), np.log10(co_snrj), s=1., marker=',', c=co_sl_prob, cmap='viridis', alpha=0.01)
p=ax[2].scatter( np.array(data['appf160s']), np.log10(co_snrj), s=1., marker=',', c=co_sl_prob, cmap='viridis', alpha=0.01)

for a in ax:
    a.set_ylabel('Log SNR-J', fontsize=18)
    a.minorticks_on()

ax[0].set_xlabel('F110W', fontsize=18)
ax[1].set_xlabel('F140W', fontsize=18)
ax[2].set_xlabel('F160W', fontsize=18)
plt.tight_layout()

#ax[0].axhline(21.5, c='k', linestyle='--')
#ax[0].axvline(np.log10(3.), c='k', linestyle='--')



In [86]:
data.keys()


Out[86]:
dict_keys(['f110', 'f140', 'hs', 'f160', 'appf140s', 'appf110s', 'appf160s', 'dists', 'snrjs', 'n', 'spgrid', 'vol', 'sl_prob'])

In [87]:
fig, ax=plt.subplots(ncols=2, nrows=2, figsize=(10, 6))

for idx, h in enumerate(hs): 

    p=ax[0][0].scatter(np.log10(co_snrj)[idx],drop_nan(SIMULATED_DIST['spts'][0][:,0]), s=1., 
                    marker=',', c=co_sl_prob[idx], cmap='viridis', alpha=0.01)
    
    p=ax[0][1].scatter(np.log10((data['dists'][idx])),drop_nan(SIMULATED_DIST['spts'][0][:,0]), s=1., 
                    marker=',', c=co_sl_prob[idx], cmap='viridis', alpha=0.01)
    
    p=ax[1][0].scatter((data['appf140s'][idx]),drop_nan(SIMULATED_DIST['spts'][0][:,0]), s=1., 
                    marker=',', c=co_sl_prob[idx],cmap='viridis', alpha=0.01)
    p=ax[1][1].scatter((data['appf160s'][idx]),drop_nan(SIMULATED_DIST['spts'][0][:,0]), s=1., 
                    marker=',', c=co_sl_prob[idx],cmap='viridis', alpha=0.01)
    
ax[1][1].axvline(wisps.MAG_LIMITS['hst3d']['F140W'][0], c='k', linestyle='--')
ax[1][0].axvline(wisps.MAG_LIMITS['hst3d']['F160W'][0], c='k', linestyle='--')

ax[0][0].set_ylabel('SpT', fontsize=18)
ax[0][1].set_ylabel('SpT', fontsize=18)
ax[1][0].set_ylabel('SpT', fontsize=18)
ax[1][1].set_ylabel('SpT', fontsize=18)
                
plt.tight_layout()

ax[0][0].set_xlabel('Log SNR-J', fontsize=18)
ax[0][1].set_xlabel('Log distance', fontsize=18)


Out[87]:
Text(0.5, 208.46409025237395, 'Log distance')

In [88]:
#the selection function should be the number of objects that I select over the number of objects i "SHOULD select"
#not the number of objects i simulated

In [89]:
from tqdm import tqdm

In [90]:
fig, ax=plt.subplots(ncols=3, nrows=2, figsize=(10, 6))

h= ax[0][0].hist(SIMULATED_DIST['mass'],  histtype='step', bins='auto', color='#0074D9')

for  idx in tqdm(np.arange(len(hs))):
    
    col=cmap(cnorm(hs[idx]))
    linestyle='-'
    if hs[idx]==100:
        col='#FF851B'
        
    if hs[idx]==1000:
        col='#FF851B'
        linestyle='--'
    
    h=ax[1][0].hist(drop_nan(np.log10((np.array(data['dists'])[idx]))), bins='auto', histtype='step', label='h={} pc'.format(hs[idx]), 
             color=col, linestyle= linestyle)
    
    h=ax[1][1].hist(drop_nan(np.log10((np.array(data['snrjs'])[idx]))), bins='auto', histtype='step',label='h={} pc'.format(hs[idx]), 
             color=col, linestyle= linestyle)
    
    h=ax[1][2].hist(drop_nan((np.array(data['appf140s'])[idx])), bins='auto', histtype='step', label='h={} pc'.format(hs[idx]), 
             color=cmap(cnorm(hs[idx])))
    
ax[1][0].set_yscale('log')
ax[1][1].set_yscale('log')
ax[1][2].set_yscale('log')

ax[1][2].axvline(21.5)

    
h=ax[0][2].hist(SIMULATED_DIST['spts'][0][:,0],  histtype='step', bins='auto', color='#0074D9')
h=ax[0][1].hist(SIMULATED_DIST['ages'][0],  histtype='step', bins='auto', color='#0074D9')

ax[0][0].set_xlabel(r'Mass (M$_\odot$)', fontsize=18)
ax[0][2].set_xlabel('Spectral Type', fontsize=18)
ax[0][1].set_xlabel('Age (Gyr)', fontsize=18)

ax[1][0].set_xlabel('Log Distance (pc)', fontsize=18)
ax[1][1].set_xlabel('Log SNR-J', fontsize=18)
ax[1][2].set_xlabel('F140W', fontsize=18)

for a in np.concatenate(ax):
    a.minorticks_on()
    a.set_ylabel('N', fontsize=18)
    
plt.tight_layout()

plt.savefig(wisps.OUTPUT_FIGURES+'/simulations_dists.pdf', bbox_inches='tight')


100%|██████████| 7/7 [00:00<00:00, 30.74it/s]

In [91]:
data.keys()


Out[91]:
dict_keys(['f110', 'f140', 'hs', 'f160', 'appf140s', 'appf110s', 'appf160s', 'dists', 'snrjs', 'n', 'spgrid', 'vol', 'sl_prob'])

In [92]:
import splat.empirical as spe

In [93]:
def ryan_lf(spt):
    #ryan's luminosity function 
    J=spe.typeToMag(spt, '2MASS J')[0]
    logphi=-0.30 + 0.11*(J-14) + 0.15*(J -14)**2.+ 0.015*(J-14)**3-0.00020*(J-14)**4
    return (10**logphi)*(10**-3)

In [94]:
spgrid=data['spgrid']

In [95]:
(data['vol']).shape


Out[95]:
(25, 7)

In [96]:
ryan_n=np.array([ryan_lf(spgrid[idx])*(data['vol'].T)[0][idx] for idx in range(len(spgrid)) ])

In [97]:
ryan_n.shape


Out[97]:
(25,)

In [98]:
hist=custom_histogram(drop_nan(SIMULATED_DIST['spts'][idx][:,0]), data['spgrid'])

In [99]:
VOLUMES=(data['vol'].T)

In [100]:
(data['n']).shape, (data['vol']).shape, wisps.MAG_LIMITS['hst3d']['F140W']


Out[100]:
((23,), (25, 7), [22.5, 16.0])

In [101]:
(data['spgrid']).shape, (np.log10(data['n'][idx]*(data['vol'].T)[idx]*NORM)).shape


Out[101]:
((25,), (25,))

In [102]:
snew=np.arange(17, 39)

In [103]:
snew


Out[103]:
array([17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
       34, 35, 36, 37, 38])

In [104]:
sptidx=[i for i, spt in enumerate(data['spgrid']) if spt in snew]

In [105]:
#idx

In [106]:
sim_vs=pd.DataFrame(index=[splat.typeToNum(x).replace('.0', ' ') for x in (data['spgrid'])[sptidx]])
for hindex, h in enumerate(hs):
    sim_vs['volume {}'.format(h)]=np.round(VOLUMES[hindex])[sptidx]
    sim_vs['Number ex {}'.format(h)]=np.round(hist*VOLUMES[hindex]*NORM, 1)[sptidx]
    sim_vs['Number ex {}'.format(h)]=(sim_vs['Number ex {}'.format(h)]).astype(int)[sptidx]
sim_vs['Number obs']=nobs[sptidx]

In [107]:
sim_vs.loc["Total"] = sim_vs.sum()

In [108]:
sim_vs


Out[108]:
volume 100 Number ex 100 volume 250 Number ex 250 volume 275 Number ex 275 volume 300 Number ex 300 volume 325 Number ex 325 volume 350 Number ex 350 volume 1000 Number ex 1000 Number obs
M7 3380.0 11.0 8786.0 29.0 9963.0 33.0 11217.0 37.0 12545.0 42.0 13946.0 46.0 64049.0 215.0 39.0
M8 2111.0 5.0 6115.0 17.0 6999.0 19.0 7938.0 22.0 8930.0 24.0 9970.0 27.0 44917.0 125.0 16.0
M9 1365.0 3.0 4371.0 10.0 5033.0 11.0 5733.0 13.0 6465.0 14.0 7227.0 16.0 32305.0 74.0 2.0
L0 915.0 1.0 3190.0 4.0 3682.0 5.0 4196.0 6.0 4730.0 7.0 5280.0 7.0 23965.0 35.0 5.0
L1 636.0 0.0 2357.0 3.0 2718.0 3.0 3091.0 4.0 3476.0 4.0 3872.0 5.0 18034.0 25.0 6.0
L2 456.0 0.0 1752.0 2.0 2014.0 2.0 2285.0 2.0 2565.0 3.0 2855.0 3.0 13312.0 16.0 0.0
L3 337.0 0.0 1307.0 1.0 1500.0 1.0 1700.0 2.0 1909.0 2.0 2127.0 2.0 9353.0 10.0 0.0
L4 254.0 0.0 983.0 1.0 1129.0 1.0 1281.0 1.0 1441.0 1.0 1608.0 1.0 6228.0 7.0 4.0
L5 196.0 0.0 751.0 0.0 863.0 1.0 981.0 1.0 1104.0 1.0 1231.0 1.0 4036.0 4.0 3.0
L6 155.0 0.0 587.0 0.0 675.0 0.0 766.0 0.0 860.0 0.0 955.0 1.0 2660.0 2.0 0.0
L7 125.0 0.0 473.0 0.0 543.0 0.0 615.0 0.0 687.0 0.0 759.0 0.0 1858.0 2.0 0.0
L8 105.0 0.0 397.0 0.0 455.0 0.0 514.0 0.0 572.0 0.0 628.0 0.0 1413.0 1.0 1.0
L9 92.0 0.0 350.0 0.0 401.0 0.0 451.0 0.0 501.0 0.0 549.0 0.0 1174.0 0.0 0.0
T0 84.0 0.0 324.0 0.0 370.0 0.0 416.0 0.0 462.0 0.0 505.0 0.0 1049.0 0.0 1.0
T1 81.0 0.0 310.0 0.0 354.0 0.0 398.0 0.0 440.0 0.0 480.0 0.0 970.0 0.0 1.0
T2 81.0 0.0 303.0 0.0 344.0 0.0 384.0 0.0 422.0 0.0 458.0 0.0 882.0 0.0 0.0
T3 83.0 0.0 293.0 0.0 328.0 0.0 361.0 0.0 393.0 0.0 423.0 0.0 745.0 0.0 1.0
T4 84.0 0.0 266.0 0.0 293.0 0.0 317.0 0.0 339.0 0.0 360.0 0.0 556.0 1.0 1.0
T5 78.0 0.0 212.0 0.0 228.0 0.0 241.0 0.0 253.0 0.0 263.0 0.0 352.0 1.0 0.0
T6 61.0 0.0 133.0 0.0 139.0 0.0 144.0 0.0 148.0 0.0 152.0 0.0 180.0 0.0 0.0
T7 34.0 0.0 56.0 0.0 57.0 0.0 58.0 0.0 59.0 0.0 60.0 0.0 66.0 0.0 0.0
T8 10.0 0.0 14.0 0.0 14.0 0.0 14.0 0.0 14.0 0.0 14.0 0.0 15.0 0.0 1.0
Total 10723.0 20.0 33330.0 67.0 38102.0 76.0 43101.0 88.0 48315.0 98.0 53722.0 109.0 228119.0 518.0 81.0

In [109]:
sim_vs=sim_vs.reindex(sorted(sim_vs.columns), axis=1)

In [110]:
len(sim_vs), sim_vs.shape


Out[110]:
(23, (23, 15))

In [111]:
sim_vs.to_latex(wisps.LIBRARIES+'/expectations.tex', index=True)

In [112]:
#(wisps.datasets['candidates']).spt.apply(wisps.make_spt_number).values

In [ ]: