diff --git a/.DS_Store b/.DS_Store
index bc975d8d2b78991fad68a23c0ac2ab94d094180f..d6e37f5c6de2c7fc3b8f1c47f7e5b3a22889276e 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/FeatureEstimation.py b/FeatureEstimation.py
index 3a97aa3aea0088e9faf13fffc9f5f5d018035c4e..a2ec10cdb2c948bad50da4914684ec360097b69c 100644
--- a/FeatureEstimation.py
+++ b/FeatureEstimation.py
@@ -35,6 +35,7 @@ the different parts easier (Default shortcut: Ctrl + Shift + O)
 
 
 # Set working directory
+import numpy as np
 import os
 wkdir = "/home/s200431"
 os.chdir(wkdir)
diff --git a/PCA.py b/PCA.py
new file mode 100644
index 0000000000000000000000000000000000000000..48dabfbec94569d68ec132d8c4969bd776e1d09d
--- /dev/null
+++ b/PCA.py
@@ -0,0 +1,53 @@
+from sklearn import decomposition
+from sklearn.preprocessing import StandardScaler
+
+import matplotlib.pyplot as plt
+from mpl_toolkits.mplot3d import Axes3D
+import numpy as np
+
+
+def PCA(X, y, n_components):
+    fig = plt.figure(1, figsize=(4, 3))
+    plt.clf()
+
+    ax = fig.add_subplot(111, projection="3d", elev=48, azim=134)
+    ax.set_position([0, 0, 0.95, 1])
+
+    # Standardize the data
+    scaler = StandardScaler()
+    X = scaler.fit_transform(X)
+
+    pca = decomposition.PCA(n_components=n_components)
+    pca.fit(X)
+    X = pca.transform(X)
+
+    for name, label in [("CTRL", 0), ("PTSD", 1)]:
+        ax.text3D(
+            X[y == label, 0].mean(),
+            X[y == label, 1].mean(),
+            X[y == label, 2].mean(),
+            name,
+            horizontalalignment="center",
+            bbox=dict(alpha=0.5, edgecolor="w", facecolor="w"),
+        )
+
+    ax.scatter(
+        X[:, 0],
+        X[:, 1],
+        X[:, 2],
+        c=y,
+        cmap=plt.cm.nipy_spectral,
+        edgecolor="k",
+    )
+
+    ax.xaxis.set_ticklabels([])
+    ax.yaxis.set_ticklabels([])
+    ax.zaxis.set_ticklabels([])
+
+    plt.show()
+
+    # Save plot 
+    Feature_savepath = "./Figures/"
+    plt.savefig(Feature_savepath + "PCA_3D.png", dpi=300)
+
+    return "PCA was complete without errors - check the plot in your chosen path"