def explore_decenter_parameter_space(decenter_parameter, values): for _value in values: print _value # Build .seq file for automated run. TEL = autoact.AutoACT(ARRAY, descriptors=[ "secondary_decentering", "pa%s" % (ARRAY), decenter_parameter, _value ]) TEL.create_header() TEL.load_clean_len() TEL.remove_glass() TEL.apply_ar_coatings() TEL.set_wavelengths( wavelengths=[int(autov.freq2lambda(int(args.frequency)))], reference=0) # surface 4 is the secondary TEL.set_decenter_type(4, 'decenter and return') TEL.decenter_surface(4, decenter_parameter, _value) TEL.set_fields(polarization=1) TEL.set_vignetting() TEL.activate_pol_ray_trace() TEL.set_image_semi_aperture() TEL.run_psf() TEL.run_real_ray_trace() # skipping polarization analysis, since it'll just slow us down for now #TEL.run_poldsp(input_angle=0, pupil_number=23) #TEL.run_poldsp(input_angle=90, pupil_number=23) TEL.exit() TEL.run() file_name = TEL.save_cfg(out_dir="./output/")
def test_decenter(parameter, values, units): for value in values: if parameter in ['x', 'y', 'z']: descriptors = [ parameter, "%smm" % (int(value * 10)) ] # Note, this is done to avoid a decimal in the filename! else: descriptors = [parameter, "%sdeg" % (str(value).replace('.', 'p'))] # Build .seq file for automated run. arc_autov = autoact.AutoACT(ARRAY, descriptors) decenter_description_dict = { "type": "decenter", "parameter": parameter, "offset": value, "units": units } arc_autov.add_to_json_cfg("perturbation", decenter_description_dict) arc_autov.create_header() arc_autov.load_clean_len() arc_autov.remove_glass() arc_autov.apply_ar_coatings() if ARRAY in ['1', '2']: arc_autov.set_wavelengths(wavelengths=[2140000, 2070000, 2000000], reference=1) # ar1, ar2 elif ARRAY in ['3']: #arc_autov.set_wavelengths(wavelengths=[3000000, 2070000, 1380000], reference=0) # ar3 raise ValueError("Array 3 not yet supported.") # Test arc_autov.decenter_cryostat(parameter, value) arc_autov.set_fields() arc_autov.set_vignetting() arc_autov.activate_pol_ray_trace() arc_autov.set_image_semi_aperture() # Setup to run tests in CODE V. These all need to be output to config files. arc_autov.run_psf() arc_autov.run_real_ray_trace() arc_autov.run_poldsp(input_angle=0, pupil_number=23) #arc_autov.run_poldsp(input_angle=90, pupil_number=23) arc_autov.exit() arc_autov.run() arc_autov.save_cfg(out_dir="./output/optics_tube/%s_decenter/" % (parameter))
def test_ar_coatings(coatings): for (thicknesses, coating, descriptors) in coatings: # Set ref_wl for file descriptors. if ARRAY in ['1', '2']: ref_wl = 2070000 elif ARRAY in ['3']: raise ValueError("Array 3 not yet supported.") #ref_wl = 3000000 # Build .seq file for automated run. arc_autov = autoact.AutoACT(ARRAY, descriptors) offset_value = (float(central_thicknesses[0] - thicknesses[0]) / central_thicknesses[0] ) * 100 #percent difference from original thickness index_variation_dict = { "type": "arc_thickness", "parameter": "index", "offset": offset_value, "units": "Percent" } arc_autov.add_to_json_cfg("perturbation", index_variation_dict) arc_autov.create_header() arc_autov.load_clean_len() arc_autov.remove_glass() arc_autov.apply_ar_coatings(coating_file=coating) if ARRAY in ['1', '2']: arc_autov.set_wavelengths(wavelengths=[2140000, 2070000, 2000000], reference=1) # ar1, ar2 elif ARRAY in ['3']: #arc_autov.set_wavelengths(wavelengths=[3000000, 2070000, 1380000], reference=0) # ar3 raise ValueError("Array 3 not yet supported.") arc_autov.set_fields() arc_autov.set_vignetting() arc_autov.activate_pol_ray_trace() arc_autov.set_image_semi_aperture() arc_autov.run_psf() arc_autov.run_real_ray_trace() arc_autov.run_poldsp(input_angle=0, pupil_number=23) #arc_autov.run_poldsp(input_angle=90, pupil_number=23) arc_autov.exit() arc_autov.run() arc_autov.save_cfg(out_dir="./output/arc_thickness/")
parser = argparse.ArgumentParser() parser.add_argument("array", choices=['1', '2', '3'], help="Array you want to automate.") args = parser.parse_args() ARRAY = args.array DATE = time.strftime('%Y%m%d') CTIME = int(time.time()) outDir = "E:\ownCloud\optics\data\\" tmpDir = "E:\ownCloud\optics\data\\tmp\\" #autoseq = "pa%s_automation.seq"%ARRAY # Build .seq file for automated run. qq = autoact.AutoACT(ARRAY, [""]) qq.create_header() qq.load_clean_len() qq.remove_glass() qq.apply_ar_coatings() if ARRAY in ['1', '2']: qq.set_wavelengths(wavelengths=[2140000, 2070000, 2000000], reference=1) # ar1, ar2 elif ARRAY in ['3']: qq.set_wavelengths(wavelengths=[3000000, 2070000, 1380000], reference=0) # ar3 qq.set_fields() qq.set_vignetting() qq.activate_pol_ray_trace() qq.set_image_semi_aperture() #qq.quick_best_focus()
choices=['1', '2', '3', '4', '5', '6'], help="Array you want to automate.") parser.add_argument( "frequency", help="Frequency to run the Code V calculations at in units of GHz.") args = parser.parse_args() ARRAY = args.array DATE = time.strftime('%Y%m%d') CTIME = int(time.time()) outDir = "E:\ownCloud\optics\data\\" tmpDir = "E:\ownCloud\optics\data\\tmp\\" # Build .seq file for automated run. qq = autoact.AutoACT(ARRAY, descriptors=["calibration", "pa%s" % (ARRAY)]) qq.create_header() qq.load_clean_len() qq.remove_glass() qq.apply_ar_coatings() qq.set_wavelengths(wavelengths=[int(autov.freq2lambda(int(args.frequency)))], reference=0) qq.set_fields(polarization=1) qq.set_vignetting() qq.activate_pol_ray_trace() qq.set_image_semi_aperture() #qq.run_psf() #qq.run_real_ray_trace() #qq.run_poldsp(input_angle=0, pupil_number=23) #qq.run_poldsp(input_angle=90, pupil_number=23) #qq.exit()
help="Frequency to run the Code V calculations at in units of GHz.") args = parser.parse_args() ARRAY = args.array DATE = time.strftime('%Y%m%d') CTIME = int(time.time()) outDir = "E:\ownCloud\optics\data\\" tmpDir = "E:\ownCloud\optics\data\\tmp\\" coating, descriptors = ( r"E:\ownCloud\optics\mul\hf\three_layer_coating_120_185_285.mul", ["calibration", "pa%s" % (ARRAY)]) # Build .seq file for automated run. arc_autov = autoact.AutoACT(ARRAY, descriptors) arc_autov.create_header() arc_autov.load_clean_len() arc_autov.remove_glass() arc_autov.enter_single_command('THC S47 100') # freeze focal plane arc_autov.enter_single_command('CCY S45 100') # freeze l3_b y-radius arc_autov.enter_single_command('CCY S41 100') # freeze l3_b y-radius arc_autov.apply_ar_coatings(coating_file=coating) arc_autov.set_wavelengths(wavelengths=[int(autov.freq2lambda(args.frequency))], reference=0) arc_autov.set_fields(polarization=1) arc_autov.set_vignetting() arc_autov.activate_pol_ray_trace() arc_autov.set_image_semi_aperture() arc_autov.run_psf() arc_autov.run_real_ray_trace()
"-V", "--view", help= "View only. Don't run the analysis steps, or save any cfg files. Will cause Code V not to exit after setup.", action="store_false") args = parser.parse_args() ARRAY = args.array DATE = time.strftime('%Y%m%d') CTIME = int(time.time()) outDir = "E:\ownCloud\optics\data\\" tmpDir = "E:\ownCloud\optics\data\\tmp\\" # Build .seq file for automated run. qq = autoact.AutoACT(ARRAY, descriptors=["ip_leakage", "pa%s" % (ARRAY)]) qq.create_header() qq.load_clean_len() qq.remove_glass() qq.apply_ar_coatings() qq.set_wavelengths(wavelengths=[int(autov.freq2lambda(int(args.frequency)))], reference=0) qq.set_fields(polarization=0) qq.set_vignetting() qq.activate_pol_ray_trace() qq.set_image_semi_aperture() if args.view: qq.run_psf() qq.run_real_ray_trace() qq.run_poldsp(input_angle=0, pupil_number=23)
# Parse arguments passed to the script. parser = argparse.ArgumentParser() parser.add_argument("array", choices=['1', '2', '3', '4', '5', '6'], help="Array you want to automate.") parser.add_argument("frequency", help="Frequency to run the Code V calculations at in units of GHz.") parser.add_argument("-V", "--view", help="View only. Don't run the analysis steps, or save any cfg files. Will cause Code V not to exit after setup.", action="store_false") args = parser.parse_args() ARRAY = args.array DATE = time.strftime('%Y%m%d') CTIME = int(time.time()) outDir = "E:\ownCloud\optics\data\\" tmpDir = "E:\ownCloud\optics\data\\tmp\\" # Build .seq file for automated run. qq = autoact.AutoACT(ARRAY, descriptors=["mueller", "pa%s"%(ARRAY)]) qq.create_header() qq.load_clean_len() qq.remove_glass() qq.apply_ar_coatings() qq.set_wavelengths(wavelengths=[int(autov.freq2lambda(int(args.frequency)))], reference=0) qq.set_fields(polarization=0) qq.enter_single_command("INS S1") # insert dummy surface for mmtab for i in range(24): qq.enter_single_command("DEL F1+1") # insert dummy surface for mmtab qq.set_vignetting() qq.activate_pol_ray_trace() qq.set_image_semi_aperture()