示例#1
0
"""
desitarget.cmx.cmx_targetmask
=============================

This looks more like a script than an actual module.
"""
from desiutil.bitmask import BitMask
from desitarget.targetmask import load_mask_bits

_bitdefs = load_mask_bits("cmx")
try:
    cmx_mask = BitMask('cmx_mask', _bitdefs)
    cmx_obsmask = BitMask('cmx_obsmask', _bitdefs)
except TypeError:
    cmx_mask = object()
    cmx_obsmask = object()
示例#2
0
print('Assigned targets: {}'.format(len(_assigned)))

##  Retain only the science targets; Dropping standards etc. 
_assigned  = _assigned[_assigned['FA_TYPE'].quantity == 1]
print('Assigned science: {}'.format(len(_assigned)))

##  Load one tile, currently. 
Tile       = 74057
sv_mtl     = Table(fits.open(scratch + '/BGS/SV-ASSIGN/mtls/svmtl_{:06d}.fits'.format(Tile))[1].data)

##  Limit to only BGS.
sv_mtl     = sv_mtl[sv_mtl['SV1_BGS_TARGET'].quantity.value > 0]
print('Total targets in Tile {}: {}.'.format(Tile, len(sv_mtl)))

##  
_bitdefs   = load_mask_bits("sv1")
bgs_mask   = BitMask('sv1_bgs_mask', _bitdefs)

types      =  bgs_mask.names()
bits       = [bgs_mask.bitnum(x) for x in types]

##  Those that were assigned in this tile. 
assigned   = join(_assigned, sv_mtl, keys=['BRICKID', 'BRICK_OBJID'], join_type='inner')

##  SV Target class.
splits     = {}
title      = ''

##
for _type in ['BGS_FAINT', 'BGS_BRIGHT', 'BGS_FAINT_EXT', 'BGS_LOWQ', 'BGS_FIBMAG']:
  sample        = _type.split('_')