import numpy as np import matplotlib.pyplot as plt import pandas as pd from pyreconstruct import reconstruct_from_2DFT,adjust_phase # Opts np.set_printoptions(precision=3) # Import S S_real = pd.read_csv('S_real.csv',sep=',',header=None).values S_imag = pd.read_csv('S_imag.csv',sep=',',header=None).values S = S_real+1j*S_imag img = reconstruct_from_2DFT(S) plt.figure() plt.imshow(img) plt.colorbar(label='intensity') plt.xlabel('X position (a.u.)') plt.ylabel('Y position (a.u.)') plt.show()
'lac_2_pyr_rate': 0.0, 'pyr_sigma': 0.0, 'lac_sigma': 10e-6 } print('beginning sim with ' + str(num_ems) + ' ems') sim = Sim(em_magnetizations, em_positions, em_velocities, em_gyromagnetic_ratio, em_shielding_constants, em_equilibrium_magnetization, em_delta_t, conversion_dict, T1_map, T2_map, main_field, pulse_sequence) ems, mrs = sim.run_sim() num_pe_samples = int(2 * pe_sample_radius + 1) num_fe_samples = int(2 * fe_sample_radius + 1) S = np.empty([num_pe_samples, num_fe_samples], dtype=complex) for line_no in range(num_pe_samples): S[line_no, :] = mrs[line_no] img, x, y = reconstruct_from_2DFT(S, kx_max, ky_max) np.savetxt('em-positions_' + fig_params + '.csv', em_positions, delimiter=',') np.savetxt('img_' + fig_params + '.csv', img, delimiter=',') np.savetxt('x_' + fig_params + '.csv', x, delimiter=',') np.savetxt('y_' + fig_params + '.csv', y, delimiter=',') if plot_sim_results: em_positions = np.loadtxt('em-positions_' + fig_params + '.csv', delimiter=',') if em_positions.ndim == 1: em_positions = np.array([em_positions]) img = np.loadtxt('img_' + fig_params + '.csv', delimiter=',') x = np.loadtxt('x_' + fig_params + '.csv', delimiter=',') y = np.loadtxt('y_' + fig_params + '.csv', delimiter=',') x = x * 1e2
import numpy as np import matplotlib.pyplot as plt import pandas as pd from pyreconstruct import reconstruct_from_2DFT S_real = pd.read_csv('S_real.csv', sep=',', header=None).values S_imag = pd.read_csv('S_imag.csv', sep=',', header=None).values S = S_real + 1j * S_imag img = np.abs(reconstruct_from_2DFT(S)) plt.figure() plt.imshow(img) plt.colorbar() plt.savefig('reconstruction.pdf')