In [ ]:
import scda
import pprint
import logging
scda.configure_log()

Demo: Prepare an SCDA design paramater survey

Define a list of pupil parameters to survey

Parameters selected here are the primary mirror (pm), support struts (ss), secondary strut thickness (sst), secondary mirror (sm). In the image plane, two bandwidths are tested, 10% and 20%. The parameter 'N' = pupil array diameter, and FPM 'rad' = radius each have only one value and therefore is fixed for all designs.


In [ ]:
#survey_params = {'Pupil': { 'pm': ['hex1', 'hex2', 'hex3', 'hex4', 'pie08'],
#                 'ss': ['X','Cross'],
#                 'sst': ['025','100'],
#                 'sm': [True, False],
#                 'N': 250 },
#                 'FPM': { 'rad': 4. },
#                 'LS': { 'shape':['ann', 'hex'], 'obscure':2, 'ppad':3, 'spad':[4,8] },
#                 'Image': { 'iwa':[3.5, 3.75, 4.], 'bw':0.10 }}

survey_params = {'Pupil': { 'pm':'hex4', 'sm':True, 'ss':'X', 'sst':'025',
                            'N': [250, 300, 350, 400, 450, 500] },
                 'FPM': { 'rad': 4. },
                 'LS': { 'shape':'ann', 'obscure':1, 'spad':1, 'id':17, 'od':83 },
                 'Image': { 'c': 10., 'iwa':3.5, 'owa':10., 'bw':0.10, 'Nlam':3 } }

In [ ]:
survey_ampl_dir = "./ampl_survey_test/" # where to write the AMPL source code

Initiate a survey object with the above parameter combinations


In [ ]:
hexap_survey = scda.DesignParamSurvey(scda.QuarterplaneAPLC, survey_params, fileorg={'ampl src dir':survey_ampl_dir})
print("This survey has {0:d} design parameter combinations.".format(hexap_survey.N_combos))
print("{0:d} parameters are varied: {1}".format(len(hexap_survey.varied_param_index), hexap_survey.varied_param_index))

In [ ]:
#i = 100
i = 0
print("Telescope aperture file for design #{:d}: {:s}".format(i+1, hexap_survey.coron_list[i].fileorg['TelAp fname']))
print("Focal plane mask file for design #{:d}: {:s}".format(i+1, hexap_survey.coron_list[i].fileorg['FPM fname']))
print("Lyot stop file for design #{:d}: {:s}".format(i+1, hexap_survey.coron_list[i].fileorg['LS fname']))

Check the status of input files needed to run the AMPL program


In [ ]:
hexap_survey.check_ampl_input_files()

List the varying parameter combinations


In [ ]:
# pprint.pprint(hexap_survey.varied_param_combos)

Write the batch of AMPL files


In [ ]:
hexap_survey.write_ampl_batch(override_infile_status=True, overwrite=True)

Write tables summarizing the design survey configuration and status to a spreadsheet


In [ ]:
hexap_survey.write_spreadsheet()

Store the design survey as a serialized python object


In [ ]:
hexap_survey.write()

Load an existing design survey


In [ ]:
mysurvey = scda.load_design_param_survey(hexap_survey.fileorg['survey fname'])