slotupst[0]=ballsdict['L1 slot ball']['X Location'][1] slotupst[1]=ballsdict['L1 slot ball']['Y Location'][1] slotupst[2]=ballsdict['L1 slot ball']['Z Location'][1] slotdownst[0]=ballsdict['L3 slot ball']['X Location'][1] slotdownst[1]=ballsdict['L3 slot ball']['Y Location'][1] slotdownst[2]=ballsdict['L3 slot ball']['Z Location'][1] ball_basis = ogp_util.make_uch_basis(holeupst,holedownst,slotupst,slotdownst) #ball basis in U-channel survey frame: ball +Z is survey +Y, ball +Y is survey +/-Z, survey origin is L2 hole pin #print ball_basis #print modulesurvey_basis l1_basis = ogp_util.get_uch_mount(noballsdict,'L1') #pin basis in U-channel survey frame: l1, l2, l3 all the same, pin +Y is survey +Z, pin +Z is survey +/-Y, survey origin is L2 hole pin #print l1_basis l3_basis = ogp_util.get_uch_mount(noballsdict,'L3') l1_basis_trans = ogp_util.transform_basis(ball_basis,modulesurvey_basis,l1_basis) #pin basis in module survey frame: pin +Y is survey +Z, pin +Z is survey +/-Y #print l1_basis_trans l2_basis_trans = ogp_util.transform_basis(ball_basis,modulesurvey_basis,l2_basis) #print l2_basis_trans l3_basis_trans = ogp_util.transform_basis(ball_basis,modulesurvey_basis,l3_basis) #print l3_basis_trans print "residuals between survey of mounted modules, and where we expect sensors to be from individual surveys of modules and U-channel:" l1s_pts = ogp_util.get_sensor_points(modulesdict,'L1 stereo',3) #sensor edge points in module survey frame ogp_util.find_sensor_residuals(l1_basis_trans,l1s,l1s_pts) l1a_pts = ogp_util.get_sensor_points(modulesdict,'L1 axial',3) #sensor edge points in module survey frame ogp_util.find_sensor_residuals(l1_basis_trans,l1a,l1a_pts)
for position in positions: #print position axis = transform_axis(null_basis,position,p) residuals = np.append(residuals,(axis-axis_nom)[:,1:3]) #print axis-axis_nom #print residuals return residuals #print fitfunc(p0,b13_positions,b13_nom) sol = scipy.optimize.leastsq(fitfunc,p0,args=(b13_positions,b13_nom))[0] #print sol print "B13 ball basis in pivot frame:" print ogp_util.reverse_basis(get_basis(sol)) #print transform_axis(null_basis,b13_nom,sol) print "B13 pivot basis in box frame:" print ogp_util.transform_basis(null_basis,b13_nom,get_basis(sol)) #print fitfunc(sol,b13_positions,b13_nom).reshape(-1,4) sol = scipy.optimize.leastsq(fitfunc,p0,args=(t13_positions,t13_nom))[0] #print sol print "T13 ball basis in pivot frame:" print ogp_util.reverse_basis(get_basis(sol)) #print transform_axis(null_basis,t13_nom,sol) print "T13 pivot basis in box frame:" print ogp_util.transform_basis(null_basis,t13_nom,get_basis(sol)) #print fitfunc(sol,t13_positions,t13_nom).reshape(-1,4) # tweaking/repeatability tests of b46 #print ogp_util.get_uchbasis(stepdict,'M_TOP46','') #print ogp_util.get_uchbasis(stepdict,'M_TOP46','_CHK')
slotupst[1]=ballsdict['L4 slot ball']['Y Location'][1] slotupst[2]=ballsdict['L4 slot ball']['Z Location'][1] slotdownst[0]=ballsdict['L6 slot ball']['X Location'][1] slotdownst[1]=ballsdict['L6 slot ball']['Y Location'][1] slotdownst[2]=ballsdict['L6 slot ball']['Z Location'][1] ball_basis = ogp_util.make_uch_basis(holeupst,holedownst,slotupst,slotdownst) #ball basis in U-channel survey frame: ball +Z is survey +Y, ball +Y is survey +/-Z, survey origin is L5 hole pin #print ball_basis #print modulesurvey_basis l4_basis = ogp_util.get_uch_mount(noballsdict,'L4') #pin basis in U-channel survey frame: l4, l5, l6 all the same, pin +Y is survey +Z, pin +Z is survey +/-Y, survey origin is L2 hole pin #print l4_basis l6_basis = ogp_util.get_uch_mount(noballsdict,'L6') l4_basis_trans = ogp_util.transform_basis(ball_basis,modulesurvey_basis,l4_basis) #pin basis in module survey frame: pin +Y is survey +Z, pin +Z is survey +/-Y #print l1_basis_trans l5_basis_trans = ogp_util.transform_basis(ball_basis,modulesurvey_basis,l5_basis) #print l2_basis_trans l6_basis_trans = ogp_util.transform_basis(ball_basis,modulesurvey_basis,l6_basis) #print l3_basis_trans print "residuals between survey of mounted modules, and where we expect sensors to be from individual surveys of modules and U-channel:" l4se_pts = ogp_util.get_sensor_points(modulesdict,'L4 stereo block',3) #sensor edge points in module survey frame ogp_util.find_sensor_residuals(l4_basis_trans,l4se,l4se_pts) l4sp_pts = ogp_util.get_sensor_points(modulesdict,'L4 stereo lever',3) #sensor edge points in module survey frame ogp_util.find_sensor_residuals(l4_basis_trans,l4sp,l4sp_pts)
slotdownst[2] = ballsdict['L6 slot ball']['Z Location'][1] ball_basis = ogp_util.make_uch_basis( holeupst, holedownst, slotupst, slotdownst ) #ball basis in U-channel survey frame: ball +Z is survey +Y, ball +Y is survey +/-Z, survey origin is L5 hole pin #print ball_basis #print modulesurvey_basis l4_basis = ogp_util.get_uch_mount( noballsdict, 'L4' ) #pin basis in U-channel survey frame: l4, l5, l6 all the same, pin +Y is survey +Z, pin +Z is survey +/-Y, survey origin is L2 hole pin #print l4_basis l6_basis = ogp_util.get_uch_mount(noballsdict, 'L6') l4_basis_trans = ogp_util.transform_basis( ball_basis, modulesurvey_basis, l4_basis ) #pin basis in module survey frame: pin +Y is survey +Z, pin +Z is survey +/-Y #print l1_basis_trans l5_basis_trans = ogp_util.transform_basis(ball_basis, modulesurvey_basis, l5_basis) #print l2_basis_trans l6_basis_trans = ogp_util.transform_basis(ball_basis, modulesurvey_basis, l6_basis) #print l3_basis_trans print "residuals between survey of mounted modules, and where we expect sensors to be from individual surveys of modules and U-channel:" l4se_pts = ogp_util.get_sensor_points( modulesdict, 'L4 stereo block', 3) #sensor edge points in module survey frame