Exemple #1
0
 def __init__(self, options=None):
     if options is not None:
         if options.humnamap=="nodither":
             mapfn="/coaddM5Data_masked_rBand_NoDither.npz"
         elif options.humnamap=="reprandom":
             mapfn="/coaddM5Data_masked_rBand_RepulsiveRandomDitherFieldPerVisit.npz"
         else:
             print "Unknown depth variations type map"
             stop()
         mapfn=options.hpath+mapfn
         print "     Reading mapfn",mapfn,"..."
         hmap=np.load(mapfn)
         mask=hmap['mask']
         vals=hmap['metricValues']
         mx=vals.max()
         vals=np.exp(-options.dlogndmlim*(mx-vals))
         vals[mask]=0.0
         amask=np.where(mask==False)
         cmin,cmax,cmean=vals[amask].min(), vals[amask].max(), vals[amask].mean()
         print "Window func min, max, mean:",cmin,cmax,cmean
         info="DepthVariationsDepthVariations map=%s dlogndmlim=%f"%(options.humnamap,options.dlogndmlim)
         shortinfo=options.humnamap+"_"+str(options.dlogndmlim)
         WindowHealpix.__init__(self,vals,info,shortinfo)
     else:
         print "DepthVariations really needs options"
         stop()
Exemple #2
0
def registerOptions(parser):
    parser.add_option("--wf_type",dest="wftype",type="string",
                      help="window func type [none,radecbcut,healpix, depthvar]",
                  default="depthvar")
    WindowDecBcut.registerOptions(parser)
    WindowHealpix.registerOptions(parser)
    WindowDepthVariations.registerOptions(parser)
Exemple #3
0
def registerOptions(parser):
    parser.add_option(
        "--wf_type",
        dest="wftype",
        type="string",
        help="window func type [none,radecbcut,healpix, depthvar]",
        default="depthvar")
    WindowDecBcut.registerOptions(parser)
    WindowHealpix.registerOptions(parser)
    WindowDepthVariations.registerOptions(parser)
Exemple #4
0
def getWindowFunc(o):
    if o.wftype == "none":
        return WindowBase()
    elif o.wftype == "radecbcut":
        return WindowDecBcut(options=o)
    elif o.wftype == "healpix":
        return WindowHealpix(options=o)
    elif o.wftype == "depthvar":
        return WindowDepthVariations(options=o)
    else:
        print "Bad WF type:", o.wftype
        stop()
Exemple #5
0
def readWindowH5(dataset):
    ## note that humna map is just a wrapper and gets saved/realoaded from healpix map
    name=dataset.attrs['type']
    ## loop over possible types
    ## (why can't i do 'for t in [WindowBase, WindowDecBcut]:'?)
    toret=WindowBase.readH5(dataset)
    if toret is not None: return toret
    toret=WindowDecBcut.readH5(dataset)
    if toret is not None: return toret
    toret=WindowHealpix.readH5(dataset)
    if toret is not None: return toret
    print "Unknown window type!"
    stop()
Exemple #6
0
def readWindowH5(dataset):
    ## note that humna map is just a wrapper and gets saved/realoaded from healpix map
    name = dataset.attrs['type']
    ## loop over possible types
    ## (why can't i do 'for t in [WindowBase, WindowDecBcut]:'?)
    toret = WindowBase.readH5(dataset)
    if toret is not None: return toret
    toret = WindowDecBcut.readH5(dataset)
    if toret is not None: return toret
    toret = WindowHealpix.readH5(dataset)
    if toret is not None: return toret
    print "Unknown window type!"
    stop()