-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rotational_Coordinates_to_Linear_Coordinates.py
53 lines (44 loc) · 1.61 KB
/
Rotational_Coordinates_to_Linear_Coordinates.py
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
#!/usr/bin/python
from __future__ import division
import numpy as np
from itertools import count, tee, islice
import math
fOut = open("result.txt", "w")
x = raw_input("Enter your file name: ")
file = open(x,"r")
tmin = float(2) #time of min temp
tmax = float(14) #time od max temp
Tmin = 5 #min temp at tmin
Tmax = 20 #max temp at tmax
data = []
for line in file:
count = 0
line = line.split("\t")
line1 = float(line[0]) # Tmin
line2 = float(line[1]) # Tmax
# print (line1), line2
# data.append(line)
# print data
for num in range(0,24):
if num < tmin:
f1 = (math.cos(math.pi*(tmin-num)/(24+tmin-tmax))+1)/2
f2 = 1 - f1
T = (f1 * (line1)) + (f2 * (line2))
fOut.write(str(num) +"\t" + str(T) + "\n")
elif tmin <= num <= tmax:
f1 = (math.cos(math.pi*(num-tmin)/(tmax-tmin))+1)/2
f2 = 1 - f1
T = (f1 * line1) + (f2 * line2)
fOut.write(str(num)+"\t" + str(T) + "\n")
elif tmax < num:
f1 = (math.cos(math.pi*(24+tmin-num)/(24+tmin-tmax))+1)/2
f2 = 1 - f1
T = (f1 * line1) + (f2 * line2)
fOut.write(str(num) +"\t" + str(T) + "\n")
#window_avg = [ np.mean(data[i:i+window_size]) for i in range(0, len(data), stride)
# if i+window_size <= len(data) ]
#x = window_avg
#for ele in x:
# ele = str(ele)
# fOut.write(ele + "\n")
fOut.close()