I have the following problem, I am trying to plot and calculate area und Threshold for a set of Data. The Data comprises Timestamps on the X Axis and Measurements of arterial blood pressure on the y axis. Our research is interested in measuring the Area under the curve total, and the area under curve under a certain Threshold (namely 65), and Area under Threshold. Area under the curve could be measured easily in other software (Matlab or Prism or Trapz from Numpy). The problem is calculating the later 2 : Area under Threshold (the shaded area in the picture below), and area under curve under certain threshold.
This is the area under Threshold that we need to calculate
I used Fill between method to shade the area wanted, but have no idea how would i go about calculating the area. Could you please help me.
here is the simple code we used to plot:
data = pd.read_excel("Min 02-01.xlsx")
map = data["ART (MEAN) (0.9765625 Hz)"]
timestamp = data["Timestamp"]
plt.plot_date(timestamp, map, marker='', linestyle='solid')
plt.gcf().autofmt_xdate()
plt.fill_between(timestamp, map, 65, where=(map <= 65), interpolate=True, color='red')
plt.legend()
plt.title('MAP VS Time')
plt.xlabel('Time')
plt.ylabel('MAP (mmHg)')
plt.tight_layout()
plt.show()
I am open to solutions using other software or other programming languages