pca and projection code