Esempio n. 1
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)
Esempio n. 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)
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)
Esempio n. 4
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
Esempio n. 5
0
def upload_saved_pattern_on_the_fly(dmd_idx, name):

    dmd_settings_list = [{
        'compression': 'rle',
        'exposure_time': 5000000  # in us
    }]

    potential_settings_list = [
        PatternRepository.SavedPattern.load_pattern(name)
    ]

    dmd_patterns = []
    for idx, pot_set in enumerate(potential_settings_list):
        print dmd_settings_list[idx]
        dmd_pattern = pc.DMDPattern(**dmd_settings_list[idx])
        dmd_pattern.pattern = potential_settings_list[idx]
        dmd_patterns.append(dmd_pattern)

    dmd_name = "PYRONAME:LiLab.dmdserver.dmd%s" % dmd_idx
    dmd_server = Pyro4.Proxy(dmd_name)

    print "trying to ping %s" % dmd_name
    print dmd_server.ping()

    print "trying to upload to %s" % dmd_name

    dmd_server.send_defined_pattern_to_dmd(dmd_patterns)
Esempio n. 6
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()
Esempio n. 7
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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 10
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)
Esempio n. 12
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)
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)
Esempio n. 14
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'
Esempio n. 15
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)
Esempio n. 16
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)
Esempio n. 17
0
    print "arguments error: 3st arg not integer"
elif tryinteger(sys.argv[4]):
    print "arguments error: 4st arg not integer"
elif tryinteger(sys.argv[5]):
    print "arguments error: 5st arg not integer"
else:
#    lc_dmd = lc.LC6500Device()

#prepare patterns       

    settings = {'function':pc.tilt_phase_measure_fun,'compression':'rle','exposure_time':500000,'X1':int(sys.argv[1]),'Y1':int(sys.argv[2]),'Phase' : int(sys.argv[3]), 'Size':int(sys.argv[4]), 'GratingSize':int(sys.argv[5])}
#slated pattern
#    settings = {'function':pc.slated_phase_measure_fun,'compression':'rle','exposure_time':500000,'X1':int(sys.argv[1]),'Y1':int(sys.argv[2]),'Phase' : int(sys.argv[3]), 'Size':int(sys.argv[4]), 'GratingSize':int(sys.argv[5])}


    dmd_pattern = pc.DMDPattern(**settings)
    dmd_pattern.compute_pattern()

 #   lc_dmd.upload_image(dmd_pattern)
    dmd_pattern.show_pattern()







#pattern rotation rotation scheme is order=0 (nearest neighbor), 1 (bilinear), 2 (biquadratic), 3 (bicubic), and 5.
#order0 gives (1 line)
#0 0 0 0 0 1 0 0 0 0 0
#0 0 0 0 1 0 0 0 0 0 0