@@ -293,7 +293,7 @@ def opt(self):
293
293
delta_x = spla .spsolve (M ,Lty )
294
294
scale = 1
295
295
# 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
297
297
while not scale_good :
298
298
next_y = self .create_y (self .add_delta (delta_x * scale ))
299
299
pred_y = y - L .dot (delta_x * scale )
@@ -350,26 +350,26 @@ def test_Jacobian(batch_uni, col, dx = .001):
350
350
opt_class .opt ()
351
351
plt .plot (opt_class .states [:,0 ],opt_class .states [:,1 ],'b' ,label = 'opt' )
352
352
plt .legend ()
353
- plt .savefig (f'{ prefix } _res .png' )
353
+ plt .savefig (f'{ prefix } _res_new .png' )
354
354
355
355
plt .figure ()
356
356
plt .plot (opt_class .states [:,0 ],opt_class .states [:,1 ],c = 'b' , label = 'estimate' )
357
357
plt .plot (truth [:,0 ],truth [:,1 ],'r--' ,label = 'truth' )
358
358
plt .legend ()
359
359
ax = plt .gca ()
360
360
ax .set_aspect ('equal' )
361
- plt .savefig ('FG_' + prefix + '.png' )
361
+ plt .savefig ('FG_' + prefix + '_new .png' )
362
362
plt .show ()
363
363
364
364
365
365
plt .figure ()
366
366
plt .plot (opt_class .states - truth )
367
367
plt .legend (['x' ,'y' ,'vx' ,'vy' ])
368
368
plt .title ('errors' )
369
- plt .savefig (f'{ prefix } _errors .png' )
369
+ plt .savefig (f'{ prefix } _errors_new .png' )
370
370
plt .show ()
371
371
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 )
373
373
374
374
375
375
0 commit comments