# Definition of the study myName='myStudy'myPath='/afs/cern.ch/user/a/apoyet/public/pyHTC/example'myExe='/afs/cern.ch/user/m/mad/bin/madx'mySubFileName='mySubFile'myStudy=StudyObj(myName,myPath,myExe,mySubFileName,input_dir='input/',output_dir='output/',error_dir='error/',log_dir='log/')
# One has now to create the input files... myTemplate='myTemplate.madx'myMaskedParam=toolbox.getMaskedParameterList(myTemplate,tag='%MASKED_')print(myMaskedParam)
# Definition of the parameters# NB : the number of parameters doesn't mattermyParam={'Q1':[.25,.30],'Q2':[.26,.28,.29]}myStudy.define_study(myParam)# see how you can input DF or dict
# One can access the parameters and their valuesprint('The parameters are : {}'.format(myStudy.parameters_keys))print('Their values are : {}'.format(myStudy.parameters_values))print('Printing in full : {}'.format(myStudy.parameters))
The parameters are : ['Q1', 'Q2']
Their values are : [[0.25, 0.3], [0.26, 0.28, 0.29]]
Printing in full : {'Q1': [0.25, 0.3], 'Q2': [0.26, 0.28, 0.29]}
# Creation of the input filesforxinmyStudy.parameters['Q1']:foryinmyStudy.parameters['Q2']:myMachineParam={}myMachineParam.update({'%MASKED_Q1':x,'%MASKED_Q2':y,'%MASKED_output_file':'/afs/cern.ch/user/a/apoyet/public/pyHTC/example/mad_output/ptc_out_{0}_{1}.txt'.format(x,y)})myInputFile='input/{0}_{1}_{2}.in'.format(myStudy.name,x,y)toolbox.unmask(myTemplate,myMaskedParam,myMachineParam,myInputFile)
# Creating the submission file corresponding to the STUDY # NB : MULTIPLE JOBS SUBMISSIONmyStudy.submit2file(myStudy.submit2str())
# One can display the submission filemyStudy.display_subfile()
# The idea then is to generate a pandas DataFrame containing the different points (or JOBS) of the study# The DF will be used as a reference afterwards to retrieve which job was made which which parameters# It should therefore contains the paths of the corresponding filesdf=myStudy.get_studyDF()