Exemplo n.º 1
0
def lidar(args, fds):

    zlist = []
    for z in frange(args.zmin, args.zmax, args.zmicro):
        zlist.append(z)
    for x in frange(args.xmin, args.xmax, args.xstep):
        for y in frange(args.ymin, args.ymax, args.ystep):
            mems.set_pos(fds['mirror_fd'], x, y)
            scan(args, fds, zlist, x, y)
            zlist.reverse()
Exemplo n.º 2
0
def mirrorScan(xlist, ylist, zlist):
    for z in zlist:
        fds['delay_fd'].write('DLY {:.3f}'.format(z))
        time.sleep(1000 / 1000)
        for x in xlist:
            for y in ylist:
                mems.set_pos(fds['mirror_fd'], x, y)
                time.sleep(100 / 1000)
                count = count_helper(fds)
                out = '{:.3f}, {:.3f}, {:.3f}, {}'.format(z, y, x, count)
                fds['save_fd'].write(out + '\n')
                if (args.verbose):
                    print out
Exemplo n.º 3
0
def lidar(args, fds):
    #zlist = [z for z in frange(fzmin, fzmax, args.zmicro)]
    zmin = args.zmin
    zmax = args.zmax
    step = args.zmicro
    macro_step = args.zmacro
    zlast = 0
    prev_peak = -1111
    xlist = [x for x in frange(args.xmin, args.xmax, args.xstep)]
    ylist = [y for y in frange(args.ymin, args.ymax, args.ystep)]
    zlist = [z for z in frange(zmin, zmax, step)]
    data_dict = defaultdict(dict)
    for x in xlist:
        for y in ylist:
            data_dict[x][y] = [0, 0]

    for z in zlist:

        fds['delay_fd'].write('DLY {:.3f}'.format(z))
        time.sleep(0.1)
        for x in xlist:
            wait_mirror = 0
            for y in ylist:
                mems.set_pos(fds['mirror_fd'], x, y)
                time.sleep(4)  #wait time to follow beam
                if (wait_mirror == 0):
                    time.sleep(0.005)
                    wait_mirror = 1

                    # merge issue correct the code as desired

#
#                 count = 0 # count_helper(fds)
#                 out = '{:.3f}, {:.3f}, {:.3f}, {}'.format(z, y, x, count)
#                 fds['save_fd'].write(out+'\n')
#                 if(args.verbose ):
#                     print out

#
                count = count_helper(fds)
                if count > data_dict[x][y][1]:
                    data_dict[x][y] = [z, count]
#                out = '{:.3f}, {:.3f}, {:.3f}, {}'.format(z, y, x, count)
#                fds['save_fd'].write(out+'\n')
#                if(args.verbose ):
#                    print out
    for x in xlist:
        for y in ylist:
            out = '{:.3f}, {:.3f}, {:.3f}, {}'.format(data_dict[x][y][0], y, x,
                                                      data_dict[x][y][1])
            fds['save_fd'].write(out + '\n')
Exemplo n.º 4
0
def adaptive_lidar(args, fds):
    adaptive = None
    for x in frange(args.xmin, args.xmax, args.xstep):
        for y in frange(args.ymin, args.ymax, args.ystep):
            mems.set_pos(fds['mirror_fd'], x, y)

            if (adaptive):
                adpative = fine_scan(args, fds, x, y,
                                     adaptive - 2 * args.zmicro,
                                     adaptive + 2 * args.zmicro)

            if (adaptive == None):
                if (args.verbose):
                    print "Doing a macro scan"
                zlist = [z for z in frange(args.zmin, args.zmax, args.zmacro)]
                peak = get_peak(args, fds, zlist)
                args.zlast = max(zlist)
                adaptive = fine_scan(args, fds, x, y, peak - 15, peak + 15)
Exemplo n.º 5
0
def lidar(args, fds):
    #zlist = [z for z in frange(fzmin, fzmax, args.zmicro)]
    zmin = args.zmin
    zmax = args.zmax
    step = args.zmicro
    macro_step = args.zmacro
    zlast = 0
    prev_peak = -1111
    for x in frange(args.xmin, args.xmax, args.xstep):
        for y in frange(args.ymin, args.ymax, args.ystep):
            mems.set_pos(fds['mirror_fd'], x, y)
            ######### start of the adaptive
            if(prev_peak != -1111):
                data = test_scan(prev_peak - 2*step,prev_peak + 2*step,step,zlast,fds,x,y)
                prev_peak = data[0]
                zlast = data[1]
                #if (data[2] < 20):
                   # prev_peak = -1111
            if(prev_peak == -1111):
                 prev_peak = scan(zmin,zmax,macro_step,zlast, fds, x, y)
                 prev_peak = -1111
                 zlast = zmax
Exemplo n.º 6
0
    return L


mems = m.open_mirror()
i = -0.25
j = 0.06
k = -0.05
l = 0.15

ystep = 0.0
04
xstep = 0.05
#time.sleep(1)
ylist = [y for y in frange(k, l, ystep)]
xlist = [x for x in frange(i, j, xstep)]
for y in ylist:
    #rint(y)
    for x in xlist:
        print(x, y)
        m.set_pos(mems, x, y)
    #time.sleep(0.5)
#time.sleep(0.20)
#m.set_pos(mems,-0.05,y)
#m.set_pos(mems,j,y)
#time.sleep(0.2  )

time.sleep(1)
m.set_pos(mems, i, k)
m.set_pos(mems, 0, 0)
m.close_mirror(mems)
Exemplo n.º 7
0
import mirror as m
import counter as c
import time

mems = m.open_mirror()
m.set_pos(mems, -0.02 ,0.12)
save_file = open("hotTurbulence.csv", 'w')
start = time.clock()
TDC = 5000
for x in range(0,2000):


start = time.clock()

#    m.set_pos(mems, 0.05, 0.05)
    #count_fd, control_fd = c.open_counter(5000)
    count = c.get_count(5000)
#    m.set_pos(mems, 0, 0)
    print count #c.count(control_fd, count_fd, 5000)
    time.sleep(210.0/1000)
   # c.close(control_fd, count_fd)
print time.clock()-start#    m.set_pos(mems, 0.05, 0.05)

save_file.close()

"""
m.set_pos(mems,-0.3,0.3)
for x in range(0,100):
    m.set_pos(mems, 0.05, 0.05)
    count_fd, control_fd = c.open_counter(100)
    m.set_pos(mems, 0, 0)
Exemplo n.º 8
0
DLY_END = 60
DLY_INC = 2
TDC = 500
ymin = 0.5
ymax = 0.76
ystep = 0.05


parser = argparse.ArgumentParser()
parser.add_argument('-i', '--itrno', type=str, help='itr no of the file to save the data', default='1')
args = parser.parse_args()



mems = m.open_mirror()
m.set_pos(mems, -0.02, 0.1)

dly = Gpib(name =0, pad =5)



def frange(end,start=0,inc=0,precision=1):
    """A range function that accepts float increments."""
    import math

    if not start:
        start = end + 0.0
        end = 0.0
    else: end += 0.0
    
    if not inc:
Exemplo n.º 9
0
import time

DLY_START = -150
DLY_END = 150
DLY_INC = 2
TDC = 100000


parser = argparse.ArgumentParser()
parser.add_argument('-i', '--itrno', type=str, help='itr no of the file to save the data', default='1')
args = parser.parse_args()



mems = m.open_mirror()
m.set_pos(mems,-0.03 , -0.03)

dly = Gpib(name =0, pad =5)



def frange(end,start=0,inc=0,precision=1):
    """A range function that accepts float increments."""
    import math

    if not start:
        start = end + 0.0
        end = 0.0
    else: end += 0.0
    
    if not inc:
Exemplo n.º 10
0
import mirror as m

mems = m.open_mirror()
m.set_pos(mems, 1,1)
m.close_mirror(mems)
Exemplo n.º 11
0
def lidar(args, fds):
    zlist = [z for z in frange(args.zmin, args.zmax, args.zmicro)]
    for x in frange(args.xmin, args.xmax, args.xstep):
        for y in frange(args.ymin, args.ymax, args.ystep):
            mems.set_pos(fds['mirror_fd'], x, y)
            scan(args, fds, zlist, x, y)