コード例 #1
0
    def subap_layer_positions_atSeparations(self):
        """Calculates the position of every sub-aperture pairing (within the covariance map ROI) in the telescope's pupil. 
		The number of sub-aperture pairings at each covariance map ROI data point is also calculated so that mean 
		covariance can be found."""

        covMapDim = (self.pupil_mask.shape[0] * 2) - 1
        onesMat = numpy.ones(
            (int(self.pupil_mask.sum()), int(self.pupil_mask.sum())))
        wfs_subap_pos = (numpy.array(numpy.where(self.pupil_mask == 1)).T *
                         self.tel_diam / self.pupil_mask.shape[0])
        onesMM, onesMMc, mapDensity = get_mappingMatrix(
            self.pupil_mask, onesMat)

        xPosMM, xMMc, d = get_mappingMatrix(self.pupil_mask,
                                            onesMat * wfs_subap_pos.T[0])
        yPosMM, yMMc, d = get_mappingMatrix(self.pupil_mask,
                                            onesMat * wfs_subap_pos.T[1])

        xPosMM[onesMM == 0] = numpy.nan
        yPosMM[onesMM == 0] = numpy.nan
        ySeps = numpy.ones(
            (self.combs, self.roi_width, self.roi_length, self.nx_subap**
             2)) * numpy.nan
        xSeps = numpy.ones(
            (self.combs, self.roi_width, self.roi_length, self.nx_subap**
             2)) * numpy.nan
        self.meanDenominator = numpy.zeros(self.cov_xx[..., 0].shape)
        self.subap_sep_positions = numpy.ones(
            (self.combs, self.roi_width, self.roi_length, self.nx_subap**2, 2))
        self.allMapPos[self.allMapPos >= covMapDim] = 0.

        for comb in range(self.combs):

            mmLocations = (covMapDim * self.allMapPos[comb, :, :, 0]
                           ) + self.allMapPos[comb, :, :, 1]
            self.meanDenominator[comb] = onesMM[:, mmLocations].sum(0)
            ySepsMM = -yPosMM[:, mmLocations]
            xSepsMM = -xPosMM[:, mmLocations]

            for env in range(self.roi_width):
                for l in range(self.roi_length):

                    ySeps[comb, env, l] = ySepsMM[:, env, l]
                    xSeps[comb, env, l] = xSepsMM[:, env, l]

            self.subap_sep_positions[comb, :, :, :, 0] = xSeps[comb]
            self.subap_sep_positions[comb, :, :, :, 1] = ySeps[comb]

        # stop
        # self.meanDenominator[0] = mapDensity
        self.meanDenominator[self.meanDenominator == 0] = 1.
        self.meanDenominator = numpy.stack([self.meanDenominator] *
                                           self.n_layer, 3)
コード例 #2
0
    # subap_diam = numpy.array([0.205]*n_wfs)
    # n_subap = numpy.array([1248]*n_wfs)
    # nx_subap = numpy.array([40]*n_wfs)

    # """HARMONI"""
    # tel_diam = 39.0
    # obs_diam = 4.0
    # subap_diam = numpy.array([0.507]*n_wfs)
    # n_subap = numpy.array([4260]*n_wfs)
    # nx_subap = numpy.array([74]*n_wfs)

    pupil_mask = make_pupil_mask('circle', n_subap, nx_subap[0], obs_diam,
                                 tel_diam)

    matrix_region_ones = numpy.ones((n_subap[0], n_subap[0]))
    mm, mmc, md = get_mappingMatrix(pupil_mask, matrix_region_ones)

    onesMat, wfsMat_1, wfsMat_2, allMapPos, selector, xy_separations = roi_referenceArrays(
        pupil_mask, gs_pos, tel_diam, roi_belowGround, roi_envelope)

    params = covariance_roi(pupil_mask,
                            subap_diam,
                            wavelength,
                            tel_diam,
                            n_subap,
                            gs_alt,
                            gs_pos,
                            n_layer,
                            layer_alt,
                            L0,
                            allMapPos,
コード例 #3
0
    		
	return cov_map


if __name__ == '__main__':
	"""Test CANARY"""
	# n_wfs = 2
	# nx_subap = numpy.array([7, 7])
	# n_subap = numpy.array([36, 36])
	# tel_diam = 4.2
	# obs_diam = 1.0
	# roi_axis = 'x+y'
	# pupil_mask = make_pupil_mask('circle', numpy.array([n_subap[0]]), nx_subap[0], obs_diam, tel_diam)
	# mm, mmc, md = get_mappingMatrix(pupil_mask, numpy.ones((n_subap[0], n_subap[0])))

	# cov_matrix = numpy.ones((n_wfs * n_subap[0] * 2, n_wfs * n_subap[0] * 2))
	# cov_map  = covMap_fromMatrix(cov_matrix, n_wfs, nx_subap, n_subap, pupil_mask, roi_axis, mm, mmc, md)


	"""Test AOF"""
	n_wfs = 1
	nx_subap = numpy.array([40, 40])
	n_subap = numpy.array([1240, 1240])
	tel_diam = 8.2
	obs_diam = 1.1
	roi_axis = 'x+y'
	pupil_mask = make_pupil_mask('circle', numpy.array([n_subap[0]]), nx_subap[0], obs_diam, tel_diam)
	mm, mmc, md = get_mappingMatrix(pupil_mask, numpy.ones((n_subap[0], n_subap[0])))

	cov_matrix = numpy.ones((n_wfs * n_subap[0] * 2, n_wfs * n_subap[0] * 2))
	cov_map  = covMap_fromMatrix(cov_matrix, n_wfs, nx_subap, n_subap, pupil_mask, roi_axis, mm, mmc, md)
コード例 #4
0
    def __init__(self,
                 pupil_mask,
                 subap_diam,
                 wavelength,
                 tel_diam,
                 n_subap,
                 gs_alt,
                 gs_pos,
                 n_layer,
                 layer_alt,
                 r0,
                 L0,
                 styc_method=True,
                 wind_profiling=False,
                 tt_track_present=False,
                 lgs_track_present=False,
                 offset_present=False,
                 fit_layer_alt=False,
                 fit_tt_track=False,
                 fit_lgs_track=False,
                 fit_offset=False,
                 fit_L0=False,
                 matrix_xy=True,
                 huge_matrix=False,
                 l3s1_transform=False,
                 l3s1_matrix=None,
                 remove_tt=False,
                 remove_tt_matrix=None):
        """Configuration used to generate covariance matrix.

		Parameters:
			pupil_mask (ndarray): mask of SHWFS sub-apertures within the telescope's pupil.
			subap_diam (ndarray): diameter of SHWFS sub-aperture in telescope's pupil.
			wavelength (ndarray): SHWFS centroid wavelengh (nm).
			tel_diam (float): diameter of telescope pupil.
			n_subap (ndarray): number of sub-apertures within each SHWFS.
			gs_alt (ndarray): GS altitude. 0 for NGS (LGS not tested!).
			gs_pos (ndarray): GS asterism in telescope FoV.
			n_layer (int): number of turbulent layers.
			layer_alt (ndarray): altitudes of turbulent layers (m).
			wind_profiling (bool): determines whether covariance map ROI is to be used for wind profiling.
			tt_track_present (bool): generate covariance map ROI with linear additions to covariance (from vibrations/track).
			offset_present (bool): determines whether covariance map ROI is to account for a SHWFS shift/rotation.
			fit_tt_track (bool): determines whether the generated covariance matrix is to fit track.
			fit_offset (bool): determines whether the generated covariance matrix is to fit SHWFS shift/rotation.
			fit_L0 (bool): determines whether generated covariance map ROI is to be used for L0 profiling.
			r0 (ndarray): r0 profile (m).
			L0 (ndarray): L0 profile (m).
			styc_method (bool): use styc method of analytically generating covariance.
			matrix_xy (bool): generate orthogonal covariance e.g. x1y1.
			huge_matrix (bool): if array size n_layer * cov_matrix is too big, reduce to cov_matrix (takes longer to generate)."""

        self.n_wfs = gs_pos.shape[0]
        self.subap_diam = subap_diam
        self.wavelength = wavelength
        self.tel_diam = tel_diam
        self.pupil_mask = pupil_mask
        self.n_subap_from_pupilMask = int(self.pupil_mask.sum())
        self.gs_alt = gs_alt
        # Swap X and Y GS positions to agree with legacy code
        self.gs_pos = gs_pos[:, ::-1]
        self.n_layer = n_layer
        self.layer_alt = layer_alt
        self.combs = int(comb(gs_pos.shape[0], 2, exact=True))
        selector = numpy.array((range(self.n_wfs)))
        self.selector = numpy.array((list(itertools.combinations(selector,
                                                                 2))))
        self.n_subap = n_subap
        self.total_subaps = int(numpy.sum(self.pupil_mask) * self.n_wfs)
        self.styc_method = styc_method
        self.radSqaured_to_arcsecSqaured = ((180. / numpy.pi) * 3600)**2
        self.fit_L0 = fit_L0
        self.translation = numpy.zeros((self.n_layer, self.n_wfs, 2))
        self.subap_layer_diameters = numpy.zeros(
            (self.n_layer, self.n_wfs)).astype("float64")
        self.wind_profiling = wind_profiling
        self.offset_present = offset_present
        self.fit_layer_alt = fit_layer_alt
        self.fit_offset = fit_offset
        self.offset_set = False
        self.matrix_xy = matrix_xy
        self.scale_factor = numpy.zeros((n_layer, self.n_wfs))

        self.tt_track_set = False
        self.fit_tt_track = fit_tt_track
        self.tt_track_present = tt_track_present
        if self.fit_tt_track == True or self.tt_track_present == True:
            self.tt_trackMatrix_locs = tt_trackMatrix_locs(
                2 * self.n_subap_from_pupilMask * self.n_wfs,
                self.n_subap_from_pupilMask)
            self.tt_track = numpy.zeros(
                (self.tt_trackMatrix_locs.shape)).astype('float64')

        self.lgs_track_set = False
        self.fit_lgs_track = fit_lgs_track
        self.lgs_track_present = lgs_track_present
        if self.fit_lgs_track == True or self.lgs_track_present == True:
            self.lgs_trackMatrix_locs = matrix_lgs_trackMatrix_locs(
                2 * self.n_subap_from_pupilMask * self.n_wfs, self.n_subap,
                self.n_subap_from_pupilMask)
            self.lgs_track = numpy.zeros(
                (self.lgs_trackMatrix_locs.shape)).astype('float64')

        #make l3s1 transform matrix
        self.l3s1_transform = l3s1_transform
        if l3s1_transform == True:
            if l3s1_matrix is None:
                self.l3s1_matrix = transform_matrix(
                    numpy.array([self.n_subap_from_pupilMask] * self.n_wfs),
                    self.n_wfs)
            else:
                self.l3s1_matrix = l3s1_matrix

        #make matrix for removing tip-tilt
        self.remove_tt = remove_tt
        if remove_tt == True:
            if remove_tt_matrix is None:
                self.remove_tt_matrix = tt_removal_matrix(
                    self.n_subap_from_pupilMask, self.n_wfs)
            else:
                self.remove_tt_matrix = remove_tt_matrix

        #parameters required for fast generation of aligned/auto covariance
        mat_roi = numpy.ones(
            (int(self.pupil_mask.sum()), int(self.pupil_mask.sum())))
        self.mm, mmc, md = get_mappingMatrix(self.pupil_mask, mat_roi)
        mapOnes = covMap_superFast((pupil_mask.shape[0] * 2) - 1, mat_roi,
                                   self.mm, mmc, md)
        self.flatMM = mapOnes.flatten().astype('int')
        self.fill_xx = numpy.zeros(self.flatMM.shape)
        self.fill_yy = numpy.zeros(self.flatMM.shape)
        self.fill_xy = numpy.zeros(self.flatMM.shape)

        loc_mapOnes = numpy.where(mapOnes == 1)
        covMapDim = (self.pupil_mask.shape[0] * 2) - 1

        xMapSep = numpy.ones((covMapDim, covMapDim)) * numpy.arange(
            -(pupil_mask.shape[0] - 1),
            (pupil_mask.shape[0])) * self.tel_diam / pupil_mask.shape[0]
        xMapSepFlat = xMapSep.flatten()
        yMapSep = xMapSep.copy().T
        yMapSepFlat = yMapSep.flatten()

        yloc_mapOnes = xMapSep[loc_mapOnes[0], loc_mapOnes[1]]
        xloc_mapOnes = yMapSep[loc_mapOnes[0], loc_mapOnes[1]]

        if self.offset_present == False and self.fit_offset == False:
            self.subap_positions = [False] * self.n_wfs
            self.xy_separations = numpy.array((xloc_mapOnes, yloc_mapOnes)).T

        if self.offset_present == True or self.fit_offset == True:
            self.subap_positions_wfsAlignment = numpy.zeros(
                (self.n_wfs, self.n_subap_from_pupilMask, 2)).astype("float64")
            wfs_subap_pos = (numpy.array(numpy.where(self.pupil_mask == 1)).T *
                             self.tel_diam / self.pupil_mask.shape[0])
            self.subap_positions = numpy.array([wfs_subap_pos] * self.n_wfs)

            self.auto_xy_separations = numpy.array(
                (xloc_mapOnes, yloc_mapOnes)).T

        if huge_matrix == True:
            print('\n' + 'THIS MATRIX BE HUUUUGGGEEEE')
            self.huge_matrix = True
        else:
            self.huge_matrix = False

        # Compile covariance matrix
        if self.huge_matrix == False:
            self.covariance_matrix = numpy.zeros(
                (self.n_layer, 2 * self.total_subaps,
                 2 * self.total_subaps)).astype("float64")
        else:
            self.cov_mat = numpy.zeros(
                (2 * self.total_subaps,
                 2 * self.total_subaps)).astype("float64")
            self.covariance_matrix = numpy.zeros(
                (2 * self.total_subaps,
                 2 * self.total_subaps)).astype("float64")

        if self.fit_layer_alt == False:
            #calculate fixed parameters
            self.subap_parameters()

        self.timingStart = time.time()
        if self.fit_L0 == self.offset_present == self.fit_offset == self.wind_profiling == self.huge_matrix == False:
            self.compile_matrix(r0, L0)
コード例 #5
0
def roi_referenceArrays(pupil_mask, gs_pos, tel_diam, belowGround, envelope):
    """Collection of arrays used to simplify covariance map ROI processing.
    
    Parameters:
        pupil_mask (ndarray): mask of sub-aperture positions within telescope pupil.
        gs_pos (ndarray): GS positions.
        tel_diam (float): telescope diameter.
        belowGround (int): number of sub-aperture separations the ROI expresses 'below-ground'.
        envelope (int): number of sub-aperture separations the ROI expresses either side of stellar separation.

    Returns:
        mm (ndarray): Mapping Matrix.
        sa_mm (ndarray): Mapping Matrix sub-aperture numbering of SHWFS 1.
        sb_mm (ndarray): Mapping Matrix sub-aperture numbering of SHWFS 2.
        allMapPos (ndarray): ROI coordinates in each covariance map combination.
        selector (ndarray): array of all covariance map combinations.
        xy_separations (ndarray): x and y sub-aperture separations corresponding to allMapPos."""

    #Collect mapping matrix (mm), x/y sub-aperture mapping matrix
    nxSubaps = pupil_mask.shape[0]
    subapDiam = tel_diam / nxSubaps
    nSubaps = numpy.int(numpy.sum(pupil_mask))
    covMapDim = (nxSubaps * 2) - 1
    blankCovMap = numpy.zeros((covMapDim, covMapDim))
    posMatrix = numpy.ones((nSubaps, nSubaps))

    #mm - mapping matrix, mmc - mapping matrix coordinates, md - map denominator
    # mm, mmc, md = get_mappingMatrix(numpy.fliplr(pupil_mask), posMatrix)
    # mm, mmc, md = get_mappingMatrix(numpy.fliplr(pupil_mask), posMatrix)
    mm, mmc, md = get_mappingMatrix(pupil_mask, posMatrix)
    mm = mm.astype(int)
    onesMap = covMap_superFast(covMapDim, posMatrix, mm, mmc, md)
    nanMap = onesMap.copy()
    nanMap[nanMap == 0] = numpy.nan

    #sa_mm - mm sub-aperture numbering of shwfs1, sb_mm - mm sub-aperture numbering of shwfs2
    sa_mm, mmc, md = get_mappingMatrix(pupil_mask,
                                       posMatrix * numpy.arange(nSubaps)[::-1])
    sb_mm, mmc, md = get_mappingMatrix(
        pupil_mask, numpy.rot90(posMatrix * numpy.arange(nSubaps)[::-1], 3))
    # sb_mm, mmc, md = get_mappingMatrix(pupil_mask, posMatrix*numpy.arange(nSubaps))
    # sa_mm, mmc, md = get_mappingMatrix(pupil_mask, numpy.rot90(posMatrix*numpy.arange(nSubaps),3))
    sa_mm = sa_mm.astype(int)
    sb_mm = sb_mm.astype(int)

    #Determine no. of GS combinations
    combs = int(comb(gs_pos.shape[0], 2, exact=True))
    selector = numpy.array((range(gs_pos.shape[0])))
    selector = numpy.array((list(itertools.combinations(selector, 2))))
    # fakePosMap, b, t = gamma_vector(blankCovMap, 1, 'False', belowGround, envelope, False)
    # print('No. of GS combinations:', combs, '\n')

    #Sub-aperture postions for generateSliceCovariance and map vectors for mapSliceFromSlopes
    sliceWidth = 1 + (2 * envelope)
    sliceLength = pupil_mask.shape[0] + belowGround
    subapNum = numpy.ones((2, combs, sliceWidth, sliceLength))
    subapLocations = numpy.zeros((2, combs, sliceWidth, sliceLength, 2))
    subapLocations1 = numpy.zeros((combs, sliceWidth, sliceLength, 2))
    subapLocations2 = numpy.zeros((combs, sliceWidth, sliceLength, 2))

    allMapPos = numpy.zeros((combs, sliceWidth, sliceLength, 2)).astype(int)
    vectorMap = numpy.zeros(
        (combs * blankCovMap.shape[0], blankCovMap.shape[1]))
    refArray = arrayRef(pupil_mask)

    #x and y separations in covariance map space - used to get xy_separations
    yMapSep_square = numpy.ones(nanMap.shape) * numpy.arange(
        -(pupil_mask.shape[0] - 1),
        (pupil_mask.shape[0])) * tel_diam / pupil_mask.shape[0]
    # yMapSep = nanMap.copy() * numpy.arange(-(pupil_mask.shape[0]-1), (pupil_mask.shape[0])) * tel_diam/pupil_mask.shape[0]
    yMapSep = nanMap.copy() * yMapSep_square
    xMapSep = nanMap.copy() * yMapSep_square.T
    xy_separations = numpy.zeros((combs, sliceWidth, sliceLength, 2))

    # stop
    for k in range(combs):
        posMap = 0.
        posMap, vector, t = gamma_vector(blankCovMap, 'False',
                                         gs_pos[selector[k]], belowGround,
                                         envelope,
                                         False)  #gets covariance map vector
        # posMap[:,:,0] = numpy.flipud(posMap[:,:,0])
        # posMap[:,:,1] = numpy.flipud(posMap[:,:,1])
        # vector = numpy.rot90(vector,1)

        xy_separations[k] = numpy.stack(
            (xMapSep[posMap.T[0], posMap.T[1]], yMapSep[posMap.T[0],
                                                        posMap.T[1]])).T

        #Make all vector coordinates off-map 2*covMapDiam
        for i in range(posMap.shape[0]):
            for j in range(posMap.shape[1]):
                if onesMap[posMap[i, j, 0], posMap[i, j, 1]] == 0:
                    posMap[i, j] = 2 * covMapDim, 2 * covMapDim

        #Sub-aperture positions for specific GS combination. All non-positions are nan
        subapPos1 = numpy.ones(posMap.shape) * numpy.nan
        subapPos2 = numpy.ones(posMap.shape) * numpy.nan

        for i in range(posMap.shape[0]):
            subapPos = []
            for j in range(posMap.shape[1]):
                if posMap[i, j, 0] != 2 * covMapDim:
                    pupil_mask1 = numpy.zeros(pupil_mask.shape)
                    pupil_mask2 = numpy.zeros(pupil_mask.shape)

                    #Sub-aperture numbers that correspond to the required covariance measurements. Uses mapping matrix as look-up table.
                    subapNum1 = sa_mm[:, posMap[i, j, 0] * covMapDim +
                                      (posMap[i, j, 1])][numpy.where(
                                          mm[:, posMap[i, j, 0] * covMapDim +
                                             (posMap[i, j, 1])] == 1)[0]][0]
                    subapNum2 = sb_mm[:, posMap[i, j, 0] * covMapDim +
                                      (posMap[i, j, 1])][numpy.where(
                                          mm[:, posMap[i, j, 0] * covMapDim +
                                             (posMap[i, j, 1])] == 1)[0]][0]
                    # print subapNum1, '\n'
                    subapNum[0, k, i, j] = subapNum1
                    subapNum[1, k, i, j] = subapNum2

                    #Converts first set of sub-aperture to their displacement from the centre of the telescope's pupil.
                    pupil_mask1[numpy.where(refArray == subapNum1)] = 1
                    subapPos1[i, j] = numpy.asarray(
                        numpy.where(pupil_mask1 == 1)).T * subapDiam
                    # subapPos1[i,j] -= tel_diam/2.
                    # subapPos1[i,j] += subapDiam/2.

                    #Converts second set of sub-aperture to their displacement from the centre of the telescope's pupil.
                    pupil_mask2[numpy.where(refArray == subapNum2)] = 1
                    subapPos2[i, j] = numpy.asarray(
                        numpy.where(pupil_mask2 == 1)).T * subapDiam
                    # subapPos2[i,j] -= tel_diam/2.
                    # subapPos2[i,j] += subapDiam/2.

        subapLocations1[k] = subapPos1
        subapLocations2[k] = subapPos2
        allMapPos[k] = posMap
        vectorMap[k * blankCovMap.shape[0]:(k + 1) *
                  blankCovMap.shape[0]] = vector

    #subapPositons is a list of shape (2, combs, 1+2*envelope, vectorLength (i.e. 7/8 for CANARY), 2)
    subapLocations[0] = subapLocations1
    subapLocations[1] = subapLocations2
    # subapLocations.append(subapLocations1)
    # subapLocations.append(subapLocations2)

    subapPos.append(subapPos1[0])
    subapPos.append(subapPos2[0])

    # stop

    # print('\n'+'################ REFERENCE ARRAYS OBTAINED ###############', '\n')
    return mm, sa_mm, sb_mm, allMapPos, selector, xy_separations
コード例 #6
0
ファイル: wind_profiler.py プロジェクト: frigaut/caw
    def __init__(self, turb_results, wind_config_file):
        """Fixes variables from config_file that are to be used to complete turbulence profiling.

        Parameters:
        config_file (dict): fitting specifications set in imported yaml configuration file."""

        self.turb_results = turb_results
        self.tel_diam = self.turb_results.tel_diam
        self.n_wfs = self.turb_results.n_wfs
        self.n_subap = self.turb_results.n_subap
        self.n_subap_from_pupilMask = turb_results.n_subap_from_pupilMask
        self.nx_subap = self.turb_results.nx_subap
        self.pupil_mask = self.turb_results.pupil_mask
        self.shwfs_centroids = self.turb_results.shwfs_centroids
        self.gs_pos = self.turb_results.gs_pos
        self.n_layer = self.turb_results.n_layer
        self.observable_bins = self.turb_results.observable_bins
        self.offset_present = self.turb_results.offset_present
        self.cn2_noiseFloor = self.turb_results.cn2_noiseFloor
        self.L0 = self.turb_results.L0
        self.tt_track = self.turb_results.tt_track
        self.lgs_track = self.turb_results.lgs_track
        self.combs = self.turb_results.combs
        self.selector = self.turb_results.selector
        self.shwfs_shift = self.turb_results.shwfs_shift
        self.shwfs_rot = self.turb_results.shwfs_rot

        target_conf = wind_config_file.configDict["OFFSET TARGET ARRAY"]
        self.input_shwfs_centroids = target_conf["input_shwfs_centroids"]
        self.roi_via_matrix = target_conf["roi_via_matrix"]
        self.reduce_SL = target_conf["reduce_SL"]
        self.zeroSep_cov = target_conf["zeroSep_cov"]
        self.input_frame_count = target_conf["input_frame_count"]
        self.num_offsets = target_conf["num_offsets"]
        self.offset_step = target_conf["offset_step"]
        self.temporal_step = numpy.round(
            float(self.offset_step) / float(self.num_offsets)).astype('int')
        self.include_temp0 = target_conf["include_temp0"]
        self.minus_negativeTemp = target_conf["minus_negativeTemp"]
        self.separate_pos_neg_offsets = target_conf["separate_pos_neg_offsets"]
        self.wind_roi_belowGround = target_conf["roi_belowGround"]
        self.wind_roi_envelope = target_conf["roi_envelope"]
        self.wind_map_axis = target_conf["map_axis"]
        self.wind_mapping_type = target_conf["mapping_type"]

        fit_params = wind_config_file.configDict["FITTING ALGORITHM"]
        self.delta_xSep = numpy.array(
            fit_params["delta_xSep"]).astype('float64')
        self.delta_ySep = numpy.array(
            fit_params["delta_ySep"]).astype('float64')
        if len(self.delta_xSep) != self.n_layer:
            raise Exception('Check length of wind parameters with n_layer.')

        if self.reduce_SL == True:
            if self.n_wfs != 4:
                raise Exception(
                    'To reduce the data there must be 4 GSs in a square asterism.'
                )
            if self.offset_present == True:
                raise Exception(
                    'When reducing square layout optical alignment must be assumed.'
                )

        fit_conf = wind_config_file.configDict["FITTING ALGORITHM"]
        self.fitting_type = fit_conf["type"]
        self.fit_layer_alt = fit_conf["fit_layer_alt"]
        self.fit_deltaXYseps = fit_conf["fit_deltaXYseps"]
        self.print_fiting = fit_conf["print_fitting"]

        self.onesMat, self.wfsMat_1, self.wfsMat_2, self.allMapPos, self.selector, self.xy_separations = roi_referenceArrays(
            self.pupil_mask, self.gs_pos, self.tel_diam,
            self.wind_roi_belowGround, self.wind_roi_envelope)
        if self.reduce_SL == True:
            # stop
            self.selector = numpy.array(([[0, 1], [0, 2], [0, 3], [1, 2],
                                          [1, 3], [3, 2]]))

        if self.zeroSep_cov == False:
            roi_width = (2 * self.wind_roi_envelope) + 1
            roi_length = self.pupil_mask.shape[0] + self.wind_roi_belowGround
            self.zeroSep_locations = roi_zeroSep_locations(
                self.combs, roi_width, roi_length, self.wind_map_axis,
                self.wind_roi_belowGround)
        else:
            self.zeroSep_locations = numpy.nan

        if self.minus_negativeTemp == True:
            self.mult_neg_offset = -1.
        else:
            self.mult_neg_offset = 1.

        if wind_config_file.configDict["FITTING ALGORITHM"][
                "type"] == 'direct':
            self.fit_method = 'Direct Fit'
            self.direct_wind = True
            self.l3s_wind = False
            self.l3s1_matrix = numpy.nan

        if wind_config_file.configDict["FITTING ALGORITHM"]["type"] == 'l3s':
            self.fit_method = 'L3S Fit'
            self.l3s_wind = True
            self.direct_wind = False
            if self.turb_results.l3s_fit == True:
                self.l3s1_matrix = self.turb_results.l3s1_matrix
            else:
                self.l3s1_matrix = transform_matrix(
                    self.n_subap_from_pupilMask, self.n_wfs)

        if self.turb_results.covariance_map == True or self.turb_results.covariance_map_roi == True:
            self.mm = self.turb_results.mm
            self.mmc = self.turb_results.mmc
            self.md = self.turb_results.md
        else:
            matrix_region_ones = numpy.ones((self.n_subap_from_pupilMask[0],
                                             self.n_subap_from_pupilMask[0]))
            self.mm, self.mmc, self.md = get_mappingMatrix(
                self.pupil_mask, matrix_region_ones)

        print('\n' +
              '############ WIND PROFILING PARAMETERS SECURE #############')