Files
Misc-Downhole-Diagnostics/upstrokeDownstroke.py
Patrick McDonagh a1714c722f Initial Commit
2016-07-01 16:43:39 -05:00

36 lines
744 B
Python

import readCardFile as rcf
import matplotlib.pyplot as plt
downhole = rcf.readFile()[1]
upstroke = []
downstroke = []
mUp = False
for i in range (2,len(downhole)-1):
if downhole[i][0] > downhole[i-1][0]:
upstroke.append(downhole[i])
mUp = True
elif downhole[i][0] < downhole[i-1][0]:
downstroke.append(downhole[i])
mUp = False
else:
if mUp:
upstroke.append(downhole[i])
else:
downstroke.append(downhole[i])
p,l = zip(*downhole)
uP, uL = zip(*upstroke)
dP,dL = zip(*downstroke)
fig = plt.figure(figsize=(12, 9))
fig.canvas.set_window_title('Downhole Card Analysis')
plt.plot(p,l,'g')
plt.plot(uP, uL, 'b')
plt.plot(dP, dL, 'r')
plt.grid(True)
plt.show()