def phase_measure_test():
	lc_dmd = lc.LC6500Device()
	#prepare patterns
	settings = {'function':pc.phase_measure_fun,'compression':'rle','exposure_time':500000,'X1':25*2*3,'Y1':25*2*3,'Phase' : 16}
	dmd_pattern = pc.DMDPattern(**settings)
	dmd_pattern.compute_pattern()
	lc_dmd.upload_image(dmd_pattern)
Exemple #2
0
def upload_hologram2(phasemap):

    settings = {'compression':'rle','exposure_time':100000}
    dmd_pattern = pc.DMDPattern(**settings)

    xshift = 0
    yshift = 0
    xshift2 = 0.05
    yshift2 = 0.05

    target_setting =  {'image':"sinc", "path":"../Data/Hologram_test/fourier130.png",
                        'shape':np.shape(phasemap[0]), #only applicable for
                        'width':0.3}#gaussian width. 0~1, from zero to image size*2 tem width
    Target = IP.TargetImage(**target_setting)
    Target.imagefft()
    tgt = Target.fimage
    target_setting2 =  {'image':"sinc", "path":"../Data/Hologram_test/fourier130.png",
                        'shape':np.shape(phasemap[0]), #only applicable for
                        'width':0.3}#gaussian width. 0~1, from zero to image size*2 tem width
    Target2 = IP.TargetImage(**target_setting2)
    Target2.imagefft()
    tgt2 = Target2.fimage



    im_shape = phasemap.shape[1]
    X, Y = np.meshgrid(np.arange(im_shape)-im_shape/2,np.arange(im_shape)-im_shape/2)
    phasesum = np.mod(-phasemap[1]+tgt[1]+X*xshift+Y*yshift,2.*math.pi)*12./(2.*math.pi)
    phasesum2 = np.mod(-phasemap[1]+tgt2[1]+X*xshift2+Y*yshift2,2.*math.pi)*12./(2.*math.pi)

    pattern = IP.hologramize2(X,Y,8,phasemap[0],phasesum,tgt[0],phasemap[0],phasesum2,tgt2[0],(1080,1920))
    dmd_pattern.pattern = pattern
    lc_dmd = lc.LC6500Device()
    lc_dmd.upload_image(dmd_pattern)
    showimages(pattern,Target,phasemap)
Exemple #3
0
def load_N_pictures():
    #Prepare Pattern
    lc_dmd = lc.LC6500Device()
    list_of_patterns = []
    pattern_list = [
        ('PatternRepository/LCR6500_Images/All_Block.bmp', 10000000),
        ('PatternRepository/LCR6500_Images/678_Block.bmp', 500000),
        ('PatternRepository/LCR6500_Images/All_Block.bmp', 5000000),
    ]
    for lines in pattern_list:
        path = lines[0]
        exposure = int(lines[1])
        settings = {
            'compression': 'rle',
            'exposure_time': exposure  # in us
        }

        dmd_pattern = pc.DMDPattern(**settings)
        picture = imread(path)
        picture_change = picture.astype('bool')
        dmd_pattern.pattern = picture_change
        list_of_patterns.append(dmd_pattern)

    dmd_patterns = {'patterns': list_of_patterns}
    start_time = time.clock()
    lc_dmd.upload_image_sequence(dmd_patterns)
    end_time = time.clock()
    elapsed_time = end_time - start_time
    print "Time it took to send images:", elapsed_time
Exemple #4
0
def upload_hologram_sequence(phasemap):

    ###########################
    #upload to DMD
    ###########################
    settings = {'compression':'rle','exposure_time':100000}
    dmd_pattern = pc.DMDPattern(**settings)

    dmd_pattern_list = []
    pattern, Target = fourierplane(phasemap,"sinc",0.2,0)
    dmd_pattern.pattern = pattern.hologram
    dmd_pattern_list.append(dmd_pattern)

    dmd_pattern2 = pc.DMDPattern(**settings)
    pattern2, Target = fourierplane(phasemap,"sinc",0,0)
    dmd_pattern2.pattern = pattern2.hologram
    dmd_pattern_list.append(dmd_pattern2)

    dmd_pattern3 = pc.DMDPattern(**settings)
    pattern3, Target = fourierplane(phasemap,"sinc",-0.2,0)
    dmd_pattern3.pattern = pattern3.hologram
    dmd_pattern_list.append(dmd_pattern3)

    lc_dmd = lc.LC6500Device()
    dmd_patterns = {'patterns' : dmd_pattern_list}
    lc_dmd.upload_image_sequence(dmd_patterns)
Exemple #5
0
def dataTransfer(conn):
    # Loop for sending and recieving data until told not to
    while True:
        #Recieve the data
        # "Buffer size need to be modified

        data = conn.recv(1024)

        # Split the data such that you seperate the command
        # Can be replaced with handling of an JSON object
        dataMessage = data.split(' ', 1)
        command = dataMessage[0]
        print("Incomming command: " + data)

        # Test for all the different commands

        if command == 'REPEAT':
            print "We have entered the REPEAT statement"
            reply = dataMessage[1]

        elif command == 'EXIT':
            print("Our client has left us :(")
            break

        elif command == 'LOAD':
            print "We have entered the LOAD statement"
            lc_dmd = lc.LC6500Device()
            pattern_list = list(ast.literal_eval(
                dataMessage[1]))  # typeset string to array
            reply = lc_dmd.pattern_on_the_fly(pattern_list)

        elif command == 'KILL':
            lc_dmd = lc.LC6500Device()
            lc_dmd.power_mode('standby')
            print(" Our server is shutting down.")
            s.close()
            break

        else:
            reply = 'Unknown Command'
        # Send the reply back to the client
        conn.sendall(reply)
        #conn.sendall(str.encode(reply))
    print("Close connection")
    conn.close()
Exemple #6
0
def standard_circle_test():
    lc_dmd = lc.LC6500Device()

    # Prepare Pattern
    settings = {'function':pc.circle_fun_2,
                'compression':'rle'
                }
    dmd_pattern = pc.DMDPattern(**settings)
    dmd_pattern.compute_pattern()
    lc_dmd.upload_image(dmd_pattern)
Exemple #7
0
    def send_defined_pattern_to_dmd(self, dmd_patterns):
        """
        :param dmd_patterns: pre-computed dmd_patterns
        :return: 0 if everything worked
        """
        dmd_patterns = {'patterns': dmd_patterns}

        self.lc_dmd = lc.LC6500Device()
        self.lc_dmd.upload_image_sequence(dmd_patterns)
        self.mode = 'pattern_on_the_fly'
        return 0
Exemple #8
0
def upload_hologram(pattern,target,phasemap):

    ###########################
    #upload to DMD
    ###########################
    lc_dmd = lc.LC6500Device()
    settings = {'compression':'rle','exposure_time':500000}
    dmd_pattern = pc.DMDPattern(**settings)
    dmd_pattern.pattern = pattern.hologram
    lc_dmd.upload_image(dmd_pattern)

    showimages(pattern.hologram, Target, phasemap)
Exemple #9
0
def real_pattern_print():

    #Prepare Pattern
    lc_dmd = lc.LC6500Device()

    settings = {
                'compression':'rle',
                'exposure_time':5000000 # in us
                }
    dmd_pattern = pc.DMDPattern(**settings)

    is_debug = False

   #TEST STUFF
    sites_dict = [((0, 0), ippg.GradientParabolaMinusGauss_GaussDip(parab=[600*1.5, 900*1.5], amplitude=1,
                                                  gausscomp=[120, 180], gausscomp_height=0.2,
                                                  gauss=[60, 90], gauss_height=1.0,
                                                  #gradient=[0.0, 0.0]
                                                  gradient=[-0.0003, 0.0002] # [++ -> upper right on atoms, ++ -> upper left]
                                                                     ))
                                         ]

    # settings = {'zero_pixel': (824, 429),
    settings = {'zero_pixel': (762, 586),
                'sites': sites_dict,
                'binarization_algorithm': 'threshold'}#''error_diffusion'}

    potential = ippg.ProjectedPotential(**settings)

    # uncomment this to get a saved copy of the potential
    # imsave('out.png', evaluated_matrix)

    # uncomment this to use the painted potential
    # potential.real_valued_potential = np.array(imread('out.png', mode='L')).astype('float')
    # potential.real_valued_potential /= float(np.max(potential.real_valued_potential))

    binary_matrix =potential.binarized_potential

    if is_debug:
        plt.gray()
        plt.imshow(binary_matrix,interpolation='none')
        # plt.imshow(potential.real_valued_potential,interpolation='none')
        plt.figaspect(1)
        pkl.dump(binary_matrix, open('diffused.pkl', 'wb'), protocol=2)

        plt.show()

    dmd_pattern.pattern = binary_matrix

    dmd_patterns = {'patterns':[dmd_pattern]}
    lc_dmd.upload_image_sequence(dmd_patterns)
Exemple #10
0
def real_pattern_series_test():

    lc_dmd = lc.LC6500Device()
    print lc_dmd.dev
    #Prepare Pattern
    #settings = {'function':pc.stripes_2,#pc.circle_fun_2,
    settings = {'function':pc.circle_fun_2,
                'compression':'rle',
                'exposure_time':500000 # in us
                }
    dmd_pattern = pc.DMDPattern(**settings)
    dmd_pattern_2 = pc.DMDPattern(**settings)

    
    #dmd_pattern.compute_pattern()
    site_rad = 6
    site_radii = [site_rad, site_rad]
    sites_dict = {(-25,-15):ippg.GaussFunction(radii = [1000,200])}
    settings = {'sites':sites_dict,
                'binarization_algorithm':'randomize'}

    potential = ippg.ProjectedPotential(**settings)
    evaluated_matrix = potential.evaluate_potential()
    binary_matrix = potential.binarize()
    dmd_pattern.pattern = binary_matrix 


    sites_dict = {(-25,-15):ippg.GaussFunction(radii = [200,1000])}

    settings = {'sites':sites_dict,
                'binarization_algorithm':'threshold'}

    potential = ippg.ProjectedPotential(**settings)
    evaluated_matrix = potential.evaluate_potential()
    binary_matrix = potential.binarize()
    
    dmd_pattern_2.pattern = binary_matrix
    
    dmd_patterns = {'patterns':[dmd_pattern, dmd_pattern_2, dmd_pattern]}
    lc_dmd.upload_image_sequence(dmd_patterns)
    
    #lc_dmd.upload_image(dmd_pattern)

    #command_sequence = dmd_pattern.compress_pattern()
    #lc_dmd.upload_image(command_sequence)
    lc_dmd.release()
Exemple #11
0
def real_pattern_test():

    lc_dmd = lc.LC6500Device()


    #Prepare Pattern
    #settings = {'function':pc.stripes_2,#pc.circle_fun_2,
    settings = {'function':pc.circle_fun_2,
                'compression':'rle',
                'exposure_time':500000
                }
    dmd_pattern = pc.DMDPattern(**settings)

    
    #dmd_pattern.compute_pattern()
    site_rad = 6
    site_radii = [site_rad, site_rad]
    sites_dict = {#(0,0):ippg.CircFunction(radii = site_radii),
                  #(1,0):ippg.CircFunction(radii = site_radii),
                  #(3,1):ippg.CircFunction(radii = site_radii),
                  #(0,0):ippg.GaussFunction(radii = [1000,1000])
                  (0,0):ippg.GaussFunction(radii = [500,500])
                  }
   #settings = {'sites':sites_dict,
    #            'binarization_algorithm':'error_diffusion'}

    # sites_dict = {(-100,-158):ippg.CircFunction(radii = [4,4], x_angle=1, amplitude=1)}
    #sites_dict = {(-188,-264):ippg.CircFunction(radii = [4,4], x_angle=1, amplitude=1)}

    settings = {'sites':sites_dict,
                'binarization_algorithm':'threshold'}
                #'binarization_algorithm':'error_diffusion'}
    potential = ippg.ProjectedPotential(**settings)
    evaluated_matrix = potential.evaluate_potential()
    binary_matrix = potential.binarize()
 
    dmd_pattern.pattern = binary_matrix 
    #dmd_pattern.show_pattern()
    
    lc_dmd.upload_image(dmd_pattern)
def phase_measure_series_test():
	lc_dmd = lc.LC6500Device()

	X1_list = [150,150,-150, -150, -150,-150,0,0]
	Y1_list = [150,-150,150, -150,0, 0,-150,-150]
#	X1_list = [250,250,250]
#	Y1_list = [0, 0, 0]
#        X1_list = np.arange(-200,201,100)
#        Y1_list = np.arange(-200,201,100)        
	Phase_list = [0,6,0,6,0,6,0,6]
	dmd_pattern_list = []
	#prepare patterns
	for x in xrange(0,len(X1_list)):
#                for y in xrange(0,len(X1_list)):
        	settings = {'function':pc.tilt_phase_measure_fun,'compression':'rle','exposure_time':400000,'X1':X1_list[x],'Y1':Y1_list[x],'Phase':Phase_list[x],'Size':50,'GratingSize':12}
                dmd_pattern = pc.DMDPattern(**settings)
                dmd_pattern.compute_pattern()
                dmd_pattern_list.append(dmd_pattern)

	dmd_patterns = {'patterns' : dmd_pattern_list}

	lc_dmd.upload_image_sequence(dmd_patterns)
Exemple #13
0
def upload_hologram_multi(phasemap):

    iteration = 17
    settings = {'compression':'rle','exposure_time':100000}
    dmd_pattern = pc.DMDPattern(**settings)

    phasesum = np.zeros((iteration,phasemap.shape[1],phasemap.shape[1]))
    imageamp = np.zeros((iteration,phasemap.shape[1],phasemap.shape[1]))
    amp = np.zeros((iteration,phasemap.shape[1],phasemap.shape[1]))
    im_shape = phasemap.shape[1]
    X, Y = np.meshgrid(np.arange(im_shape)-im_shape/2,np.arange(im_shape)-im_shape/2)

    target_setting =  {'image':"tem", "path":"../Data/Hologram_test/fourier130.png",
                        'shape':np.shape(phasemap[0]), #only applicable for
                        'width':0.7}#gaussian width. 0~1, from zero to image size*2 tem width
    Target = IP.TargetImage(**target_setting)
###########################################
###################################Yb
###########################################
    desiredshape = ["sinc","sinc","sinc","sinc","sinc","sinc","sinc","sinc","sinc","sinc","sinc","sinc","sinc","sinc","sinc","sinc","sinc"]
    xshift = [-0.04,-0.02,0.02 ,0.04 , 0    ,0    , 0 ,-0.06 ,-0.06 ,-0.06 ,-0.06  ,-0.06 ,-0.08 ,-0.08 ,-0.1  ,-0.09 ,-0.09  ]
    yshift = [0.04 ,0.02 ,0.02 ,0.04 ,-0.02 ,-0.04, 0 ,0     ,0.02  ,0.04  ,-0.025 ,-0.05 ,-0.00 ,-0.05 ,-0.027 ,-0.02 ,-0.04]



    for i in xrange(iteration):
        Target.image = "sinc"#desiredshape[i]
        Target.imagefft()
        phasesum[i] = np.mod(-phasemap[1]+Target.fimage[1]+(Y-X)*xshift[i]+(Y+X)*yshift[i],2.*math.pi)*12./(2.*math.pi)
        imageamp[i] = Target.fimage[0]
        amp[i] = phasemap[0]

    pattern = IP.holograms(X,Y,7,amp,phasesum,imageamp,(1080,1920))


    dmd_pattern.pattern = pattern
    lc_dmd = lc.LC6500Device()
    lc_dmd.upload_image(dmd_pattern)
    showimages(pattern,Target,phasemap)
Exemple #14
0
    def __init__(self, **kwargs):
        self.dmd_settings = {}
        self.dmd_model = kwargs.pop('dmd_model', 'lc6500')
        self.dmd_image_directory = kwargs.pop(
            'dmd_image_directory', os.path.join("/media/lithium/DMD"))
        self.comp = ThisComputer()
        self.ip_addr = dmd_ip_dictionary[self.comp.hostname]

        # Pattern on the fly operation
        self.potential_settings = {}
        self.dmd_name = platform.uname()[1]

        # Video mode operation
        self.monitor_resolutions = self.comp.screen_resolution()

        # USB initialization
        self.lc_dmd = lc.LC6500Device()

        #TODO: FINAL THING - uncomment next line
        #assert self.monitor_resolutions == [(1920,1080)] # allow only the dlp to be connected to the device
        self.video_image = VideoImage(
            np.zeros(dmd_resolution_dict[self.dmd_model]))
        self.mode = None
def phase_measure_series_real():
	lc_dmd = lc.LC6500Device()

	X1_list = np.arange(-2,3)*200
	Y1_list = np.arange(-2,3)*200
	
	dmd_pattern_list = []

	#prepare patterns
#	for x in xrange(0,len(X1_list)):
	for x in xrange(0,5):
                #print x
                #print X1_list[x]
		for y in xrange(0,len(Y1_list)):
                        #print Y1_list[y]
			settings = {'function':pc.tilt_phase_measure_fun,'compression':'rle','exposure_time':500000,'X1':X1_list[x],'Y1':Y1_list[y],'Phase':16}
			dmd_pattern = pc.DMDPattern(**settings)
			dmd_pattern.compute_pattern()
			dmd_pattern_list.append(dmd_pattern)

	dmd_patterns = {'patterns' : dmd_pattern_list}

	lc_dmd.upload_image_sequence(dmd_patterns)
Exemple #16
0
    def send_pattern_to_dmd(self, dmd_settings_list, potential_settings_list):
        '''
        :param dmd_settings: list of dict of settings for dmd
        :param potential_settings_list: list of dict of settings for various patterns
        :return:
        '''

        self.dmd_settings_list = dmd_settings_list
        self.potential_settings_list = potential_settings_list

        dmd_patterns = []
        for idx, pot_set in enumerate(potential_settings_list):
            dmd_pattern = pc.DMDPattern(**dmd_settings_list[idx])
            potential = ippg.ProjectedPotential(**pot_set)
            #potential.evaluate_potential()
            #binary_matrix = potential.binarize()
            dmd_pattern.pattern = potential.binarized_potential
            dmd_patterns.append(dmd_pattern)

        dmd_patterns = {'patterns': dmd_patterns}

        self.lc_dmd = lc.LC6500Device()
        self.lc_dmd.upload_image_sequence(dmd_patterns)
        self.mode = 'pattern_on_the_fly'
import sys
sys.path.append('../../Library/')
import time
from UsbControl import LightCrafter6500Device as lc
import UsbControl.PatternCreation as pc
import PotetialGeneration.ImagePlanePotentialGenerator as ippg
import matplotlib.pyplot as plt
import numpy as np
from scipy.misc import imsave, imread
import scipy.ndimage as ndi
import numpy as np

lc_dmd = lc.LC6500Device()

#prepare patterns

settings = {
    'function': pc.tilt_phase_align_fun,
    'compression': 'rle',
    'exposure_time': 500000
}

dmd_pattern = pc.DMDPattern(**settings)
#    dmd_pattern.compute_pattern(
X = dmd_pattern.X
Y = dmd_pattern.Y
dmd_pattern.pattern = 1 * ((X < 270) & (X > -270) & (Y < 270) & (Y > -270) &
                           ((X + Y) % 12 > 10))

lc_dmd.upload_image(dmd_pattern)
dmd_pattern.show_pattern()
Exemple #18
0
def video_pattern_test():
    lc_dmd = lc.LC6500Device()
    lc_dmd.video_pattern_mode_test()
Exemple #19
0
def real_pattern_show():

    lc_dmd = lc.LC6500Device()

    #Prepare Pattern
    settings = {
        'function': pc.circle_fun_2,
        'compression': 'rle',
        'exposure_time': 100000000  # in us
    }
    dmd_pattern = pc.DMDPattern(**settings)

    is_debug = False

    sites_dict = {}

    circle_dict = {
        (0, 0): ippg.BoxFunction(radii=[200, 200], x_angle=0, amplitude=1),
        (0, 0): ippg.CircFunction(radii=[500, 500], x_angle=0, amplitude=1),
    }

    entire_beam_dict = {
        (0, 0): ippg.CircFunction(radii=[5000, 5000], x_angle=0, amplitude=1),
    }

    multipoint_dict = {
        (-100, -100): ippg.CircFunction(radii=[5, 5], x_angle=0, amplitude=1),
        (100, -100): ippg.CircFunction(radii=[5, 5], x_angle=0, amplitude=1),
        (-100, 100): ippg.CircFunction(radii=[5, 5], x_angle=0, amplitude=1),
        (100, 100): ippg.CircFunction(radii=[5, 5], x_angle=0, amplitude=1),
        (-150, -150): ippg.CircFunction(radii=[5, 5], x_angle=0, amplitude=1),
        (150, -150): ippg.CircFunction(radii=[5, 5], x_angle=0, amplitude=1),
        (50, -50): ippg.CircFunction(radii=[5, 5], x_angle=0, amplitude=1),
    }

    sites_dict = {
        (0, 0):
        ippg.Parabola_EllipseDip(
            parab=[400, 600],
            amplitude=1,
            ell=[80, 120],
            ell_height=0.0,
        )
    }
    #93
    # settings = {'zero_pixel': (824, 429),
    #'zero_pixel': (762, 429),
    settings = {
        'zero_pixel': (762, 586),
        'sites': sites_dict,
        'binarization_algorithm': 'randomize'
    }

    potential = ippg.ProjectedPotential(**settings)
    evaluated_matrix = potential.evaluate_potential()
    binary_matrix = potential.binarize()

    if True:
        corrector = DMDBeamCorrector('points.pgm',
                                     'profile.pgm',
                                     center=(772, 576))
        arr = np.zeros((1080, 1920))
        y, x = np.ogrid[0:1080, 0:1920]

        arr = corrector.homogenize(evaluated_matrix,
                                   w_center=(762, 586),
                                   w_size=(300, 300))

        if is_debug:
            plt.gray()
            plt.imshow(arr, interpolation='none')
            plt.show()

        for y in range(arr.shape[1]):
            print y
            for x in range(arr.shape[0]):
                # custom floyd-steinberg
                op = arr[x][y]
                # arr[x][y] = 1 if random() < op else 0
                if random() < 0:
                    newp = 1 if random() < op else 0
                else:
                    newp = 1 if 0.5 < op else 0
                arr[x][y] = newp
                err = op - newp
                if x < arr.shape[0] - 1:
                    arr[x + 1][y] = arr[x + 1][y] + err * 7 / 16
                    if y < arr.shape[1] - 1:
                        arr[x + 1][y + 1] = arr[x + 1][y + 1] + err * 1 / 16
                if y < arr.shape[1] - 1:
                    arr[x - 1][y + 1] = arr[x - 1][y + 1] + err * 3 / 16
                    arr[x][y + 1] = arr[x][y + 1] + err * 5 / 16

        binary_matrix = arr

    if is_debug:
        plt.gray()
        plt.imshow(binary_matrix, interpolation='none')
        plt.show()

    dmd_pattern.pattern = binary_matrix

    dmd_patterns = {'patterns': [dmd_pattern]}
    lc_dmd.upload_image_sequence(dmd_patterns)
Exemple #20
0
def raw_input_test():
    lc_dmd = lc.LC6500Device()
    lc_dmd.raw_input_test_sequence()
Exemple #21
0
def video_normal_mode():
    lc_dmd = lc.LC6500Device()
    lc_dmd.set_video_mode()
Exemple #22
0
def test_linux_ctl():

    lc_dmd = lc.LC6500Device()
Exemple #23
0
def manual_test():

    lc_dmd = lc.LC6500Device()
    lc_dmd.start_stop_sequence('stop')
    lc_dmd.set_pattern_on_the_fly()
Exemple #24
0
def real_pattern_show():

    lc_dmd = lc.LC6500Device()
    print lc_dmd.dev

    #Prepare Pattern
    settings = {
                'compression':'rle',
                'exposure_time':5000000 # in us
                }
    dmd_pattern = pc.DMDPattern(**settings)

    is_debug = False

    # sites_dict={}
    # sites_dict = {(-31,4):ippg.BoxFunction(radii = [30,10], x_angle=1),
    #               (120, 72):ippg.
    # BoxFunction(radii=[30,3], x_angle=2.5),
    #               (-31, 4):ippg.BoxFunction(radii=[30,10], x_angle=1)
    #               }

    # sites_dict = {(0, 0):ippg.CircFunction(radii = [50,50], x_angle=1, amplitude=1)}
    # # sites_dict = BoxCancellation.get_boxes()
    # sites_dict = {(0,-0):ippg.GaussFunction(radii = [100,100])}

    # sites_dict = {(0, 0): ippg.Parabola_BoxDip(parab=[600, 900], amplitude=1,
                                              # box=[1, 1], box_height=0.0,
                                              # )}


    #sites_dict = {(0, 0): ippg.Parabola_EllipseDip(parab=[600, 900], amplitude=1,
                                               # ell=[40, 60], ell_height=0.0,
                                               # )}
    # sites_dict = {(0, 0): ippg.Parabola_GaussDip(parab=[600, 900], amplitude=1,
    #                                            gauss=[60, 90], gauss_height=1.,
    #                                            )}

    #LAB STUFF
    '''
    sites_dict = {(0, 0): ippg.GradientParabolaMinusGauss_GaussDip(parab=[600*1.5, 900*1.5], amplitude=1,
                                                  gausscomp=[120, 180], gausscomp_height=0.2,
                                                  gauss=[60, 90], gauss_height=1.0,
                                                  #gradient=[0.0, 0.0]
                                                  gradient=[-0.0003, 0.0002] # [++ -> upper right on atoms, ++ -> upper left]
                                         )}
    '''
    #TEST STUFF
    sites_dict = {(0, 0): ippg.GradientParabolaMinusGauss_GaussDip(parab=[600*1.5, 900*1.5], amplitude=1,
                                                  gausscomp=[120, 180], gausscomp_height=0.2,
                                                  gauss=[60, 90], gauss_height=1.0,
                                                  #gradient=[0.0, 0.0]
                                                  gradient=[-0.0003, 0.0002] # [++ -> upper right on atoms, ++ -> upper left]
                                         )}

    # settings = {'zero_pixel': (824, 429),
    settings = {'zero_pixel': (762, 586),
                'sites': sites_dict,
                'binarization_algorithm': 'threshold'}

    potential = ippg.ProjectedPotential(**settings)
    evaluated_matrix = potential.evaluate_potential()

    # uncomment this to get a saved copy of the potential
    # imsave('out.png', evaluated_matrix)

    # uncomment this to use the painted potential
    # potential.real_valued_potential = np.array(imread('out.png', mode='L')).astype('float')
    # potential.real_valued_potential /= float(np.max(potential.real_valued_potential))

    binary_matrix = potential.binarize()

    if is_debug:
        plt.gray()
        plt.imshow(binary_matrix,interpolation='none')
        # plt.imshow(potential.real_valued_potential,interpolation='none')
        plt.figaspect(1)
        plt.show()

    dmd_pattern.pattern = binary_matrix

    dmd_patterns = {'patterns':[dmd_pattern]}
    lc_dmd.upload_image_sequence(dmd_patterns)
Exemple #25
0
def manual_read():
    lc_dmd = lc.LC6500Device()