def getVels(Cass,pixelTimes,Xnot,Ynot,Znot,inot,jnot,polyOrder=2):#velocity polynomial fitting order objx=poly(Cass[:,3],Cass[:,0],renormX=True,order=polyOrder) objy=poly(Cass[:,3],Cass[:,1],renormX=True,order=polyOrder) objz=poly(Cass[:,3],Cass[:,2],renormX=True,order=polyOrder) spaceCraftX=pixelTimes*0.0 spaceCraftY=pixelTimes*0.0 spaceCraftZ=pixelTimes*0.0 for i in range(len(pixelTimes)): spaceCraftX[i,:]=objx.eval(pixelTimes[i,:]) spaceCraftY[i,:]=objy.eval(pixelTimes[i,:]) spaceCraftZ[i,:]=objz.eval(pixelTimes[i,:]) spaceCraftVectornot=num.array([Xnot,Ynot,Znot]) deltaX=spaceCraftX-spaceCraftX[inot,jnot] deltaY=spaceCraftY-spaceCraftY[inot,jnot] deltaZ=spaceCraftZ-spaceCraftZ[inot,jnot] return (spaceCraftVectornot,deltaX,deltaY,deltaZ)
inot=int(Cass[0,5]) jnot=int(Cass[0,6]) Tnot=Cass[0,3] pixelTimes+=Tnot-pixelTimes[inot,jnot] #distance units are in km, resolution units in km/pix [Xnot,Ynot,Znot]=latLongObj[inot][jnot]['SpacecraftPosition'] distancenot=latLongObj[inot][jnot]['TargetCenterDistance'] sampleResolutionnot=latLongObj[inot][jnot]['SampleResolution']/1000. #velocity polynomial fitting order polyOrder=2 objx=poly(Cass[:,3],Cass[:,0],renormX=True,order=polyOrder) objy=poly(Cass[:,3],Cass[:,1],renormX=True,order=polyOrder) objz=poly(Cass[:,3],Cass[:,2],renormX=True,order=polyOrder) spaceCraftX=pixelTimes*0.0 spaceCraftY=pixelTimes*0.0 spaceCraftZ=pixelTimes*0.0 for i in range(len(pixelTimes)): spaceCraftX[i,:]=objx.eval(pixelTimes[i,:]) spaceCraftY[i,:]=objy.eval(pixelTimes[i,:]) spaceCraftZ[i,:]=objz.eval(pixelTimes[i,:]) spaceCraftVectornot=num.array([Xnot,Ynot,Znot]) deltaX=spaceCraftX-spaceCraftX[inot,jnot] deltaY=spaceCraftY-spaceCraftY[inot,jnot] deltaZ=spaceCraftZ-spaceCraftZ[inot,jnot]