In [19]:
import scda
import pprint
import logging
import os
import numpy as np
scda.configure_log()
import pprint
In [20]:
survey_params = {'Pupil': { 'prim': ['hex3', 'hex4'], 'gap':1, 'edge':'round',
'secobs': 'X', 'thick': '025',
'centobs': [False, True], 'N': 250 },
'FPM': { 'rad': [3.5, 4.0], 'M':60 },
'LS': { 'shape':'ann', 'obscure':0, 'aligntol':None,
'id':[20, 25], 'od':[81] },
'Image': { 'ida':-0.5, 'bw':0.10, 'Nlam':3}}
In [21]:
survey_dir = os.path.normpath("/astro/opticslab1/SCDA/Scripts/AMPL/survey_demo_july2016")
if not os.path.exists(survey_dir):
os.mkdir(survey_dir)
print("Created survey directory {:s}".format(survey_dir))
else:
print("The survey directory {:s} already exists".format(survey_dir))
os.chdir(survey_dir)
survey_fname = os.path.basename(survey_dir)
ampl_src_dir = os.path.normpath("./amplsrc")
slurm_dir = os.path.normpath("./slurmsh")
sol_dir = os.path.normpath("./solutions")
log_dir = os.path.normpath("./logs")
TelAp_dir = os.path.normpath("../InputMasks/TelAp")
LS_dir = os.path.normpath("../InputMasks/LS")
FPM_dir = os.path.normpath("../InputMasks/FPM")
fileorg = {'work dir':'.', 'ampl src dir':ampl_src_dir, 'slurm dir':slurm_dir,
'log dir':log_dir, 'sol dir':sol_dir,
'TelAp dir':TelAp_dir, 'LS dir':LS_dir, 'FPM dir':FPM_dir}
In [22]:
fileorg
Out[22]:
In [23]:
os.listdir(fileorg['LS dir'])
Out[23]:
In [24]:
small_survey = scda.DesignParamSurvey(scda.QuarterplaneAPLC, survey_params, fileorg=fileorg)
print("This survey has {0:d} design parameter combinations.".format(small_survey.N_combos))
print("{0:d} parameters are varied: {1}".format(len(small_survey.varied_param_index), small_survey.varied_param_index))
In [25]:
os.getcwd()
Out[25]:
In [26]:
pprint.pprint(small_survey.fileorg)
In [27]:
#i = 100
i = 0
print("Telescope aperture file for design #{:d}: {:s}".format(i+1, small_survey.coron_list[i].fileorg['TelAp fname']))
print("Focal plane mask file for design #{:d}: {:s}".format(i+1, small_survey.coron_list[i].fileorg['FPM fname']))
print("Lyot stop file for design #{:d}: {:s}".format(i+1, small_survey.coron_list[i].fileorg['LS fname']))
In [28]:
small_survey.check_ampl_input_files()
Out[28]:
In [29]:
pprint.pprint(small_survey.varied_param_combos)
In [30]:
small_survey.write_ampl_batch(override_infile_status=False, overwrite=True)
In [31]:
small_survey.write_slurm_batch(overwrite=True, queue_spec='12h')
In [32]:
small_survey.write_spreadsheet()
In [33]:
small_survey.write()
In [34]:
os.listdir('.')
Out[34]:
In [35]:
mysurvey = scda.load_design_param_survey(small_survey.fileorg['survey fname'])
In [ ]: