-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathColorMap.py
More file actions
61 lines (51 loc) · 1.42 KB
/
ColorMap.py
File metadata and controls
61 lines (51 loc) · 1.42 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 6 17:45:48 2019
@author: s1620023
"""
import numpy as np
import pandas as pd
import glob
import matplotlib.pyplot as pl
import re
#numbers = re.compile(r'(-?\d+)')
#def numericalSort(value):
# parts = numbers.split(value)
# parts[1::2] = map(int, parts[1::2])
# return parts
#numbers = re.compile(r'-?\d+')
def NumericalSort (values):
parts = re.findall(r'-?\d+\.\d+', values)
parts[0] = float(parts[0])
return parts
path = '/home/s1620023/ownCloud/PythonScript(ForTutorial)/DampedSineData/'
#files = glob.glob(path + r"/*Hz.csv")
files = sorted(glob.glob(path + r"/*Hz.csv"), key=NumericalSort)
ilist = []
fdlist = []
for f in files:
Data = pd.read_csv(f)
number = re.findall('-?\d+\.\d+',f)
fd = float(number[0])
i = np.array(Data['A'])
ilist.append(i)
fdlist.append(fd)
I = np.vstack(ilist)
t = np.array(Data['t'])
Fd = fdlist
Fd = sorted(Fd)
Y, X = np.meshgrid(t, Fd)
pl.tick_params (length = 6.0)
pl.rc('text', usetex=True)
pl.rc('font', family = 'serif', size = 20)
pl.tick_params(labelsize = 20)
pl.xticks(fontsize = 20)
pl.yticks(fontsize = 20)
pl.xlabel(r'$f_d$ (Hz)', fontsize=20) #, fontname = 'Arial')
pl.ylabel(r'$t$ (s)', fontsize = 20)
pl.pcolormesh(X, Y, I)
pl.colorbar(label = r'A (norm.)')
pl.savefig(path + r"Chevron", dpi = 200, format = 'png', bbox_inches = 'tight', frameon = False)
pl.show()
#print(files)