import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
# Read from binary stream filed produced by dipelm
with open('test/co2/photo_MFPAD_ion_state_1_neutral_state_1', 'rb') as f:
state_indices = np.fromfile(f, dtype=np.int64, count=2)
no_energies = np.fromfile(f, dtype=np.int64, count=1)
photon_energies = np.fromfile(f, dtype=np.float64, count=no_energies[0])
no_theta = np.fromfile(f, dtype=np.int64, count=1)
theta_grid = np.fromfile(f, dtype=np.float64, count=no_theta[0])
no_phi = np.fromfile(f, dtype=np.int64, count=1)
phi_grid = np.fromfile(f, dtype=np.float64, count=no_phi[0])
mfpad_dims = np.fromfile(f, dtype=np.int64, count=3)
no_angles = mfpad_dims[0]
no_components = mfpad_dims[1]
no_energies = mfpad_dims[2]
mfpad_1D = np.fromfile(f, dtype=np.float64, count=no_angles*no_components*no_energies)
# Reshape fortran style multi-D array.
mfpad = mfpad_1D.reshape(no_angles,no_components,no_energies, order='F');
D = mfpad[0:no_theta[0],1,:]
E, theta = np.meshgrid(photon_energies*27.211,theta_grid);
plt.contourf(E, theta, D, levels=np.linspace(0,0.3,50))
plt.xlim(20,50)
plt.show
# Read from binary stream file produced by dipelm
with open('test/co2/photo_LFPAD_ion_state_1_neutral_state_1', 'rb') as f:
state_indices = np.fromfile(f, dtype=np.int64, count=2)
no_energies = np.fromfile(f, dtype=np.int64, count=1)
photon_energies = np.fromfile(f, dtype=np.float64, count=no_energies[0])
no_alpha = np.fromfile(f, dtype=np.int64, count=1)
alpha_grid = np.fromfile(f, dtype=np.float64, count=no_alpha[0])
no_beta = np.fromfile(f, dtype=np.int64, count=1)
beta_grid = np.fromfile(f, dtype=np.float64, count=no_beta[0])
no_gamma = np.fromfile(f, dtype=np.int64, count=1)
gamma_grid = np.fromfile(f, dtype=np.float64, count=no_gamma[0])
no_theta = np.fromfile(f, dtype=np.int64, count=1)
theta_grid = np.fromfile(f, dtype=np.float64, count=no_theta[0])
no_phi = np.fromfile(f, dtype=np.int64, count=1)
phi_grid = np.fromfile(f, dtype=np.float64, count=no_phi[0])
lfpad_dims = np.fromfile(f, dtype=np.int64, count=4)
no_euler = lfpad_dims[0]
no_theta_phi = lfpad_dims[1]
no_components = lfpad_dims[2]
no_energies = lfpad_dims[3]
lfpad_1D = np.fromfile(f, dtype=np.float64, count=no_euler*no_theta_phi*no_components*no_energies)
# Reshape fortran style multi-D array.
lfpad = lfpad_1D.reshape(no_euler,no_theta_phi, no_components,no_energies, order='F');
D = lfpad[0, 0:no_theta[0],1,:]
E, theta = np.meshgrid(photon_energies*27.211,theta_grid);
plt.contourf(E, theta, D, levels=np.linspace(0,0.3,50))
plt.xlim(20,50)
plt.show