def createAlgsList(self):
        # First we populate the list of algorithms with those created
        # extending GeoAlgorithm directly (those that execute GDAL
        # using the console)
        self.preloadedAlgs = [nearblack(), information(), warp(), translate(),
                              rgb2pct(), pct2rgb(), merge(), buildvrt(), polygonize(), gdaladdo(),
                              ClipByExtent(), ClipByMask(), contour(), rasterize(), proximity(),
                              sieve(), fillnodata(), ExtractProjection(), gdal2xyz(),
                              hillshade(), slope(), aspect(), tri(), tpi(), roughness(),
                              ColorRelief(), GridInvDist(), GridAverage(), GridNearest(),
                              GridDataMetrics(), gdaltindex(), gdalcalc(), rasterize_over(),
                              # ----- OGR tools -----
                              OgrInfo(), Ogr2Ogr(), Ogr2OgrClip(), Ogr2OgrClipExtent(),
                              Ogr2OgrToPostGis(), Ogr2OgrToPostGisList(), Ogr2OgrPointsOnLines(),
                              Ogr2OgrBuffer(), Ogr2OgrDissolve(), Ogr2OgrOneSideBuffer(),
                              Ogr2OgrTableToPostGisList(), OgrSql(),
                              ]

        # And then we add those that are created as python scripts
        folder = self.scriptsFolder()
        if os.path.exists(folder):
            for descriptionFile in os.listdir(folder):
                if descriptionFile.endswith('py'):
                    try:
                        fullpath = os.path.join(self.scriptsFolder(),
                                                descriptionFile)
                        alg = GdalScriptAlgorithm(fullpath)
                        self.preloadedAlgs.append(alg)
                    except WrongScriptException as e:
                        ProcessingLog.addToLog(ProcessingLog.LOG_ERROR, e.msg)
    def createAlgsList(self):
        # First we populate the list of algorithms with those created
        # extending GeoAlgorithm directly (those that execute GDAL
        # using the console)
        self.preloadedAlgs = [nearblack(), information(), warp(), translate(),
            rgb2pct(), pct2rgb(), merge(), polygonize(), gdaladdo(),
            ClipByExtent(), ClipByMask(), contour(), rasterize(), proximity(),
            sieve(), fillnodata(), ExtractProjection(), gdal2xyz(),
            hillshade(), slope(), aspect(), tri(), tpi(), roughness(),
            ColorRelief(), GridInvDist(), GridAverage(), GridNearest(),
            GridDataMetrics(),
            # ----- OGR tools -----
            OgrInfo(), Ogr2Ogr(), OgrSql(),
            ]

        # And then we add those that are created as python scripts
        folder = self.scriptsFolder()
        if os.path.exists(folder):
            for descriptionFile in os.listdir(folder):
                if descriptionFile.endswith('py'):
                    try:
                        fullpath = os.path.join(self.scriptsFolder(),
                                descriptionFile)
                        alg = GdalScriptAlgorithm(fullpath)
                        self.preloadedAlgs.append(alg)
                    except WrongScriptException, e:
                        ProcessingLog.addToLog(ProcessingLog.LOG_ERROR, e.msg)
