def test_recenter(): configfilename = 'speckle_null_config.ini' config = ConfigObj(configfilename) configfilename = 'speckle_null_config.ini' hardwareconfigfile = 'speckle_instruments.ini' configspecfile = 'speckle_null_config.spec' config = ConfigObj(configfilename, configspec=configspecfile) val = Validator() check = config.validate(val) pharo = hardware.PHARO_COM('PHARO', configfile = hardwareconfigfile) p3k = hardware.P3K_COM('P3K_COM', configfile = hardwareconfigfile) #LOAD CURRENT FLATMAP print("\n\nBeginning DM REGISTRATION\n\n") time.sleep(2) print("Retrieving bgd, flat, badpix") bgds = flh.setup_bgd_dict(config) use_centoffs = config['NULLING']['cent_off'] initial_flatmap = p3k.grab_current_flatmap() p3k.safesend2('hwfp dm=off') DMamp = 33 kvecr = 33 additionmapx = DM.make_speckle_kxy(kvecr, 0,DMamp , 0) additionmapy = DM.make_speckle_kxy(0,kvecr, DMamp, 0) additionmap = additionmapx + additionmapy print ("sending new flatmap to p3k") status = p3k.load_new_flatmap((initial_flatmap + additionmap)) while True: image = pharo.take_src_return_imagedata(exptime = 4) dm_reg_autorun(image, configfilename, configspecfile) time.sleep(2) pass
if __name__ == "__main__": configfilename = 'qacits_config.ini' hardwareconfigfile = 'speckle_instruments.ini' configspecfile = 'qacits_config.spec' config = ConfigObj(configfilename, configspec=configspecfile) val = Validator() check = config.validate(val) home = 0 lab = 1 #pharo = hardware.fake_pharo() if lab: p3k = hardware.P3K_COM('P3K_COM', configfile = hardwareconfigfile) pharo = hardware.PHARO_COM('PHARO', configfile = hardwareconfigfile) # background, flat and bad pix map #bgd = np.zeros((1024, 1024)) #flat = np.ones((1024, 1024)) #bpix = np.zeros((1024, 1024)) # parameters defining the zone of interest centerx = config['Image_params']['centerx'] centery = config['Image_params']['centery'] spotcenters = np.resize(config['Image_params']['spotcenters_init'], (4,2)) quad_width_pix = config['Image_params']['quad_width'] * config['Image_params']['lambdaoverd'] inner_rad_pix = config['Image_params']['inner_rad'] * config['Image_params']['lambdaoverd']