def compare_forwards(f1, f2):
 assert_allclose(f1['sol']['data'], f2['sol']['data'])
 assert_equal(f1['sol']['ncol'], f2['sol']['ncol'])
 assert_allclose(f1['source_nn'], f2['source_nn'])
 if (f1['sol_grad'] is not None):
  assert_true((f2['sol_grad'] is not None))
  assert_allclose(f1['sol_grad']['data'], f2['sol_grad']['data'])
  assert_equal(f1['sol_grad']['ncol'], f2['sol_grad']['ncol'])
 else:
  assert_true((f2['sol_grad'] is None))
 assert_equal(f1['source_ori'], f2['source_ori'])
 assert_equal(f1['surf_ori'], f2['surf_ori'])

def compare_forwards ( f1 , f2 ) : assert_allclose ( f1 [ 'sol' ] [ 'data' ] , f2 [ 'sol' ] [ 'data' ] ) assert_equal ( f1 [ 'sol' ] [ 'ncol' ] , f2 [ 'sol' ] [ 'ncol' ] ) assert_allclose ( f1 [ 'source_nn' ] , f2 [ 'source_nn' ] ) if ( f1 [ 'sol_grad' ] is not None ) : assert_true ( ( f2 [ 'sol_grad' ] is not None ) ) assert_allclose ( f1 [ 'sol_grad' ] [ 'data' ] , f2 [ 'sol_grad' ] [ 'data' ] ) assert_equal ( f1 [ 'sol_grad' ] [ 'ncol' ] , f2 [ 'sol_grad' ] [ 'ncol' ] ) else : assert_true ( ( f2 [ 'sol_grad' ] is None ) ) assert_equal ( f1 [ 'source_ori' ] , f2 [ 'source_ori' ] ) assert_equal ( f1 [ 'surf_ori' ] , f2 [ 'surf_ori' ] )
helper to compare two potentially converted forward solutions .