Hi, As far as I know variables produced with CCTBX in python that come out as flex arrays can be converted to numpy with a function, as_numpy_array(), that is a member of flex_array variables. I am wondering if there are methods for doing the reverse in CCTBX. Probably not difficult to write a python loop for a specific case. But more generally? Many thanks, Rob
Hi Rob, generally you just construct the one you want from the np array, with automatic type casting within reason as shown here:
from dials.array_family import flex import numpy as np arr1 = np.array((1,2,3,4)) flex.double(arr1)
list(flex.double(arr1)) [1.0, 2.0, 3.0, 4.0]
Does this help or were you looking for something different?
Best,
Dan
On Mon, Mar 30, 2026 at 5:31 AM
Hi, As far as I know variables produced with CCTBX in python that come out as flex arrays can be converted to numpy with a function, as_numpy_array(), that is a member of flex_array variables. I am wondering if there are methods for doing the reverse in CCTBX. Probably not difficult to write a python loop for a specific case. But more generally?
Many thanks,
Rob _______________________________________________ cctbxbb mailing list -- [email protected] To unsubscribe send an email to [email protected]
participants (2)
-
Daniel Paley -
robert@oeffner.net