Skip to content
Snippets Groups Projects
Commit 24a0c493 authored by Julian Linke's avatar Julian Linke
Browse files

no .eps and argument ERROR

parent 3ae7fe6b
Branches
No related tags found
No related merge requests found
......@@ -35,7 +35,7 @@ def main(X_path, y_path, pcaA_path, pcab_path, out_path, json_path):
A = np.load(pcaA_path)
b = np.load(pcab_path)
print('\nspkIDs:\n{}'.format(spks))
print('\ninput matrix:\n{}'.format(X))
print('\ninput matrix X:\n{}'.format(X))
labels = list(spks)
fig, ax = plt.subplots(figsize=(15,15))
......@@ -45,7 +45,7 @@ def main(X_path, y_path, pcaA_path, pcab_path, out_path, json_path):
plt.yticks(range(len(labels)), labels);
fig.colorbar(cax, ticks=[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, .8, .9, 1])
fig_path = os.path.join(out_path,'{}.png'.format(X_path.split('/')[-1].replace('.npy','')))
print('\nsave fig {}'.format(fig_path))
print('\nsave similarity matrix to {}'.format(fig_path))
plt.savefig(fig_path)
colordict = {}
......@@ -56,7 +56,6 @@ def main(X_path, y_path, pcaA_path, pcab_path, out_path, json_path):
spks_tmp = corpora[corpus]
for spk in spks_tmp:
colordict[corpus].append(colors[idx])
print(colordict)
col = sum([lst for lst in colordict.values()], [])
print("\nProject with PCA (3 dimensions) ...")
......@@ -82,14 +81,12 @@ def main(X_path, y_path, pcaA_path, pcab_path, out_path, json_path):
ax.legend(loc='center left', bbox_to_anchor=(1.175, .5))
# Save the plot
fig_path = os.path.join(out_path,'scatter3D_{}.png'.format(X_path.split('/')[-1].replace('.npy','')))
print('\nsave fig {}'.format(fig_path))
print('\nsave 3D scatter plot {}'.format(fig_path))
plt.savefig(fig_path)
fig_path = os.path.join(out_path,'scatter3D_{}.eps'.format(X_path.split('/')[-1].replace('.npy','')))
print('save fig {}'.format(fig_path))
plt.savefig(fig_path, format='eps')
plt.rcParams.update({'font.size': 50})
for proj in [(0, 1), (0, 2), (1, 2)]:
print(f"\nProject on dimensions {proj}")
x, y = X_proj[:,proj[0]], X_proj[:,proj[1]]
fig, ax = plt.subplots(figsize=(18,16))
......@@ -109,11 +106,8 @@ def main(X_path, y_path, pcaA_path, pcab_path, out_path, json_path):
plt.grid()
plt.tight_layout()
fig_path = os.path.join(out_path,'scatter_proj{}_{}.png'.format(''.join([str(proj[0]),str(proj[1])]), X_path.split('/')[-1].replace('.npy','')))
print('\nsave fig {}'.format(fig_path))
print('save 2D scatter plot {}'.format(fig_path))
plt.savefig(fig_path)
fig_path = os.path.join(out_path,'scatter_proj{}_{}.eps'.format(''.join([str(proj[0]),str(proj[1])]), X_path.split('/')[-1].replace('.npy','')))
print('save fig {}'.format(fig_path))
plt.savefig(fig_path, format='eps')
if __name__ == "__main__":
############################# FEATURES PATH ###########################
......
......@@ -8,8 +8,8 @@ set -e -o pipefail
. path.sh
. conda.sh
if [[ $# -eq 0 ]] ; then
echo 'ERROR: this run-script requires an argument: stage=?'
if [[ $# -eq 1 ]] ; then
echo 'ERROR: this run-script requires two arguments: DATA=? stage=?'
exit 1
fi
......@@ -82,7 +82,7 @@ if [ $stage == 4 ] || [ $stage == 0 ]; then
$exp_dir/numpy/similarity_matrix.npy \
--output $exp_dir/numpy/pca \
--dim 3
printf "\n... PLOT ...\n"
printf "\n... PLOT similarity in PCA space (Analysis) ...\n"
python3 local/plot_pca_similarities.py \
$exp_dir/numpy/similarity_matrix.npy \
$exp_dir/numpy/splits_labels.npy \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment