Exemple #1
0
    def compressRawData2(self, showProgress=True):
        """
        Omega-K compressing algorithm
        1) FFT 2D
        2) Reference Function Multiplication
        3) Stolt interpolation
        4) IFFT 2D
        Returns (compressed 2D array, azimuth positions, range time)
        """
        rawData = self._rawData
        assert rawData is not None, logPrint(
            "Raw data should be computed ( using computeRawData() ) or provided as argument"
        )
        assert self._dt is not None, logPrint(
            "Error : Simulator badly configured, dt is None")
        assert self._dx is not None, logPrint(
            "Error : Simulator badly configured, dx is None")
        assert self._xArray is not None, logPrint(
            "Error : Simulator badly configured, xArray is None")
        assert self._tArray is not None, logPrint(
            "Error : Simulator badly configured, tArray is None")

        Tp = self._platform.Tp
        Vsat = self._platform.Vsat
        K = self._platform.K
        PRF = self._platform.PRF
        H = self._platform.H
        Lambda = self._platform.Lambda
        f0 = self._platform.Freq

        # 1) 2D freq domain
        if showProgress:
            logPrint(" - 2D FFT ...")

        fRangeArray = GC.freq(rawData.shape[1], 1.0 / self._dt)
        fAzimuthArray = GC.freq(rawData.shape[0], Vsat / self._dx)

        procData = rawData
        procData = GC.fft2(procData)

        if self.verbose:
            showResponse(procData, None, '2D FFT')

        # 2) RFM
        if showProgress:
            logPrint(" -- RMF ...")

        # Reference distance
        tZero = self._tArray[len(self._tArray) / 2]
        etaZero = self._xArray[len(self._xArray) / 2] / Vsat
        Rref = 0.5 * GC.C * tZero
        Vref = Vsat
        phaseRef = generateRefPhase(fAzimuthArray, fRangeArray, f0, Rref, Vref,
                                    K, Tp, tZero, etaZero)

        procData = procData * phaseRef
        if self.verbose:
            ##            showReImAbsPhaseResponse(phaseRef, None, 'Reference Phase')
            showResponse(procData, None, 'RFM')

        # 3) Stolt mapping
        if showProgress:
            logPrint(" --- Stolt mapping ...")

        # For azimuth line :
        for i, f in enumerate(fAzimuthArray):
            #
            # Here we need analytical inverse of Stolt mapping :
            # f' + f0 = sqrt( (f0 + f)^2 - (c * fEta / (2*Vsat))^2 )
            #
            # f + f0 = + sqrt( (f0 + f')^2 + (c * fEta / (2*Vsat))^2 )
            #
            nfRangeArray = -f0 + np.sqrt((f0 + fRangeArray)**2 +
                                         (0.5 * GC.C * f / Vsat)**2)

            yRe = np.real(procData[i, :])
            yIm = np.imag(procData[i, :])
            yRe = np.interp(nfRangeArray, fRangeArray, yRe)
            yIm = np.interp(nfRangeArray, fRangeArray, yIm)
            procData[i, :] = yRe + 1j * yIm

        if self.verbose:
            showReImAbsPhaseResponse(procData, None, 'Stolt mapping')

        # 4) 2D IFFT
        if showProgress:
            logPrint(" ---- 2D IFFT ...")

        procData = GC.ifft2(procData)

        if self.verbose:
            showResponse(procData, None, '2D IFFT')

        return procData, self._xArray, self._tArray
    def compressRawData2(self, showProgress=True):
        """
        Omega-K compressing algorithm
        1) FFT 2D
        2) Reference Function Multiplication
        3) Stolt interpolation
        4) IFFT 2D
        Returns (compressed 2D array, azimuth positions, range time)
        """
        rawData = self._rawData
        assert rawData is not None, logPrint("Raw data should be computed ( using computeRawData() ) or provided as argument")
        assert self._dt is not None, logPrint("Error : Simulator badly configured, dt is None")
        assert self._dx is not None, logPrint("Error : Simulator badly configured, dx is None")
        assert self._xArray is not None, logPrint("Error : Simulator badly configured, xArray is None")
        assert self._tArray is not None, logPrint("Error : Simulator badly configured, tArray is None")

        Tp = self._platform.Tp
        Vsat = self._platform.Vsat
        K = self._platform.K
        PRF = self._platform.PRF
        H = self._platform.H
        Lambda = self._platform.Lambda
        f0 = self._platform.Freq

        # 1) 2D freq domain
        if showProgress:
            logPrint(" - 2D FFT ...")

        fRangeArray = GC.freq(rawData.shape[1], 1.0/self._dt)
        fAzimuthArray = GC.freq(rawData.shape[0], Vsat/self._dx)

        procData = rawData
        procData = GC.fft2(procData)

        if self.verbose:
            showResponse(procData, None, '2D FFT')


        # 2) RFM
        if showProgress:
            logPrint(" -- RMF ...")

        # Reference distance
        tZero = self._tArray[len(self._tArray)/2]
        etaZero = self._xArray[len(self._xArray)/2] / Vsat
        Rref = 0.5 * GC.C * tZero
        Vref = Vsat
        phaseRef = generateRefPhase(fAzimuthArray, fRangeArray, f0, Rref, Vref, K, Tp, tZero, etaZero)

        procData = procData * phaseRef
        if self.verbose:
##            showReImAbsPhaseResponse(phaseRef, None, 'Reference Phase')
            showResponse(procData, None, 'RFM')

        # 3) Stolt mapping
        if showProgress:
            logPrint(" --- Stolt mapping ...")

        # For azimuth line :
        for i, f in enumerate(fAzimuthArray):
            #
            # Here we need analytical inverse of Stolt mapping :
            # f' + f0 = sqrt( (f0 + f)^2 - (c * fEta / (2*Vsat))^2 )
            #
            # f + f0 = + sqrt( (f0 + f')^2 + (c * fEta / (2*Vsat))^2 )
            #
            nfRangeArray = -f0 + np.sqrt( (f0 + fRangeArray)**2 + ( 0.5 * GC.C * f / Vsat)**2 )

            yRe = np.real(procData[i,:])
            yIm = np.imag(procData[i,:])
            yRe = np.interp(nfRangeArray, fRangeArray, yRe)
            yIm = np.interp(nfRangeArray, fRangeArray, yIm)
            procData[i,:] = yRe + 1j * yIm

        if self.verbose:
            showReImAbsPhaseResponse(procData, None, 'Stolt mapping')

        # 4) 2D IFFT
        if showProgress:
            logPrint(" ---- 2D IFFT ...")

        procData = GC.ifft2(procData)

        if self.verbose:
            showResponse(procData, None, '2D IFFT')

        return procData, self._xArray, self._tArray
Exemple #3
0
    Rref = np.sqrt(Sensor.H**2 + yc**2)
    # Relative reference distance to Rmin
    ymin = Sensor.H * np.tan(54.995 * np.pi / 180.0)
    Rref2 = Rref - np.sqrt(Sensor.H**2 + ymin**2)
    Vref = Sensor.Vsat

    dt = 1.0 / (1.4 * np.abs(Sensor.K) * Sensor.Tp)
    dx = Vref / Sensor.PRF

    fRangeArray = GC.freq(2 * 1024, 1.0 / dt)
    fAzimuthArray = GC.freq(2 * 1024, Vref / dx)

    phaseRef = generateRefPhase(fAzimuthArray, fRangeArray, Sensor.Freq, Rref2,
                                Vref, Sensor.K, Sensor.Tp)

    Sref = GC.ifft2(phaseRef)
    showResponse(Sref)

    exit()

    ##    filename = "C:\\VFomin_folder\\PISE_project\\SAR-GMTI\\Data\\CSK_RAW_0340_B001_2689_15971_3028_3027.npy"
    ##    pt = [2689,15971]

    ##    filename = "C:\\VFomin_folder\\PISE_project\\SAR-GMTI\\Data\\CSK_RAW_0340_B001_10255_8742_3195_3195.npy"
    ##    pt = [10255,8742]

    ##    filename = "C:\\VFomin_folder\\PISE_project\\SAR-GMTI\\Data\\CSK_RAW_0340_B001_19165_15130_3532_3364.npy"
    ##    pt = [19165,15130]

    ##    data = np.load(filename)
    ##    print data.shape, data.dtype
    # Absolute reference distance
    Rref = np.sqrt(Sensor.H**2 + yc**2)
    # Relative reference distance to Rmin
    ymin = Sensor.H * np.tan(54.995 * np.pi / 180.0)
    Rref2 = Rref - np.sqrt(Sensor.H**2 + ymin**2)
    Vref = Sensor.Vsat

    dt = 1.0/(1.4*np.abs(Sensor.K) * Sensor.Tp)
    dx = Vref/Sensor.PRF

    fRangeArray = GC.freq(2*1024, 1.0/dt)
    fAzimuthArray = GC.freq(2*1024, Vref/dx)

    phaseRef = generateRefPhase(fAzimuthArray, fRangeArray, Sensor.Freq, Rref2, Vref, Sensor.K, Sensor.Tp)

    Sref = GC.ifft2(phaseRef)
    showResponse(Sref)


    exit()

##    filename = "C:\\VFomin_folder\\PISE_project\\SAR-GMTI\\Data\\CSK_RAW_0340_B001_2689_15971_3028_3027.npy"
##    pt = [2689,15971]

##    filename = "C:\\VFomin_folder\\PISE_project\\SAR-GMTI\\Data\\CSK_RAW_0340_B001_10255_8742_3195_3195.npy"
##    pt = [10255,8742]

##    filename = "C:\\VFomin_folder\\PISE_project\\SAR-GMTI\\Data\\CSK_RAW_0340_B001_19165_15130_3532_3364.npy"
##    pt = [19165,15130]

##    data = np.load(filename)