Commit bcd8b1ea authored by sarrvesh's avatar sarrvesh

implement pipeline processing time

parent 88f1322d
......@@ -102,6 +102,34 @@ def calculate_proc_size(obs_t, int_time, n_baselines, n_chan, n_sb, pipe_type,
tot_size = tot_size/3.
return '{:0.2f}'.format(tot_size)
def calculate_pipe_time(obs_t, n_sb, array_mode, ateam_names, pipe_type):
"""Compute the pipeline processing time.
Inputs:
obs_t - Observation time in hours
n_sb - Number of subbands
ateam_names - List of A-team sources to demix
pipe_type - Name of the pipeline
Returns pipeline processing time in hours"""
proc_time = 0
# Figure out the number of ateam sources specified
if ateam_names is None:
n_ateams = 0
else:
n_ateams = len(ateam_names)
# Hard-coded P/O factors for 1 SB. Empirically determined.
hba_factor = {0:0.002, 1:0.0025, 2:0.005}
lba_factor = {0:0.004, 1:0.004, 2:0.014}
if pipe_type == 'preprocessing':
if 'hba' in array_mode:
proc_time = hba_factor[n_ateams] * n_sb * obs_t
else:
proc_time = lba_factor[n_ateams] * n_sb * obs_t
# Convert to hours
proc_time /= 3600.
return proc_time
def validate_inputs(obs_t, n_core, n_remote, n_int, n_sb, integ_t, t_avg,
f_avg, src_name, coord, hba_mode, pipe_type, ateam_names):
"""Valid text input supplied by the user: observation time, number of
......@@ -166,7 +194,7 @@ def validate_inputs(obs_t, n_core, n_remote, n_int, n_sb, integ_t, t_avg,
msg += 'Invalid frequency averaging factor specified.'
# Validate the number of A-team sources if a pipeline is specified
# Figure out the number of ateam sources specified
if ateam_names == None:
if ateam_names is None:
n_ateams = 0
else:
n_ateams = len(ateam_names)
......
......@@ -191,7 +191,7 @@ def on_resolve_click(n, close_msg_box, target_name, is_open):
State('elevation-plot', 'figure'),
State('distance-table', 'figure'),
State('dateRow', 'date')
]
)
......@@ -319,7 +319,13 @@ def on_calculate_click(n, n_clicks, obs_t, n_core, n_remote, n_int, n_chan, n_sb
n_baselines, int(n_chan), int(n_sb),
pipe_type, int(t_avg), int(f_avg),
dy_compress)
# TODO Calculate the processing time
if pipe_type == 'none':
# No pipeline
pipe_time = None
else:
pipe_time = bk.calculate_pipe_time(float(obs_t), int(n_sb),
hba_mode, ateam_names,
pipe_type)
# It is useful to have coord as a list from now on
if coord is not '':
......@@ -399,11 +405,11 @@ def on_calculate_click(n, n_clicks, obs_t, n_core, n_remote, n_int, n_chan, n_sb
'layout':{'title':table_title, 'autosize':True}
}
return im_noise, raw_size, avg_size, 0, '', \
return im_noise, raw_size, avg_size, pipe_time, '', \
False, display_fig, elevation_fig, display_fig, beam_fig, \
display_tab, distance_tab
if __name__ == '__main__':
app.run_server(debug=True, host='0.0.0.0', port=8051)
#app.run_server(debug=False, host='0.0.0.0', port=8051, \
# dev_tools_ui=False, dev_tools_props_check=False)
#app.run_server(debug=True, host='0.0.0.0', port=8051)
app.run_server(debug=False, host='0.0.0.0', port=8051, \
dev_tools_ui=False, dev_tools_props_check=False)
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