In [1]:
import scda
import pprint
import logging
import os
import numpy as np
scda.configure_log()
In [2]:
survey_params = {'Pupil': { 'prim': ['hex1', 'hex2', 'hex3', 'hex4'],
'secobs': 'X', 'thick': '025',
'centobs': True, 'N': 125 },
'FPM': { 'rad': [3.0, 4.0, 5.0], 'M':60 },
'LS': { 'shape':'ann', 'obscure':0, 'aligntol':5, 'aligntolcon':3.,
'id':[20, 25, 30], 'od':[76, 78, 80, 82] },
'Image': { 'ida':-0.5, 'bw':0.10, 'Nlam':3}}
In [3]:
survey_dir = os.path.normpath("/astro/opticslab1/SCDA/Scripts/AMPL/april_survey01_10bw")
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 [5]:
fileorg
Out[5]:
In [6]:
hexap_survey = scda.DesignParamSurvey(scda.QuarterplaneAPLC, survey_params, fileorg=fileorg)
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 [7]:
os.getcwd()
Out[7]:
In [8]:
pprint.pprint(hexap_survey.fileorg)
In [9]:
#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']))
In [10]:
hexap_survey.check_ampl_input_files()
Out[10]:
In [11]:
# pprint.pprint(hexap_survey.varied_param_combos)
In [12]:
hexap_survey.write_ampl_batch(override_infile_status=False, overwrite=True)
In [13]:
hexap_survey.write_slurm_batch(overwrite=True, queue_spec='12h')
In [14]:
hexap_survey.write_spreadsheet()
In [15]:
hexap_survey.write()
In [16]:
os.listdir('.')
Out[16]:
In [17]:
mysurvey = scda.load_design_param_survey(hexap_survey.fileorg['survey fname'])
In [ ]: