예제 #1
0
def test283(image, pscale=None, step=None):
    ''' Return roc on 80 mm spatial scale (thresh = 0.05)

    Parameters
    ----------
        image: masked array
            robust image for the analysis

    Other Parameters
    ----------------
        step: int
            distance between patches

    Returns
    -------
        roc: float
            roc at threshold 0.05
'''
    mask = np.invert(image.mask).astype(int)
    x, y, r, xx, yy = geo.qpupil(mask)
    if pscale is None:
        pscale = r * (1 / 0.17)  #pscale[px/m]
    else:
        pscale = pscale

    print(pscale)
    roc, list_ima, result_vect = patches_analysis(image, 0.04, pscale, step)
    return roc
예제 #2
0
def test243(image, radius_m, pscale=None, step=None, n_patches=None):
    ''' Return rms at the interactuator scale 31 mm or 150 mm (thresh = 0.95)

    Parameters
    ----------
        image: masked array
            robust image for the analysis
        radius_m: int
            radius of circular patch in meters

    Other Parameters
    ----------------
        step: int
            distance between patches
        n_patches: int
            number of patches for the second cut
            (if it is None sw creates a single crop in the center of the image)

    Returns
    -------
        rms: float
            rms at threshold 0.95
'''
    # radius_m = 0.015 or 0.1
    mask = np.invert(image.mask).astype(int)
    x, y, r, xx, yy = geo.qpupil(mask)
    if pscale is None:
        pscale = r * (1 / 0.17)
    else:
        pscale = pscale

    rms, list_ima, result_vect = patches_analysis(image, radius_m, pscale,
                                                  step, n_patches)
    return rms
예제 #3
0
def test242(image, pscale=None):
    '''
    Parameters
    ----------
        image: masked array
            robust image for the analysis

    Returns
    -------
        rms: float
            rms slope in arcsec
    '''
    mask = np.invert(image.mask).astype(int)
    x, y, r, xx, yy = geo.qpupil(mask)
    if pscale is None:
        pscale = r * (1 / 0.17)
    else:
        pscale = pscale

    print(pscale)
    sp = slope(image, pscale)  #pscale [px/m]
    # sp in pixel * fattore di conversione da rad ad arcsec
    slope_arcsec = sp * 206265
    rms = slope_arcsec.std()
    return rms
예제 #4
0
    def create_zmat(self, file_name):
        '''
        Returns
        -------
            zmat: numpy array

        '''
        # file_name = '/Users/rm/Desktop/Arcetri/M4/ProvaCodice/OTT/ott_mask.fits'
        hduList = pyfits.open(file_name)
        final_mask = np.invert(hduList[0].data.astype(bool))

        prova = np.ma.masked_array(np.ones(((2 * OttParameters.parab_radius * OttParameters.pscale).astype(int),
                                            (2 * OttParameters.parab_radius * OttParameters.pscale).astype(int))),
                                   mask=final_mask)
        zernike_mode = np.arange(10) + 1
        mm = np.where(final_mask == False)
        x, y, r, xx, yy = geo.qpupil(final_mask)
        zmat = zernike._getZernike(xx[mm], yy[mm], zernike_mode)
        return zmat
예제 #5
0
def zernikeFit(img, zernike_index_vector):
    '''
    Parameters
    ----------
    img: numpy masked array
        image for zernike fit
    zernike_index_vector: numpy array
        vector containing the index of Zernike modes to be fitted starting from 1

    Returns
    -------
    coeff: numpy array [m]
        vector of zernike coefficients
    mat: numpy array
    '''
    img1 = img.data
    mask = np.invert(img.mask).astype(int)
    x, y, r, xx, yy = geo.qpupil(mask)
    mm = (mask==1)
    coeff = _surf_fit(xx[mm], yy[mm], img1[mm], zernike_index_vector)
    mat = _getZernike(xx[mm], yy[mm], zernike_index_vector)
    return coeff, mat
예제 #6
0
 def testGeometry(self):
     img = np.random.rand(500, 500)
     masked_ima = geo.draw_mask(img, 250, 250, 50)
     geo.qpupil(masked_ima)
     geo.rotate(img, 30)