In [1]:
import numpy as np
from astropy.io import fits
import os, sys
path = os.path.abspath('../library/')
if path not in sys.path:
    sys.path.append(path)
from cumhpx import delete_sources_below_maglim, do_likelihood, delete_magellanic_clouds

In [2]:
#x = fits.getdata("../output/GDR2_207/GDR2_207_0.0025sampling.fits")
#x = delete_magellanic_clouds(x, True)

In [3]:
outputDir = '../output/mockcat_new_SFR_new_more_thick_0.00025_sampling_new_model_maglim'
fSample = 0.00025
do_likelihood(outputDir,fSample= fSample)


GDR2mock
nstar before cleaning: 656194
nstar after g-band cleaning: 528789
nstar before cleaning: 528789
nstar after rp-band cleaning: 388166
388166
after smc cut: 388034
after lmc cut: 387241
GDR2
nstar before cleaning: 313477
nstar after g-band cleaning: 276803
nstar before cleaning: 276803
nstar after rp-band cleaning: 233013
233013
after smc cut: 232668
after lmc cut: 230225
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-3-6401e0481c46> in <module>()
      1 outputDir = '../output/mockcat_new_SFR_new_more_thick_0.00025_sampling_new_model_maglim'
      2 fSample = 0.00025
----> 3 do_likelihood(outputDir,fSample= fSample)

~/Desktop/Galaxia_wrap-master/library/cumhpx.py in do_likelihood(outputDir, outputFile, fSample)
    353     x = delete_magellanic_clouds(x)
    354     print('GDR2')
--> 355     cumhpx_like,hpx_like,hpx_dens,lengdr2data = likelihood_assessment(x,fSample)
    356     print(len(x),lengdr2data)
    357     # add the numbers into the plot.

~/Desktop/Galaxia_wrap-master/library/cumhpx.py in likelihood_assessment(x, fSample, nside, threshold, cmd_bins)
    313     data = delete_magellanic_clouds(data)
    314     # assess likelihood and prepare arrays for plotting
--> 315     data, cumhpx_like_new = assess_likelihood(data,x, threshold = threshold, cmd_bins = cmd_bins)
    316     print('likelihood: ', sum(cumhpx_like_new))
    317     hpx_like, hpx_dens = get_hpx_structure_for_plotting(cumhpx_like_new,data)

~/Desktop/Galaxia_wrap-master/library/cumhpx.py in assess_likelihood(data, model, threshold, cmd_bins)
    256         print('model already has cumhpx structure, might be incompatible with data')
    257     else:
--> 258         model = transfer_cumhpx_structure(data,model)
    259     cumhpx_like = hess_likelihood_per_cumhpx(data,model,bins = cmd_bins)
    260     return(data,cumhpx_like)

~/Desktop/Galaxia_wrap-master/library/cumhpx.py in transfer_cumhpx_structure(data_with_cumhpx, new_cat)
    137     """
    138     # Extract the structure from old cat
--> 139     cumhpx_array = hpx2cumhpx(data_with_cumhpx) ## corresponding cumhpx
    140     hpx_array = np.unique(data_with_cumhpx.hpx) ## hpx from 0 to hpx_max
    141     healpix_level = highest_hpx_level_from_largest_hpx(max(data_with_cumhpx.hpx))

~/Desktop/Galaxia_wrap-master/library/cumhpx.py in hpx2cumhpx(cat)
    118         # taking the unique cumhpx per hpx pixel
    119         cumhpx_pointer = np.unique(temp.cumhpx)
--> 120         assert(len(cumhpx_pointer)==1),"more cumhpx for single hpx, cumhppointer_len = %d" %(len(cumhpx_pointer))
    121         result.append(cumhpx_pointer[0])
    122     result = np.hstack(result)

AssertionError: more cumhpx for single hpx, cumhppointer_len = 0

In [ ]: