def illumInit(self): """ initialize the illumination system for use in the mapping process """ MF = self.MF print "Initializing release system\n" PI.py_clear_memory(); # initialize module values if PI.py_illuminate_init(int(MF.IlluminateWidth),\ int(MF.IlluminateHeight),\ int(MF.CameraWidth),\ int(MF.CameraHeight)) < 0: sys.exit(-1) #end if # load an identity map for alignment parameters # CRUCIAL as for now!!!!!!!!!!!! PI.py_illuminate_alignment_load_identity() # enable release hardware PI.py_illuminate_enable() # Create a group of masks PI.py_illum_mask_radius(MF.mask_radius0,MF.mask_number0) PI.py_illum_mask_radius(MF.mask_radius1,MF.mask_number1) PI.py_illum_mask_radius(MF.mask_radius2,MF.mask_number2) PI.py_illum_mask_radius(MF.mask_radius3,MF.mask_number3)
def thing(expos=0.008, gain=2, mycube='spare', TDI_flag = 0): """ Process command line. This is used """ IlluminateWidth = 1920 IlluminateHeight = 1080 CameraWidth = 1000 CameraHeight = 1000 #MF = MaestroFunctions.Maestro_Functions() MF = MaestroFunctions() # process the numeric arguments int_time = float(expos) em_gain = int(gain) """ Set up imaging """ MF.darkfield_off() print "the third argument is %s\n" % mycube MF.filter_goto(mycube) """ set up release hardware """ # initialize the release system print "Initializing release system\n" PI.py_clear_memory(); if PI.py_illuminate_init(IlluminateWidth, IlluminateHeight, \ CameraWidth, CameraHeight) < 0: sys.exit(-1) #end if # load an identity map for alignment parameters # CRUCIAL as for now!!!!!!!!!!!! PI.py_illuminate_alignment_load_identity() # enable release hardware PI.py_illuminate_enable() # generate an image """ im = Image.open("test.png") if im.size[0] > im.size[1]: scaler = IlluminateWidth/(im.size[0]) im = im.resize((IlluminateWidth, scaler*im.size[1]),Image.BICUBIC) #end if else: scaler = IlluminateHeight/(im.size[1]) im = im.resize((scaler*im.size[0], IlluminateHeight),Image.BICUBIC) #end else im.convert('L') im.show() im.save("testout.png") """ #im = Image.open("wyss_HD_R3.bmp") im = Image.open("../data/alignment_DMD5.bmp") #im = Image.open("George_Church_03.bmp") #im = Image.open("all_white.bmp") #im = im.rotate(90) im = im.transpose(Image.FLIP_LEFT_RIGHT) im = im.transpose(Image.FLIP_TOP_BOTTOM) #im = im.offset(50, -300) pix = im.load() mask_number = 0 y_step = 1 x_step = 1 #PI.py_clear_mask(mask_number) PI.py_clear_framebuffer() #PI.py_clear_memory() # must run this or you will get line artifacts!!!! PI.py_illum_mask_radius(0,mask_number) #done = 0 for y in range(0,IlluminateHeight,y_step): for x in range(0,IlluminateWidth,x_step): #if pix[y,x] != 0: if pix[y,x] == 0:# and done == 0: #x = 1920/2 #y = 1080/2 PI.py_illuminate_point(x,y,mask_number) #print x, y #done = 1; #end if # end for # end for # expose image, so that it stays displayed #PI.py_illuminate_disable() PI.py_illuminate_expose() """ start imaging """ # open shutter MF.shutter_open() return 0