def frequence_moyenne(phoneme):
    #fais la moyenne de chaque frquence type du phoneme, enleve les valeurs extremes
    tbl = tbl_frequence_max12(phoneme)
    fr1 = tri(tbl[0])
    med = (fr1[4] + fr1[5]) / 2
    nouv = []
    for i in range(10):
        if abs((fr1[i] - med) / med) < 0.5:
            nouv.append(fr1[i])
    frmoy1 = moyenne(nouv)
    fr2 = tri(tbl[1])
    med = (fr2[4] + fr2[5]) / 2
    nouv = []
    for i in range(10):
        if abs((fr2[i] - med) / med) < 0.5:
            nouv.append(fr2[i])
    frmoy2 = moyenne(nouv)
    return [frmoy1, frmoy2]
 def createAlgsList(self):
     # First we populate the list of algorithms with those created
     # extending GeoAlgorithm directly (those that execute GDAL
     # using the console)
     self.preloadedAlgs = [
         nearblack(),
         information(),
         warp(),
         translate(),
         rgb2pct(),
         pct2rgb(),
         merge(),
         buildvrt(),
         polygonize(),
         gdaladdo(),
         ClipByExtent(),
         ClipByMask(),
         contour(),
         rasterize(),
         proximity(),
         sieve(),
         fillnodata(),
         ExtractProjection(),
         gdal2xyz(),
         hillshade(),
         slope(),
         aspect(),
         tri(),
         tpi(),
         roughness(),
         ColorRelief(),
         GridInvDist(),
         GridAverage(),
         GridNearest(),
         GridDataMetrics(),
         gdaltindex(),
         gdalcalc(),
         rasterize_over(),
         retile(),
         gdal2tiles(),
         # ----- OGR tools -----
         OgrInfo(),
         Ogr2Ogr(),
         Ogr2OgrClip(),
         Ogr2OgrClipExtent(),
         Ogr2OgrToPostGis(),
         Ogr2OgrToPostGisList(),
         Ogr2OgrPointsOnLines(),
         Ogr2OgrBuffer(),
         Ogr2OgrDissolve(),
         Ogr2OgrOneSideBuffer(),
         Ogr2OgrTableToPostGisList(),
         OgrSql(),
     ]
 def createAlgsList(self):
     # First we populate the list of algorithms with those created
     # extending GeoAlgorithm directly (those that execute GDAL
     # using the console)
     self.preloadedAlgs = [
         nearblack(),
         information(),
         warp(),
         translate(),
         rgb2pct(),
         pct2rgb(),
         merge(),
         buildvrt(),
         polygonize(),
         gdaladdo(),
         ClipByExtent(),
         ClipByMask(),
         contour(),
         rasterize(),
         proximity(),
         sieve(),
         fillnodata(),
         ExtractProjection(),
         gdal2xyz(),
         hillshade(),
         slope(),
         aspect(),
         tri(),
         tpi(),
         roughness(),
         ColorRelief(),
         GridInvDist(),
         GridAverage(),
         GridNearest(),
         GridDataMetrics(),
         gdaltindex(),
         gdalcalc(),
         rasterize_over(),
         retile(),
         gdal2tiles(),
         # ----- OGR tools -----
         OgrInfo(),
         Ogr2Ogr(),
         Ogr2OgrClip(),
         Ogr2OgrClipExtent(),
         Ogr2OgrToPostGis(),
         Ogr2OgrToPostGisList(),
         Ogr2OgrPointsOnLines(),
         Ogr2OgrBuffer(),
         Ogr2OgrDissolve(),
         Ogr2OgrOneSideBuffer(),
         Ogr2OgrTableToPostGisList(),
         OgrSql(),
     ]
def encadrementFrequences(phoneme):
    #retourne les encadrements de frequences pour une liste de 10 phonemes
    tbl = tbl_frequence_max12(phoneme)
    frmax1 = tri(tbl[0])
    if frmax1[8] - frmax1[1] < frmax1[1]:  #pas de saut de frequence
        pic1Bas = frmax1[1] - frmax1[1] / 5
        pic1Haut = frmax1[8] + frmax1[8] / 5
    else:
        milieu = (frmax1[4] + frmax1[5]) / 2
        if frmax1[8] - milieu > milieu - frmax1[1]:
            pic1Bas = frmax1[1] - frmax1[1] / 5
            k = 8
            while frmax1[k] - milieu > milieu - frmax1[1]:
                k = k - 1
            pic1Haut = frmax1[k] + frmax1[k] / 5
        else:
            pic1Haut = frmax1[8] + frmax1[8] / 5
            k = 1
            while milieu - frmax1[k] > frmax1[8] - milieu:
                k = k + 1
            pic1Bas = frmax1[k] - frmax1[k] / 5
    frmax2 = tri(tbl[1])
    if frmax2[8] - frmax2[1] < frmax1[1]:  #pas de saut de frequence
        pic2Bas = frmax2[1] - frmax2[1] / 5
        pic2Haut = frmax2[8] + frmax2[8] / 5
    else:
        milieu = (frmax2[4] + frmax2[5]) / 2
        if frmax2[8] - milieu > milieu - frmax2[1]:
            pic2Bas = frmax2[1] - frmax2[1] / 5
            k = 8
            while frmax2[k] - milieu > milieu - frmax2[1]:
                k = k - 1
            pic2Haut = frmax2[k] + frmax2[k] / 15
        else:
            pic2Haut = frmax2[8] + frmax2[8] / 5
            k = 1
            while milieu - frmax2[k] > frmax2[8] - milieu:
                k = k + 1
            pic2Bas = frmax2[k] - frmax2[k] / 5
    return [pic1Bas, pic1Haut, pic2Bas, pic2Haut]
Exemple #7
0
    def updateYval(self, cbx_value, T0):
        #        print(cbx_value, T0)
        timeaxis = np.arange(-30, 30 + 0.1, 0.1)
        freq = 1 / T0
        self.setTimeaxis(timeaxis.tolist())

        if (cbx_value == 0):
            #   Square wave
            yval = square(2 * np.pi * freq * timeaxis)
            self.setYval(yval.tolist())
        elif (cbx_value == 1):
            #   Triangle wave
            timeaxis = timeaxis[timeaxis >= 0]
            yval = np.asmatrix(tri(10 / freq, 1, len(timeaxis)))
            yval = np.asarray(-np.c_[np.fliplr(yval[0:, 1:]), yval]).T
            self.setYval(yval.tolist())
        elif (cbx_value == 2):
            #   Ramp wave
            T = 1 / freq
            timeaxis = timeaxis[timeaxis >= 0]
            yval = np.asmatrix((np.mod(timeaxis + T / 2, T) - T / 2) / T * 2)
            yval = np.asarray(np.c_[-np.fliplr(yval[0:, 1:]), yval]).T
            self.setYval(yval.tolist())
        elif (cbx_value == 3):
            #   Full-wave Rectified Sine wave
            #   1 == sine wave (third parameter of fullwave func.)
            yval = fullwave(timeaxis, 1 / freq, 1)
            self.setYval(yval.tolist())
        elif (cbx_value == 4):
            #   Full-wave Rectified Cosine wave
            #   2 == cosine wave (third parameter of fullwave func.)
            yval = fullwave(timeaxis, 1 / freq, 2)
            self.setYval(yval.tolist())
        elif (cbx_value == 5):
            #   Half-wave Rectified Sine wave
            #   1 == sine wave (third parameter of halfwave func.)
            yval = halfwave(timeaxis, 1 / freq, 1)
            self.setYval(yval.tolist())
        elif (cbx_value == 6):
            #   Half-wave Rectified Cosine wave
            #   1 == cosine wave (third parameter of halfwave func.)
            yval = halfwave(timeaxis, 1 / freq, 2)
            self.setYval(yval.tolist())
Exemple #8
0
def testtri():
    print("all equal: equilateral")
    tri(3,3,3)

    print()
    print("two equal, other smaller: isosceles")
    tri(1,2,2)
    tri(2,1,2)
    tri(2,2,1)

    print()
    print("two equal, other bigger: isosceles")
    tri(3,2,2)
    tri(2,3,2)
    tri(2,2,3)

    print()
    print("two equal, other too big: no triangle")
    tri(6,2,2)
    tri(2,6,2)
    tri(2,2,6)

    print()
    print("all different: scalene")
    tri(6,5,2)
    tri(6,2,5)
    tri(5,6,2)
    tri(5,2,6)
    tri(2,6,5)
    tri(2,5,6)

    print()
    print("all different, straight line: no triangle")
    tri(6,4,2)
    tri(6,2,4)
    tri(4,6,2)
    tri(4,2,6)
    tri(2,6,4)
    tri(2,4,6)

    print()
    print("all different, one too big: no triangle")
    tri(6,3,2)
    tri(6,2,3)
    tri(3,6,2)
    tri(3,2,6)
    tri(2,6,3)
    tri(2,3,6)