Skip to content

Commit 8ceac0d

Browse files
authored
Merge pull request #3 from cntaylor/2-t_mat-in-orbitfg
2 t mat in orbitfg
2 parents 89cec0b + d9d1421 commit 8ceac0d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

OrbitFG.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def F_mat(self,state):
159159
dist = la.norm(curr_state[:2])
160160
k = self.prop_dt*self.GE/(dist**5)
161161

162-
t_mat = np.array([[-self.prop_dt*(y**2-2*x**2)/2, 3*x*y*self.prop_dt, 0, 0],
162+
t_mat = np.array([[-self.prop_dt*(y**2-2*x**2)/2, 3*x*y*self.prop_dt/2.0, 0, 0],
163163
[3*x*y*self.prop_dt/2.0, -self.prop_dt*(x**2-2*y**2)/2, 0, 0],
164164
[2*x**2-y**2, 3*x*y, 0, 0],
165165
[3*x*y, 2*y**2-x**2, 0, 0]])
@@ -293,7 +293,7 @@ def opt(self):
293293
delta_x = spla.spsolve(M,Lty)
294294
scale = 1
295295
# Damp the Gauss-Newton step if it doesn't do what the linearization predicts
296-
scale_good = False
296+
scale_good = la.norm(delta_x) < 10 # if the first step is too small, just do it and don't even check
297297
while not scale_good:
298298
next_y = self.create_y(self.add_delta(delta_x*scale))
299299
pred_y = y-L.dot(delta_x*scale)
@@ -350,26 +350,26 @@ def test_Jacobian(batch_uni, col, dx = .001):
350350
opt_class.opt()
351351
plt.plot(opt_class.states[:,0],opt_class.states[:,1],'b',label='opt')
352352
plt.legend()
353-
plt.savefig(f'{prefix}_res.png')
353+
plt.savefig(f'{prefix}_res_new.png')
354354

355355
plt.figure()
356356
plt.plot(opt_class.states[:,0],opt_class.states[:,1],c='b', label='estimate')
357357
plt.plot(truth[:,0],truth[:,1],'r--',label='truth')
358358
plt.legend()
359359
ax=plt.gca()
360360
ax.set_aspect('equal')
361-
plt.savefig('FG_'+prefix+'.png')
361+
plt.savefig('FG_'+prefix+'_new.png')
362362
plt.show()
363363

364364

365365
plt.figure()
366366
plt.plot(opt_class.states-truth)
367367
plt.legend (['x','y','vx','vy'])
368368
plt.title('errors')
369-
plt.savefig(f'{prefix}_errors.png')
369+
plt.savefig(f'{prefix}_errors_new.png')
370370
plt.show()
371371

372-
np.savez('fg_'+prefix+'_res',fg_res=opt_class.states, truth=truth)
372+
np.savez('fg_'+prefix+'_res_new',fg_res=opt_class.states, truth=truth)
373373

374374

375375

0 commit comments

Comments
 (0)