exclude directory using find

find -name "*.js" -not -path "./directory/*"

#example
find . -name "*.py" -not -path "./anaconda2/*"


# copy the files find to a directory
find -name "*.js" -not -path "./directory/*" -exec cp {} temp/ \;

find . -name "*.py" -not -path "./anaconda2/*" -exec cp {} pycoll/ \; 

 

numpy flatten() and ravel()

import numpy as np
y = np.array(((1,2,3),(4,5,6),(7,8,9)))

print(y.flatten())
[1   2   3   4   5   6   7   8   9]

print(y.ravel())
[1   2   3   4   5   6   7   8   9]

The difference is that flatten always returns a copy and ravel returns a view of the original array whenever possible. This isn’t visible in the printed output, but if you modify the array returned by ravel, it may modify the entries in the original array. If you modify the entries in an array returned from flatten this will never happen. ravel will often be faster since no memory is copied, but you have to be more careful about modifying the array it returns.