===== Using EMAN2 with NumPy ===== NymPy interoperability is well supported, and with EMAN3 modules, JAX as well. Note that converting an EMData object to a NumPy array produces an object which shares the memory of the EMData array, but when converting NumPy to EMAN2 a copy is made : from EMAN2 import * import numpy as np emd=test_image() # an EMData object npd=to_numpy(emd) npd*=2 # This will modify the values in BOTH the EMData object and the NumPy object! print(emd["mean"],npd.mean()) npd2=np.zeros((128,128)) emd2=from_numpy(npd2) # data is copied to make a new EMData object npd2+=1 # Modifies the NumPy array, NOT the EMData object print(emd2["mean"],npd2.mean())