Esempio n. 1
0
def getSlopes(img,pad=0,retcorr=0):
    """Computes slopes if img is used as a correlation image"""
    d=darc.Control("SH")
    cm=d.Get("centroidMode")
    if type(cm)==numpy.ndarray and numpy.any(cm[-49:]):#in correlation mode.
        cur=getCurrentImg()
        usenow=1
    else:
        cur=makeIdent()
        usenow=0
    sf=d.Get("subapFlag")
    nsub=d.Get("nsub")
    corr=correlation.makeCorrelation(img,cur,3,d.Get("npxlx"),d.Get("npxly"),nsub,d.Get("subapLocation"),sf,pad)

    slopes=calibrate.makeSlopes(corr["correlation"],3,nsub,corr["corrNpxlx"],corr["corrNpxly"],sf,corr["corrSubapLoc"])
    slopes-=0.5#correlation is pixel centred, not 2x2 centred.
    slopes[:288]=0#not using NGS
    if retcorr:
        return slopes,usenow,corr
    else:
        return slopes,usenow
Esempio n. 2
0
def getSlopes(img,pad=0,retcorr=0):
    """Computes slopes if img is used as a correlation image"""
    d=darc.Control("SH")
    cm=d.Get("centroidMode")
    if type(cm)==numpy.ndarray and numpy.any(cm[-49:]):#in correlation mode.
        cur=getCurrentImg()
        usenow=1
    else:
        cur=makeIdent()
        usenow=0
    sf=d.Get("subapFlag")
    nsub=d.Get("nsub")
    corr=correlation.makeCorrelation(img,cur,1,d.Get("npxlx"),d.Get("npxly"),nsub,d.Get("subapLocation"),sf,pad)
#def makeCorrelation(psf,img,ncam,npxlx,npxly,nsub,subapLocation,subflag,pad=None,savespace=0):
#    """Correlates 2 images with optional padding"""
    slopes=calibrate.makeSlopes(corr["correlation"],1,nsub,corr["corrNpxlx"],corr["corrNpxly"],sf,corr["corrSubapLoc"])
#    def makeSlopes(img,ncam,nsub,npxlx,npxly,sf,sl):
#        """Need to subtract 0.5 from the results if a correlation image."""
    slopes-=0.5#correlation is pixel centred, not 2x2 centred.
    slopes[:288]=0#not using NGS
    if retcorr:
        return slopes,usenow,corr
    else:
        return slopes,usenow