Commits

Joe Kington committed 2c07b05

Made sure build_eigenpaws.py writes new files relative to its directory and not the current directory.

Comments (0)

Files changed (1)

build_eigenpaws.py

 THE SOFTWARE.
 """
 
-
 import numpy as np
+import os
 
 import data
 import analysis
 
     #-- Save the key data that we need to do this same classification
     # on any given paw....
-    np.save('average_paw.npy', average_paw)
-    np.save('basis_stds.npy', basis_stds)
-    np.save('basis_vecs.npy', basis_vecs)
-    np.save('template_paws.npy', template_paws)
+    dir = os.path.dirname(__file__)
+    save = lambda filename, data: np.save(os.path.join(dir, filename), data)
+    save('average_paw.npy', average_paw)
+    save('basis_stds.npy', basis_stds)
+    save('basis_vecs.npy', basis_vecs)
+    save('template_paws.npy', template_paws)
 
     #- Optionally, we can save the raw training data for later analysis...
     np.save('training_paw_data.npy', paw_data)