Beispiel #1
0
def main(argv):
    print("now it doesn't work (((")
    exit()
    data = v3f.readFile(
        argv[0] if len(argv) > 0 else "..\\data\\09g2s_strike.txt")
    print(data)

    fig = plt.figure('source')
    ax = fig.gca(projection='3d')
    ax.plot_surface(data.X,
                    data.Y,
                    data.Bz,
                    rstride=1,
                    cstride=1,
                    cmap=cm.gist_rainbow)

    data_cuted = rMcut.magnetCutter(data, [0.0] * 6, [[-0.1, 0.1] * 6])

    fig = plt.figure('source')
    ax = fig.gca(projection='3d')
    ax.plot_surface(data_cuted.X,
                    data_cuted.Y,
                    data_cuted.Bz,
                    rstride=1,
                    cstride=1,
                    cmap=cm.gist_rainbow)

    plt.show()
Beispiel #2
0
def main(argv):
    data = v3f.readFile(
        argv[0] if len(argv) > 0 else "..\\data\\09g2s_strike.txt")
    print(data)

    fig = plt.figure('Bx')
    ax = fig.gca(projection='3d')
    ax.plot_surface(data.X,
                    data.Y,
                    data.Bx,
                    rstride=1,
                    cstride=1,
                    cmap=cm.gist_rainbow)

    fig = plt.figure('By')
    ax = fig.gca(projection='3d')
    ax.plot_surface(data.X,
                    data.Y,
                    data.By,
                    rstride=1,
                    cstride=1,
                    cmap=cm.gist_rainbow)

    fig = plt.figure('Bz')
    ax = fig.gca(projection='3d')
    ax.plot_surface(data.X,
                    data.Y,
                    data.Bz,
                    rstride=1,
                    cstride=1,
                    cmap=cm.gist_rainbow)

    plt.show()
Beispiel #3
0
def main(argv):
    data = v3f.readFile(argv[0] if len(
        argv) > 0 else "..\\data\\mera\\mera_with_magnitezation_gap=100um.txt")
    print(data)
    plt.rc('text', usetex=True)
    plt.rc('font', family='serif', size=18)
    fig = plt.figure('source')
    ax = fig.gca(projection='3d')
    ax.plot_surface(data.X,
                    data.Y,
                    data.Bz,
                    rstride=1,
                    cstride=1,
                    cmap=cm.gist_rainbow)

    resDet, points = dAn.detectorAnalyseData(data,
                                             'crack',
                                             typeOfResult='coords',
                                             winSize=3)
    resDet.Bz = np.abs(resDet.Bz)
    resDet.Bz /= np.max(resDet.Bz)
    points = points[:3]
    maxes = [
        v3f.indexFromCoord(resDet.vol, resDet.steps, [point[1], point[0]])
        for point in points
    ]
    print(maxes)
    maxes = [[point[1], point[0]] for point in maxes]
    print(maxes)
    fig = plt.figure('detector')
    plt.xlabel('$x$, mm', fontsize=18)
    plt.ylabel('$y$, mm', fontsize=18)
    #plt.colorlabel('$Bz, \mu T$', fontsize=18)
    plt.pcolor(resDet.X, resDet.Y, resDet.Bz, cmap=plt.cm.spectral)
    plt.plot(list(zip(*points))[1], list(zip(*points))[0], 'wo')
    clb = plt.colorbar()
    clb.set_label('|$D_{x+y}(x,y)|/D_{x+y(m)}$', fontsize=18)

    plt.show()

    dataCrack = crkf.lineGeneration2(maxes, resDet.Bz)
    fig = plt.figure('line')
    plt.xlabel('$x$, mm', fontsize=18)
    plt.ylabel('$y$, mm', fontsize=18)
    #plt.colorlabel('$Bz, \mu T$', fontsize=18)
    plt.pcolor(resDet.X, resDet.Y, dataCrack, cmap=plt.cm.spectral)
    plt.plot(list(zip(*points))[1], list(zip(*points))[0], 'wo')

    plt.show()
    print('ok')
Beispiel #4
0
def main(argv):
    data = v3f.readFile(
        argv[0] if len(argv) > 0 else "..\\data\\09g2s_strike.txt")
    print(data)
    winsize = 4

    resDipole = dtc.gradDetector(data, winsize, 'dipole')
    resDGrad = dtc.gradDetector(data, winsize, 'doubleGrad')
    resCrack = dtc.gradDetector(data, winsize, 'crack')

    fig = plt.figure('resDipole')
    ax = fig.gca(projection='3d')
    ax.plot_surface(resDipole.X,
                    resDipole.Y,
                    resDipole.Bz,
                    rstride=1,
                    cstride=1,
                    cmap=cm.gist_rainbow)

    fig = plt.figure('resDGrad')
    ax = fig.gca(projection='3d')
    ax.plot_surface(resDGrad.X,
                    resDGrad.Y,
                    resDGrad.Bz,
                    rstride=1,
                    cstride=1,
                    cmap=cm.gist_rainbow)

    fig = plt.figure('resCrack')
    ax = fig.gca(projection='3d')
    ax.plot_surface(resCrack.X,
                    resCrack.Y,
                    resCrack.Bz,
                    rstride=1,
                    cstride=1,
                    cmap=cm.gist_rainbow)

    plt.show()
    print('ok')
