Commit 7bee5121 authored by Nico Vermaas's avatar Nico Vermaas

adding 'time used' pie chart presentation based on new ATDB query

parent f046e0b4
......@@ -408,22 +408,20 @@ def do_time_used_plot(title, subtitle, data):
"""
total_minutes = data['total_minutes']
science_minutes = data['science_minutes']
aborted_minutes = data['aborted_minutes']
system_minutes = data['system_minutes']
time_on_sky = data['time-on-sky-overview']['was_archived']
imaging_minutes = time_on_sky['imaging_minutes']
arts_minutes = time_on_sky['arts_minutes']
system_minutes = time_on_sky['system_minutes']
imaging_fraction = int(imaging_minutes / total_minutes * 100)
arts_fraction = int(arts_minutes / total_minutes * 100)
science_fraction = int(science_minutes / total_minutes * 100)
aborted_fraction = int(aborted_minutes / total_minutes * 100)
system_fraction = int(system_minutes / total_minutes * 100)
idle_fraction = 100 - (imaging_fraction + arts_fraction + system_fraction)
idle_fraction = 100 - (science_fraction + aborted_fraction + system_fraction)
# Pie chart, where the slices will be ordered and plotted counter-clockwise:
fig = plt.figure(figsize=(12, 6))
labels = 'Imaging (archived)', 'ARTS (archived)', 'other', 'system'
sizes = [imaging_fraction, arts_fraction, idle_fraction, system_fraction]
labels = 'Science', 'System', 'aborted', 'idle'
sizes = [science_fraction, system_fraction, aborted_fraction, idle_fraction]
explode = (0.1, 0.1, 0, 0) # only "explode" the 2nd slice (i.e. 'Hogs')
#fig1, ax1 = plt.subplots()
......@@ -435,4 +433,114 @@ def do_time_used_plot(title, subtitle, data):
plt.grid(True,alpha=0.3)
plt.legend(loc='upper right')
plt.show()
def do_time_used_system_pie_plot(title, subtitle, data):
"""
:param title: Title of Plot
:param x: dict with data for x-axis (time)
:param y: dict with data for y_axix (usage)
:return:
"""
total_minutes = data['total_minutes']
science_minutes = data['science_minutes']
aborted_minutes = data['aborted_minutes']
system_minutes = data['system_minutes']
science_fraction = int(science_minutes / total_minutes * 100)
aborted_fraction = int(aborted_minutes / total_minutes * 100)
system_fraction = int(system_minutes / total_minutes * 100)
idle_fraction = 100 - (science_fraction + aborted_fraction + system_fraction)
# Pie chart, where the slices will be ordered and plotted counter-clockwise:
fig = plt.figure(figsize=(12, 6))
labels = 'System', 'Science', 'aborted', 'idle'
colors = ['lightblue','green','red','lightgrey']
sizes = [system_fraction, science_fraction, aborted_fraction, idle_fraction]
explode = (0.0, 0.1, 0.1, 0) # only "explode" the 2nd slice (i.e. 'Hogs')
#fig1, ax1 = plt.subplots()
plt.pie(sizes, explode=explode, labels=labels, colors = colors, autopct='%1.1f%%',
shadow=True, startangle=90)
plt.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle.
plt.title(title)
plt.grid(True,alpha=0.3)
plt.legend(loc='upper right')
plt.show()
def do_time_used_science_pie_plot(title, subtitle, data):
"""
:param title: Title of Plot
:param x: dict with data for x-axis (time)
:param y: dict with data for y_axix (usage)
:return:
"""
total_minutes = data['total_minutes']
imaging_data = data['imaging']
imaging_survey_minutes = imaging_data['survey_minutes']
imaging_drift_minutes = imaging_data['drift_minutes']
imaging_filler_minutes = imaging_data['filler_minutes']
imaging_argo_minutes = imaging_data['argo_minutes']
# sum... note that time is counted double, because everything is 'survey'
total_image_data_minutes = imaging_survey_minutes + imaging_drift_minutes + imaging_filler_minutes + imaging_argo_minutes
arts_data = data['arts']
arts_sc1_minutes = arts_data['sc1_minutes']
arts_sc1_drift_minutes = arts_data['sc1_drift_minutes']
arts_sc1_filler_minutes = arts_data['sc1_filler_minutes']
arts_sc4_minutes = arts_data['sc4_minutes']
arts_sc4_drift_minutes = arts_data['sc4_drift_minutes']
arts_sc4_filler_minutes = arts_data['sc4_filler_minutes']
total_arts_sc1_minutes = arts_sc1_minutes + arts_sc1_drift_minutes + arts_sc1_filler_minutes
total_arts_sc4_minutes = arts_sc4_minutes + arts_sc4_drift_minutes + arts_sc4_filler_minutes
# sum
total_arts_data_minutes = total_arts_sc1_minutes + total_arts_sc4_minutes
#science_fraction = int(science_minutes / total_minutes * 100)
#aborted_fraction = int(aborted_minutes / total_minutes * 100)
#system_fraction = int(system_minutes / total_minutes * 100)
#idle_fraction = 100 - (science_fraction + aborted_fraction + system_fraction)
# Pie chart, where the slices will be ordered and plotted counter-clockwise:
fig = plt.figure(figsize=(12, 6))
outer_sizes = [total_image_data_minutes, total_arts_data_minutes]
outer_labels = ['Imaging','ARTS']
outer_colors = ['cornflowerblue', '#C8885E'
]
inner_sizes = [imaging_survey_minutes, imaging_drift_minutes, imaging_filler_minutes, imaging_argo_minutes,
arts_sc1_minutes, arts_sc1_drift_minutes,arts_sc1_filler_minutes,
arts_sc4_minutes, arts_sc4_drift_minutes, arts_sc4_filler_minutes,
]
inner_labels = ['survey', 'drift', 'filler', 'ARGO',
'SC1','drift','filler',
'SC4','drift','filler']
inner_colors = ['#1A44CF','#1A75CA','#1AAED1','#1ACAB9',
'#D3841A','#D5BB1A','#B5D31A',
'#7FD31A','#1AD31C','#1ACA84']
size = 0.4
#fig1, ax1 = plt.subplots()
plt.pie(outer_sizes, radius=1, startangle=90, labels=outer_labels, colors = outer_colors, autopct='%1.1f%%',
wedgeprops=dict(width=size, edgecolor='w'))
plt.pie(inner_sizes, radius=1-size, startangle=90, labels=inner_labels, colors = inner_colors, autopct='%1.1f%%',
wedgeprops=dict(width=size, edgecolor='w'))
plt.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle.
plt.title(title)
plt.grid(True,alpha=0.3)
plt.legend(loc='upper right')
plt.show()
\ No newline at end of file
......@@ -398,7 +398,13 @@ def do_time_used(args):
"ERROR: " + str(response.status_code) + ", " + str(response.reason) + ', ' + str(response.content)))
# plot the results
atdb_plot.do_time_used_plot(args.title, args.y_axis_title,time_used_data)
#atdb_plot.do_time_used_plot(args.title, args.y_axis_title,time_used_data)
report_type = time_used_data['report_type']
if 'system_pie' in report_type:
atdb_plot.do_time_used_system_pie_plot(args.title, args.y_axis_title,time_used_data)
elif 'science_pi' in report_type:
atdb_plot.do_time_used_science_pie_plot(args.title, args.y_axis_title, time_used_data)
......
--presentation=speeds
--atdb_host=http://192.168.22.22/atdb
--title=I/O speeds on wcudata1 from ATDB
--subtitle=1 - 8 jun 2019
--subtitle=18 - 23 july 2019
--y_axis_title=I/O Speed in Gbps
--query=taskID__contains=190607
--query=taskID__gte=190610000&taskID__lte=190613000
--query=starttime__gt=2019-06-01T00:00:00Z&starttime__lt=2019-06-08T00:00:00Z
--query=taskID__gte=190718000&taskID__lte=190723000
--query=starttime__gt=2019-07-18T00:00:00Z&starttime__lt=2019-07-23T00:00:00Z
--plot_engine=mathplotlib
--presentation=time_used
--atdb_host=http://192.168.22.22/atdb
--title=APERTIF Science Pie - July 2019
--subtitle=July 2019
--query=from=2019-07-01T00:00:00Z&to=2019-07-30T00:00:00Z&report_type=time_used_science_pie
\ No newline at end of file
--presentation=time_used
--atdb_host=http://localhost:8000/atdb
--title=APERTIF System Pi - November 2018
--subtitle=November 2018
--query=from=2018-11-01&to=2018-11-30&report_type=system_pie
\ No newline at end of file
--presentation=time_used
--atdb_host=http://192.168.22.22/atdb
--title=APERTIF On Sky - July 2019
--title=APERTIF Science Pie - July 2019
--subtitle=July 2019
--query=from=2019-07-01&to=2019-07-30
\ No newline at end of file
--query=from=2019-07-01T00:00:00Z&to=2019-07-30T00:00:00Z&report_type=time_used_system_pie
\ No newline at end of file
--presentation=times
--atdb_host=http://atdb.astron.nl/atdb
--title=I/O speeds from ATDB
--subtitle=12 to 15 july 2019
--subtitle=18 - 23 july 2019
--y_axis_title=I/O Speed in Gbps
--query=taskID__contains=190608
--query=starttime__gt=2019-07-12T00:00:00Z&starttime__lt=2019-07-15T00:00:00Z
--query=starttime__gt=2019-07-18T00:00:00Z&starttime__lt=2019-07-23T00:00:00Z
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment