def testFit(): from OrmAnalysis import ORMOptimizer modelPath = '../hit_models/hht3/run.madx' profilePath = '/home/cristopher/HIT/ormData/ormMessdata/10-06-2019/GitterProfile/ProfilePT3/' # Last session prePath1 = "../ormData/ormMessdata/10-06-2019/" messFiles1 = [ '2019-06-10_08-31-35_hht3_h1dg1g.orm_measurement.yml', '2019-06-10_08-36-56_hht3_h1dg2g.orm_measurement.yml', #'2019-06-10_08-48-04_hht3_h2dg2g.orm_measurement.yml', #'2019-06-10_09-00-22_hht3_h3dg3g.orm_measurement.yml', #'2019-06-10_09-20-44_hht3_b3dg2g.orm_measurement.yml', #'2019-06-10_09-44-26_hht3_b3dg3g.orm_measurement.yml', #'2019-06-10_10-10-58_hht3_g3dg3g.orm_measurement.yml', #'2019-06-10_10-41-00_hht3_g3dg5g.orm_measurement.yml', '2019-06-10_11-13-49_hht3_t3dg2g.orm_measurement.yml', '2019-06-10_11-33-56_hht3_t3df1.orm_measurement.yml', ] for i in range(len(messFiles1)): messFiles1[i] = prePath1 + messFiles1[i] pList = ['kL_H1QD11', 'kL_H1QD12'] pList = [ 'kL_H1QD11', 'kL_H1QD12', #'kL_H2QT11', #'kL_H2QT12', #'kL_H2QT13', #'kL_H3QD11', #'kL_H3QD12', #'kL_H3QD21', #'kL_H3QD22', #'kL_B3QD11', #'kL_B3QD12', #'kL_G3QD11', #'kL_G3QD12', #'kL_G3QD21', #'kL_G3QD22', #'kL_G3QD31', #'kL_G3QD32', #'kL_EFG_G3QD41', #'kL_EFG_G3QD42', ] opt = ORMOptimizer(messFiles1, modelPath, profilePath, readOrm=False, plotEachM=False, plotShots=False, savePath='results/') #opt.fitErrorsSimple() singMask = 1e6 err = 1e1 maxIts = 10 opt.fitErrors(pList, singularMask=singMask, error=err, maxIt=maxIts, continueFit=True)
def gantry(simpleFit=False): from OrmAnalysis import ORMOptimizer modelPath = '/home/cristopher/HIT/hit_models/hht3/run.madx' prePath = "GantryMessungen/" prePath = '/media/cristopher/INTENSO/ormMessungen16_08_2020/' profilePath = '/media/cristopher/INTENSO/ormMessungen16_08_2020/GitterProfile/' messFiles = [ '2020-08-16_11-06-36_hht3_g3dg3g.orm_measurement.yml', '2020-08-16_11-37-45_hht3_g3dg5g.orm_measurement.yml', 'hht3_t3df1.yml', 'hht3_t3dg1g.yml', 'hht3_t3dg2g.yml', ] for i in range(len(messFiles)): messFiles[i] = prePath + messFiles[i] pList = [ #'kL_H1QD11', #'kL_H1QD12', #'kL_H2QT11', #'kL_H2QT12', #'kL_H2QT13', #'kL_H3QD11', #'kL_H3QD12', #'kL_H3QD21', #'kL_H3QD22', 'kL_B3QD11', 'kL_B3QD12', #'gantry_angle', 'kL_G3QD11', 'kL_G3QD12', 'kL_G3QD21', 'kL_G3QD22', 'kL_G3QD31', 'kL_G3QD32', 'kL_EFG_G3QD41', 'kL_EFG_G3QD42', ] opt = ORMOptimizer( messFiles, modelPath, profilePath, readOrm=False, plotEachM=False, savePath='/home/cristopher/HIT/BerichtORM/bericht06_2020') opt.showFit('fitStrengths.txt', saveMessFiles=False) singMask = 1e6 err = 1 maxIts = 100 if simpleFit: opt.fitErrorsSimple(plotMeas=1) else: opt.fitErrors(pList, singularMask=singMask, error=err, maxIt=maxIts)
def preGantry(simpleFit=False): from OrmAnalysis import ORMOptimizer modelPath = '/home/cristopher/HIT/hit_models/hht3/run.madx' # First session prePath = "/media/cristopher/INTENSO/ormMessungen16_08_2020/" profilePath = '/media/cristopher/INTENSO/ormMessungen16_08_2020/GitterProfile/' messFiles = [ '2020-08-16_09-06-55_hht3_h1dg1g.orm_measurement.yml', '2020-08-16_09-11-26_hht3_h1dg2g.orm_measurement.yml', '2020-08-16_09-22-06_hht3_h2dg2g.orm_measurement.yml', '2020-08-16_09-35-13_hht3_h3dg3g.orm_measurement.yml', '2020-08-16_10-09-09_hht3_b3dg2g.orm_measurement.yml', '2020-08-16_10-36-07_hht3_b3dg3g.orm_measurement.yml', ] for i in range(len(messFiles)): messFiles[i] = prePath + messFiles[i] pList = [ 'kL_H1QD11', 'kL_H1QD12', 'kL_H2QT11', 'kL_H2QT12', 'kL_H2QT13', 'kL_H3QD11', 'kL_H3QD12', 'kL_H3QD21', 'kL_H3QD22', #'kL_B3QD11', #'kL_B3QD12', ] opt = ORMOptimizer( messFiles, modelPath, profilePath, readOrm=False, plotEachM=False, plotShots=False, savePath='/home/cristopher/HIT/BerichtORM/bericht06_2020') singMask = 1e5 err = 1 maxIts = 100 opt.showFit('fitStrengths.txt', saveMessFiles=False) if simpleFit: opt.fitErrorsSimple(plotMeas=1) else: opt.fitErrors(pList, singularMask=singMask, error=err, maxIt=maxIts)
def gantryFit(simpleFit=False): from OrmAnalysis import ORMOptimizer modelPath = '../emittanzMess/OrbitResponse/EmitM1E108F1I8/hht3/run.madx' profilePath1 = '../ormData/ormMessdata/2019-12-04/' profilePath1 = '../ormData/ormMessdata/2020-03-15/Gitterdaten/' prePath = 'results/messFitFiles/' messFiles = [ #'results/messFitFiles/h1dg1g.yml', #'results/messFitFiles/h1dg2g.yml', #'results/messFitFiles/h2dg2g.yml', #'results/messFitFiles/h3dg3g.yml', #'results/messFitFiles/b3dg2g.yml', #'results/messFitFiles/b3dg3g.yml', #'results/messFitFiles/g3dg3g.yml', #'results/messFitFiles/g3dg5g.yml', 'results/messFitFiles/t3dg1g.yml', 'results/messFitFiles/t3dg2g.yml', 'results/messFitFiles/t3df1.yml', ] pList = [ #'kL_H1QD11', #'kL_H1QD12', #'kL_H2QT11', #'kL_H2QT12', #'kL_H2QT13', #'kL_H3QD11', #'kL_H3QD12', #'kL_H3QD21', #'kL_H3QD22', #'kL_B3QD11', #'kL_B3QD12', #'gantry_angle', #'kL_G3QD11', #'kL_G3QD12', #'kL_G3QD21', #'kL_G3QD22', 'kL_G3QD31', 'kL_G3QD32', 'kL_EFG_G3QD41', 'kL_EFG_G3QD42', ] opt = ORMOptimizer(messFiles, modelPath, profilePath1, readOrm=False, plotEachM=False, savePath='.') singMask = 1e5 err = 1e-1 maxIts = 200 if simpleFit: opt.fitErrorsSimple(plotMeas=1) else: opt.fitErrors(pList, singularMask=singMask, error=err, maxIt=maxIts)
def fit_hht2(simpleFit=False): from OrmAnalysis import ORMOptimizer, OrbitResponse prePath = '../ormData/ormMessdata/10-06-2019/' modelPath_hht2 = '../hit_models/hht2/run.madx' gitterPath = '/home/cristopher/HIT/ormData/ormMessdata/10-06-2019/GitterProfile/ProfilePT2/' hht2 = [ '2019-06-10_13-35-08_hht2_h1dg1g.orm_measurement.yml', '2019-06-10_13-37-35_hht2_h1dg2g.orm_measurement.yml', '2019-06-10_13-46-05_hht2_h2dg2g.orm_measurement.yml', '2019-06-10_13-51-36_hht2_b2dg2g.orm_measurement.yml', '2019-06-10_13-59-38_hht2_b2dg3g.orm_measurement.yml', '2019-06-10_14-08-29_hht2_t2dg2g.orm_measurement.yml', '2019-06-10_14-18-50_hht2_t2df1.orm_measurement.yml', ] for i in range(len(hht2)): hht2[i] = prePath + hht2[i] pList_hht2 = [ 'kL_H1QD11', 'kL_H1QD12', 'kL_H2QT11', 'kL_H2QT12', 'kL_H2QT13', 'kL_B2QD11', 'kL_B2QD12', 'kL_B2QD21', 'kL_B2QD22', ] opt = ORMOptimizer(hht2, modelPath_hht2, gitterPath, readOrm=False, plotEachM=False) singMask = 1e6 err = 1e-1 maxIts = 200 if simpleFit: opt.fitErrorsSimple(plotMeas=True) else: opt.fitErrors(pList_hht2, singularMask=singMask, error=err, maxIt=maxIts)
def fit_hht1(simpleFit=False): from OrmAnalysis import ORMOptimizer, OrbitResponse prePath = '../ormData/ormMessdata/10-06-2019/' modelPath_hht1 = '../hit_models/hht1/run.madx' gitterPath = '/home/cristopher/HIT/ormData/ormMessdata/10-06-2019/GitterProfile/ProfilePT1/' hht1 = [ '2019-06-10_12-08-47_hht1_h1dg1g.orm_measurement.yml', '2019-06-10_12-12-52_hht1_h1dg2g.orm_measurement.yml', '2019-06-10_12-27-49_hht1_b1dg2g.orm_measurement.yml', '2019-06-10_12-44-54_hht1_b1dg3g.orm_measurement.yml', '2019-06-10_13-04-07_hht1_t1dg2g.orm_measurement.yml', '2019-06-10_13-17-21_hht1_t1df1.orm_measurement.yml', ] for i in range(len(hht1)): hht1[i] = prePath + hht1[i] pList_hht1 = [ 'kL_H1QD11', 'kL_H1QD12', 'kL_B1QD11', 'kL_B1QD12', 'kL_B1QD21', 'kL_B1QD22', ] opt = ORMOptimizer(hht1, modelPath_hht1, gitterPath, readOrm=False, plotEachM=False) singMask = 1e5 err = 1e-1 maxIts = 200 if simpleFit: opt.fitErrorsSimple(plotMeas=True) else: opt.fitErrors(pList_hht1, singularMask=singMask, error=err, maxIt=maxIts)
def gantry(simpleFit=False): from OrmAnalysis import ORMOptimizer modelPath = '../emittanzMess/OrbitResponse/EmitM1E108F1I8/hht3/run.madx' profilePath = '/home/cristopher/HIT/ormData/ormMessdata/10-06-2019/GitterProfile/ProfilePT3/' prePath = '../ormData/ormMessdata/10-06-2019/' messFiles = [ '2019-06-10_08-31-35_hht3_h1dg1g.orm_measurement.yml', '2019-06-10_08-36-56_hht3_h1dg2g.orm_measurement.yml', '2019-06-10_08-48-04_hht3_h2dg2g.orm_measurement.yml', '2019-06-10_09-00-22_hht3_h3dg3g.orm_measurement.yml', '2019-06-10_09-20-44_hht3_b3dg2g.orm_measurement.yml', '2019-06-10_09-44-26_hht3_b3dg3g.orm_measurement.yml', '2019-06-10_10-10-58_hht3_g3dg3g.orm_measurement.yml', '2019-06-10_10-41-00_hht3_g3dg5g.orm_measurement.yml', '2019-06-10_11-13-49_hht3_t3dg2g.orm_measurement.yml', '2019-06-10_11-33-56_hht3_t3df1.orm_measurement.yml', ] for i in range(len(messFiles)): messFiles[i] = prePath + messFiles[i] profilePath1 = '../ormData/ormMessdata/2019-12-04/' # Sessions 04.12.19, 17.11.19, 06.10.19 prePath1 = '../ormData/ormMessdata/2019-11-17/ormMessungen/' prePath2 = '../ormData/ormMessdata/2019-12-04/' messFiles = [ prePath1 + '2019-11-17_13-38-51_hht3_h1dg1g.orm_measurement.yml', prePath1 + '2019-11-17_14-49-50_hht3_h1dg2g.orm_measurement.yml', prePath2 + '2019-12-04_02-58-07_hht3_h2dg2g.orm_measurement.yml', prePath2 + '2019-12-04_02-22-29_hht3_h3dg3g.orm_measurement.yml', prePath2 + '2019-12-04_01-46-17_hht3_b3dg2g.orm_measurement.yml', prePath2 + '2019-12-04_00-51-48_hht3_b3dg3g.orm_measurement.yml', prePath1 + '2019-11-17_13-58-20_hht3_g3dg3g.orm_measurement.yml', ##prePath1 + '2019-12-04_03-17-12_hht3_g3dg5g.orm_measurement.yml', prePath1 + '2019-11-17_14-30-29_hht3_g3dg5g.orm_measurement.yml', prePath + '2019-06-10_11-13-49_hht3_t3dg2g.orm_measurement.yml', prePath + '2019-06-10_11-33-56_hht3_t3df1.orm_measurement.yml', ] """ prePath = 'results/messFitFiles/' messFiles = [ prePath+'h1dg1g.yml', prePath+'h1dg2g.yml', prePath+'h2dg2g.yml', prePath+'h3dg3g.yml', prePath+'b3dg2g.yml', prePath+'b3dg3g.yml', prePath+'g3dg3g.yml', prePath+'g3dg5g.yml', prePath+'t3dg2g.yml', prePath+'t3df1.yml', ] messFiles = [ prePath1 +'2020-03-15_19-22-54_hht3_h1dg1g.orm_measurement.yml', prePath1 +'2020-03-15_19-27-44_hht3_h1dg2g.orm_measurement.yml', prePath1 +'2020-03-15_19-38-35_hht3_h2dg2g.orm_measurement.yml', prePath1 +'2020-03-15_19-51-57_hht3_h3dg3g.orm_measurement.yml', prePath1 +'2020-03-15_20-26-12_hht3_g3dg3g.orm_measurement.yml', prePath1 +'2020-03-15_21-08-04_hht3_g3dg5g.orm_measurement.yml', prePath1 +'2020-03-15_21-29-53_hht3_t3dg2g.orm_measurement.yml', prePath1 +'2020-03-15_21-57-07_hht3_t3dg1g.orm_measurement.yml', prePath1 +'2020-03-15_22-00-32_hht3_t3dg1g.orm_measurement.yml', prePath1 +'2020-03-15_22-25-44_hht3_t3df1.orm_measurement.yml', ] """ """ # Last session 15.03.2020 prePath1 = '../ormData/ormMessdata/2020-03-15/ormMessFit/' profilePath = '../ormData/ormMessdata/2020-03-15/Gitterdaten/' messFiles = [ prePath1 + 'hht3_h1dg1g.orm_measurement.yml', prePath1 + 'hht3_h1dg2g.orm_measurement.yml', prePath1 + 'hht3_h2dg2g.orm_measurement.yml', prePath1 + 'hht3_h3dg3g.orm_measurement.yml', prePath1 + 'hht3_g3dg3g.orm_measurement.yml', prePath1 + 'hht3_g3dg5g.orm_measurement.yml', prePath1 + 'hht3_t3dg2g.orm_measurement.yml', prePath1 + 'hht3_t3dg1g.orm_measurement.yml', prePath1 + 'hht3_t3df1.orm_measurement.yml', ] prePath1 = '../ormData/ormMessdata/2020-03-15/ormMessDaten/' messFiles = [ #prePath1 +'2020-03-15_19-22-54_hht3_h1dg1g.orm_measurement.yml', #prePath1 +'2020-03-15_19-27-44_hht3_h1dg2g.orm_measurement.yml', #prePath1 +'2020-03-15_19-38-35_hht3_h2dg2g.orm_measurement.yml', #prePath1 +'2020-03-15_19-51-57_hht3_h3dg3g.orm_measurement.yml', prePath1 +'2020-03-15_20-26-12_hht3_g3dg3g.orm_measurement.yml', prePath1 +'2020-03-15_21-08-04_hht3_g3dg5g.orm_measurement.yml', prePath1 +'2020-03-15_21-29-53_hht3_t3dg2g.orm_measurement.yml', prePath1 +'2020-03-15_22-00-32_hht3_t3dg1g.orm_measurement.yml', prePath1 +'2020-03-15_22-25-44_hht3_t3df1.orm_measurement.yml', ] """ pList = [ 'kL_H1QD11', 'kL_H1QD12', 'kL_H2QT11', 'kL_H2QT12', 'kL_H2QT13', 'kL_H3QD11', 'kL_H3QD12', 'kL_H3QD21', 'kL_H3QD22', 'kL_B3QD11', 'kL_B3QD12', #'gantry_angle', 'kL_G3QD11', 'kL_G3QD12', 'kL_G3QD21', 'kL_G3QD22', 'kL_G3QD31', 'kL_G3QD32', 'kL_EFG_G3QD41', 'kL_EFG_G3QD42', ] opt = ORMOptimizer(messFiles, modelPath, profilePath1, readOrm=False, plotEachM=False, savePath='.') opt.showFit('results/fit2_I9.txt', saveMessFiles=False) singMask = 1e5 err = 1e-1 maxIts = 100 if simpleFit: opt.fitErrorsSimple(plotMeas=1) else: opt.fitErrors(pList, singularMask=singMask, error=err, maxIt=maxIts)
def preGantry(simpleFit=False): from OrmAnalysis import ORMOptimizer modelPath = '../hit_models/hht3/run.madx' # First session prePath1 = "../ormData/ormMessdata/2018-10-20-orm_measurements/M8-E108-F1-I9-G1/" profilePath = '/home/cristopher/HIT/ormData/ormMessdata/10-06-2019/GitterProfile/ProfilePT3/' messFiles1 = [ '2018-10-21_04-23-18_hht3_h1dg1g.orm_measurement.yml', '2018-10-21_04-16-30_hht3_h1dg2g.orm_measurement.yml', '2018-10-21_04-08-39_hht3_h2dg2g.orm_measurement.yml', '2018-10-21_03-54-09_hht3_h3dg3g.orm_measurement.yml', '2018-10-21_03-38-51_hht3_b3dg2g.orm_measurement.yml', '2018-10-21_03-21-09_hht3_b3dg3g.orm_measurement.yml', ] # Third session prePath3 = '../ormData/ormMessdata/2019-05-11/ORM_Daten/' messFiles3 = [ '2019-05-12_02-17-11_hht2_h1dg1g.orm_measurement.yml', '2019-05-12_02-21-21_hht2_h1dg2g.orm_measurement.yml', '2019-05-12_02-27-35_hht2_h2dg2g.orm_measurement.yml', '2019-05-12_02-39-53_hht3_h3dg3g.orm_measurement.yml', '2019-05-12_02-51-13_hht3_b3dg2g.orm_measurement.yml', '2019-05-12_03-05-19_hht3_b3dg3g.orm_measurement.yml', ] # Fourth session prePath4 = '../ormData/ormMessdata/10-06-2019/' messFiles4 = [ '2019-06-10_08-31-35_hht3_h1dg1g.orm_measurement.yml', '2019-06-10_08-36-56_hht3_h1dg2g.orm_measurement.yml', '2019-06-10_08-48-04_hht3_h2dg2g.orm_measurement.yml', '2019-06-10_09-00-22_hht3_h3dg3g.orm_measurement.yml', '2019-06-10_09-20-44_hht3_b3dg2g.orm_measurement.yml', '2019-06-10_09-44-26_hht3_b3dg3g.orm_measurement.yml', ] for i in range(len(messFiles1)): messFiles1[i] = prePath1 + messFiles1[i] for i in range(len(messFiles3)): messFiles3[i] = prePath3 + messFiles3[i] for i in range(len(messFiles4)): messFiles4[i] = prePath4 + messFiles4[i] pList = [ 'kL_H1QD11', 'kL_H1QD12', 'kL_H2QT11', 'kL_H2QT12', 'kL_H2QT13', 'kL_H3QD11', 'kL_H3QD12', 'kL_H3QD21', 'kL_H3QD22', 'kL_B3QD11', 'kL_B3QD12', ] opt = ORMOptimizer(messFiles4, modelPath, profilePath, readOrm=False, plotEachM=False, plotShots=False, savePath='../ormBericht/NotSimpleResults/hht3') singMask = 1e5 err = 1e-1 maxIts = 200 if simpleFit: opt.fitErrorsSimple(plotMeas=1) else: opt.fitErrors(pList, singularMask=singMask, error=err, maxIt=maxIts)