Beispiel #5
0
def main(argv):
    i = 0
    sensors = [[-1.7, 0, -1.7], [-.3, -1.3, -1.7]]
    #secondwd argv argument allow to set output path
    #if it passed, output path is equal to the input path
    if (len(argv) > 1):
        newFName = lambda fName: argv[1] + fName + 't'
    else:
        newFName = lambda fName: fName + 't'
    for filename in listdir(argv[0]):
        data = v3f.readFile(argv[0] + '\\' + filename)
        print(filename)
        print('source:', data)
        data = ctrs.autoRecRegionCutter(data)
        print('RecCutted:', data)
        data = ctrs.slowCutter(data)
        print('SlowCutted:', data)
        v3f.saveFile(data, newFName(filename))
        data = rmsh.recalcMagnFieldinXY(data, sensors)
        print('RecCutted:', data)
        i += 1
    print('ok', i, ' files.')
def main(argv):
    data = v3f.readFile(argv[0] if len(argv)>0 else "..\\data\\09g2s_strike.txt")
    print(data)
    
    plt.rc('text', usetex=True)
    plt.rc('font', family='serif',size=18)
    
    fig = plt.figure()
    plt.xlabel('$x$, mm', fontsize=18)
    plt.ylabel('$y$, mm', fontsize=18)
    #plt.colorlabel('$Bz, \mu T$', fontsize=18)
    plt.pcolor(data.X,data.Y,data.Bz,cmap=plt.cm.spectral)
   
    #plt.plot(list(zip(*maxes2))[1],list(zip(*maxes2))[0],'ro')
    clb = plt.colorbar()
    clb.set_label('$B_z$, A/m', fontsize=18)
    #plt.savefig('source')
    plt.show()
    
    data = ctrs.autoRecRegionCutter(data)
    
    fig = plt.figure()
    plt.xlabel('$x$, mm', fontsize=18)
    plt.ylabel('$y$, mm', fontsize=18)
    #plt.colorlabel('$Bz, \mu T$', fontsize=18)
    plt.pcolor(data.X,data.Y,data.Bz,cmap=plt.cm.spectral)
   
    #plt.plot(list(zip(*maxes2))[1],list(zip(*maxes2))[0],'ro')
    clb = plt.colorbar()
    clb.set_label('$B_z$, A/m', fontsize=18)
    #plt.savefig('cutedSource')
    plt.show()

    #dataPic = v3f.magnToPicture(data.Bz)
    
    resDet,points = dAn.detectorAnalyseData(data,'crack',typeOfResult = 'coords')
    points = points[:5]
    
    fig = plt.figure()
    plt.xlabel('$x$, mm', fontsize=18)
    plt.ylabel('$y$, mm', fontsize=18)
    #plt.colorlabel('$Bz, \mu T$', fontsize=18)
    plt.pcolor(resDet.X,resDet.Y,resDet.Bz,cmap=plt.cm.spectral)
    #plt.plot(list(zip(*maxes2))[1],list(zip(*maxes2))[0],'ro')
    clb = plt.colorbar()
    clb.set_label('detector', fontsize=18)
    #plt.savefig('detector')
    plt.show()

    fig = plt.figure("detectorWithMaxes")    
    plt.xlabel('$x$, mm', fontsize=18)
    plt.ylabel('$y$, mm', fontsize=18)
    #plt.colorlabel('$Bz, \mu T$', fontsize=18)
    plt.pcolor(resDet.X,resDet.Y,resDet.Bz,cmap=plt.cm.spectral)
   
    #plt.plot(list(zip(*maxes2))[1],list(zip(*maxes2))[0],'ro')
    clb = plt.colorbar()
    clb.set_label('detector', fontsize=18)
    plt.plot(list(zip(*points))[1],list(zip(*points))[0],'wo')
    #plt.savefig('sourceWithMax')
    plt.show()
    print('ok')
Beispiel #7
0
def main(argv):
    data = v3f.readFile(
        argv[0] if len(argv) > 0 else "..\\data\\09g2s_strike.txt")
    print(data)

    data2 = ctrs.regionCutter(
        data, [int(len(data.Bz[0]) / 2),
               int(len(data.Bz) / 2)], 10)

    fig = plt.figure('source')
    ax = fig.gca(projection='3d')
    ax.plot_surface(data.X,
                    data.Y,
                    data.Bz,
                    rstride=1,
                    cstride=1,
                    cmap=cm.gist_rainbow)

    fig = plt.figure('region cutted')
    ax = fig.gca(projection='3d')
    ax.plot_surface(data2.X,
                    data2.Y,
                    data2.Bz,
                    rstride=1,
                    cstride=1,
                    cmap=cm.gist_rainbow)

    plt.show()

    data2 = ctrs.slowCutter(data)
    print('slowcutter works, but slow')
    fig = plt.figure('source')
    ax = fig.gca(projection='3d')
    ax.plot_surface(data.X,
                    data.Y,
                    data.Bz,
                    rstride=1,
                    cstride=1,
                    cmap=cm.gist_rainbow)

    fig = plt.figure('slow cutted')
    ax = fig.gca(projection='3d')
    ax.plot_surface(data2.X,
                    data2.Y,
                    data2.Bz,
                    rstride=1,
                    cstride=1,
                    cmap=cm.gist_rainbow)

    plt.show()

    data2 = ctrs.autoRecRegionCutter(data)

    fig = plt.figure('source')
    ax = fig.gca(projection='3d')
    ax.plot_surface(data.X,
                    data.Y,
                    data.Bz,
                    rstride=1,
                    cstride=1,
                    cmap=cm.gist_rainbow)

    fig = plt.figure('auto recatangle region cutted')
    ax = fig.gca(projection='3d')
    ax.plot_surface(data2.X,
                    data2.Y,
                    data2.Bz,
                    rstride=1,
                    cstride=1,
                    cmap=cm.gist_rainbow)

    plt.show()
    print('ok')
def main(argv):
    data = v3f.readFile(
        argv[0] if len(argv) > 0 else "..\\data\\09g2s_strike.txt")
    print(data)
    winsize = 4
    winHalfSize = 8
    countOfDipolesToAnalyse = 2

    #auto cut area under the sample
    data = ctrs.autoRecRegionCutter(data)
    #find maxes of dipole detector
    resDet, maxes = dAn.detectorAnalyseData(data,
                                            'crack',
                                            typeOfResult='indicies')
    resDet, maxesCoords = dAn.detectorAnalyseData(data,
                                                  'crack',
                                                  typeOfResult='coords')
    print(maxes)
    #dipole Cutter
    dipoles, dipoleField = dpctr.dipoleCutter(data,
                                              maxes[:countOfDipolesToAnalyse],
                                              winHalfSize)

    fig = plt.figure('cuted source')
    plt.xlabel('$x$, mm', fontsize=18)
    plt.ylabel('$y$, mm', fontsize=18)
    plt.pcolor(data.X, data.Y, data.Bz, cmap=plt.cm.spectral)
    clb = plt.colorbar()
    clb.set_label('$B_z, \mu T$', fontsize=18)

    fig = plt.figure('detector with maxes')
    plt.xlabel('$x$, mm', fontsize=18)
    plt.ylabel('$y$, mm', fontsize=18)
    plt.pcolor(resDet.X, resDet.Y, (resDet).Bz, cmap=plt.cm.spectral)
    plt.plot(
        list(zip(*maxesCoords[countOfDipolesToAnalyse:]))[1],
        list(zip(*maxesCoords[countOfDipolesToAnalyse:]))[0], 'wx')
    plt.plot(
        list(zip(*maxesCoords[:countOfDipolesToAnalyse]))[1],
        list(zip(*maxesCoords[:countOfDipolesToAnalyse]))[0], 'rx')
    clb = plt.colorbar()
    clb.set_label('$B_z, \mu T$', fontsize=18)

    fig = plt.figure('dipole Field')
    plt.xlabel('$x$, mm', fontsize=18)
    plt.ylabel('$y$, mm', fontsize=18)
    plt.pcolor(dipoleField.X,
               dipoleField.Y,
               dipoleField.Bz,
               cmap=plt.cm.spectral)
    clb = plt.colorbar()
    clb.set_label('$B_z, \mu T$', fontsize=18)

    fig = plt.figure('substracted field')
    plt.xlabel('$x$, mm', fontsize=18)
    plt.ylabel('$y$, mm', fontsize=18)
    plt.pcolor(dipoleField.X,
               dipoleField.Y, (dipoleField - data).Bz,
               cmap=plt.cm.spectral)
    clb = plt.colorbar()
    clb.set_label('$B_z, \mu T$', fontsize=18)

    plt.show()
    print('ok')