def test_get_variables(self): client_run('A = 3; B = 4; C = 5;') data = client_get([ 'A','B','C' ]) self.assertEqual(data['A'],3) self.assertEqual(data['B'],4) self.assertEqual(data['C'],5)
def test_put_and_get_variables(self): '''Assign matrix on remote and then retrieve.''' pyArr = np.random.random((2, 2)) client_put({'pyArr': pyArr}) client_run('matArr = pyArr') matArr = client_get(['matArr'])['matArr'] self.assertTrue(np.allclose(pyArr, matArr))
def test_get_variables(self): '''Assign variables on remote and then retrieve them.''' client_run('A = 3; B = 4; C = 5;') data = client_get(['A', 'B', 'C']) self.assertEqual(data['A'], 3) self.assertEqual(data['B'], 4) self.assertEqual(data['C'], 5)
def tearDown(self): client_run('clear')
def run_ganesh_tcr(kspace, mask, weight_fidelity, weight_temporal, beta_sqrd, noi, reordering=None): # start with a clean slate client_run('clear') if reordering is not None: client_put({'idx_real': reordering.real, 'idx_imag': reordering.imag}) client_run("save('reordering.mat','idx_real','idx_imag')") client_run('use_reorder = true;') else: client_run('use_reorder = false;') client_run('pwd') client_run('cd mr_utils/recon/reordering/temporal_tv') client_put({ 'Coil': kspace, 'mask_k_space_sparse': mask, 'weight_fidelity': weight_fidelity, 'weight_temporal': weight_temporal, 'beta_sqrd': beta_sqrd, 'noi': noi }) # client.run('load Coil6.mat; load mask_k_space_sparse.mat') client_run('reduced_k_space = Coil.*mask_k_space_sparse;') client_run('prior = generate_prior(reduced_k_space);') # client.run('recon_data = zeros(size(prior));') client_run( 'recon_data = recon_tcr_reorder(prior,reduced_k_space,mask_k_space_sparse,noi,weight_fidelity,weight_temporal,beta_sqrd,use_reorder);' ) data = client_get(['Coil', 'mask_k_space_sparse', 'recon_data']) return (data)
def test_put_and_get_variables(self): pyArr = np.random.random((2,2)) client_put({'pyArr':pyArr}) client_run('matArr = pyArr') matArr = client_get([ 'matArr' ])['matArr'] self.assertTrue(np.allclose(pyArr,matArr))