forked from anna-lk-haley/Swirling_strength
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake_PSD.py
More file actions
executable file
·44 lines (37 loc) · 1.44 KB
/
make_PSD.py
File metadata and controls
executable file
·44 lines (37 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import sys
import os
from pathlib import Path
os.environ['MPLCONFIGDIR'] = '/scratch/s/steinman/ahaleyyy/.config/mpl'
import matplotlib.pyplot as plt
from scipy.spatial import cKDTree as KDTree
import pyvista as pv
from bsl.dataset import Dataset
import numpy as np
size = 12
plt.rc('font', size=size) #controls default text size
plt.rc('axes', titlesize=10) #fontsize of the title
plt.rc('axes', labelsize=10) #fontsize of the x and y labels
plt.rc('xtick', labelsize=10) #fontsize of the x tick labels
plt.rc('ytick', labelsize=10) #fontsize of the y tick labels
plt.rc('legend', fontsize=10) #fontsize of the legend
if __name__ == "__main__":
case_name = sys.argv[1] #eg. PTSeg028_low
PSD_data_file = sys.argv[2]
PSD_img_out_folder = sys.argv[3] #eg spec_imgs
#do entire one first
entire_out_file = Path(PSD_data_file)
if entire_out_file.exists():
fig_data = np.load(PSD_data_file)
SS_bins = fig_data['SS_bins']
time_bins = fig_data['t_bins']
n_points = fig_data['n_points']
# Plotting
fig, ax = plt.subplots(1,1, figsize=(6,4.5))
ax.loglog(SS_bins[:-1],n_points[int(time_bins.size*0.35),:]) #1/3 of the way through the plot
ax.set_xlabel('Swirling Strength (Hz)')
ax.set_ylabel('# points')
#ax.set_xticks([0,100,200,300])
title = case_name + '_PSD'
#ax.set_title(title)
#plt.tight_layout
plt.savefig(PSD_img_out_folder +'/'+ title + '.png')#, transparent=True)