Closed brendanjmeade closed 2 years ago
I don't think you need to worry about this. The copy should be quite cheap!
I'm guessing this is because you transpose an array after creating it. Internally, numpy uses C-ordered (row-major) arrays by default. But, when you transpose an array, instead of copying the array, it actually just flips the ordering flag so that the array is instead treated as Fortran-ordered (column major). That way transposing an array is essentially free! But, the internals of cutde require C-ordered arrays, so if cutde receives a Fortran-ordered array, it will copy the array and convert it to C-ordered.
A common thing that causes this warning would be code like:
#given three arrays X, Y, Z that are each (N,) shaped arrays
obs_pts1 = np.array([X, Y, Z]) #obs_pts1 will be shaped (3, N)
obs_pts2 = obs_pts1.T # now obs_pts2 is shaped like (N, 3) like cutde expects but because of the transpose, it is fortran ordered
# call cutde with obs_pts
If you send me a link to where in the code this is happening, I can take a quick look.
The link here explains how to temporarily turn off warnings if you want to just tell cutde to shut up: https://stackoverflow.com/questions/14463277/how-to-disable-python-warnings
import warnings
with warnings.catch_warnings():
warnings.simplefilter("ignore")
# call cutde
Thanks @tbenthompson! I just did the warning thing and that works well enough for me!
When running CUTDE I the following warning a lot:
"/Users/meade/opt/anaconda3/envs/celeri/lib/python3.9/site-packages/cutde/coordinators.py:77: UserWarning: The obs_pts input array has Fortran ordering. Converting to C ordering. This may be expensive.\n
Do you think this is fixable at my end, or should I just learn to live with it? Thoughts appreciated?