def get_truth(truth_fn, south=True): """Build truth table.""" logger.info('Reading truth file %s',truth_fn) truth = SimCatalog(truth_fn) mask = get_maskbit(truth) mask = get_mask_depth(truth) mask &= isELG_colors(south=south,gmarg=0.5,grmarg=0.5,rzmarg=0.5,**{'%sflux' % b:utils.mag2nano(truth.get(b)) for b in ['g','r','z','gfiber']})[0] for b in ['g','r','z','gfiber']: mask &= (~np.isnan(truth.get(b))) & (~np.isinf(truth.get(b))) logger.info('Target selection: %d/%d objects',mask.sum(),mask.size) truth = truth[mask] return truth
def get_truth(truth_fn, south=True): """Build truth table.""" logger.info('Reading truth file %s',truth_fn) truth = SimCatalog(truth_fn) snr = {b: truth.get('flux_%s' % b) * np.sqrt(truth.get('flux_ivar_%s' % b)) for b in ['g','r','z']} mask = truth.get('hsc_object_id') >= 0 mask &= notinELG_mask(maskbits=truth.maskbits,gsnr=snr['g'],rsnr=snr['r'],zsnr=snr['z'],gnobs=truth.nobs_g,rnobs=truth.nobs_r,znobs=truth.nobs_z) mask &= get_mask_depth(truth) mask &= get_mask_ts(truth,south=south,gmarg=0.5,grmarg=0.5,rzmarg=0.5) for b in ['g','r','z','gfiber']: mask &= (~np.isnan(truth.get(b))) & (~np.isinf(truth.get(b))) logger.info('Target selection: %d/%d objects',mask.sum(),mask.size) truth = truth[mask] return truth
def get_truth(truth_fn, south=True): """Build truth table.""" truth = SimCatalog(truth_fn) mask = isELG_colors(south=south, gmarg=0.5, grmarg=0.5, rzmarg=0.5, **{ '%sflux' % b: utils.mag2nano(truth.get(b)) for b in ['g', 'r', 'z'] }) for b in ['g', 'r', 'z']: mask &= (~np.isnan(truth.get(b))) & (~np.isinf(truth.get(b))) mask &= truth.rhalf < 5. logger.info('Target selection: %d/%d objects', mask.sum(), mask.size) truth = truth[mask] truth.rename('objid', 'id_truth') truth.rename('rhalf', 'shape_r') #truth.shape_r = 1e-5*truth.ones() truth.rename('hsc_mizuki_photoz_best', 'redshift') truth.sersic = truth.ones(dtype=int) truth.sersic[truth.type == 'DEV'] = 4 return truth