Unverified Commit d5d3b409 authored by scisup's avatar scisup Committed by GitHub

Merge branch 'master' into AddCalibrator

parents 3ea85391 632e1616
......@@ -64,6 +64,7 @@ def calculate_raw_size(obs_t, cal_t, n_cal, int_time, n_baselines, n_chan, n_sb,
"""Compute the datasize of a raw LOFAR measurement set given the
length of the observation, correlator integration time, number
of baselines, number of channels per subband, and number of subbands"""
# TODO: The below equation needs to be fixed (scale n_baselines).
n_rows = int(n_baselines * ( (obs_t*n_beams + cal_t*n_cal ) / int_time)) - n_baselines
# A single row in LofarStMan format contains
# - 32-bit sequence number (4 bytes)
......@@ -73,6 +74,16 @@ def calculate_raw_size(obs_t, cal_t, n_cal, int_time, n_baselines, n_chan, n_sb,
tot_size = sb_size * n_sb
return '{:0.2f}'.format(tot_size)
def calculate_bf_size(n_sub, n_chan, n_pol, n_value, t_samp, obs_time):
"""Calculate the datasize of a raw LOFAR beamformed dataset.
Based on equation from Cees Bassa available on confluence at
https://support.astron.nl/confluence/display/C2/Data+Rates
For now, we always assume 32 bits and no downsampling factor"""
n_bit = 32
size_Gbs = n_sub * n_chan * n_pol * n_value * n_bit / (n_chan * t_samp * 1E-6)
size_GB = size_Gbs * obs_time / 8.
return size_GB
def calculate_proc_size(obs_t, cal_t, n_cal, int_time, n_baselines, n_chan, n_sb, n_beams, pipe_type,
t_avg, f_avg, dy_compress):
"""Compute the datasize of averaged LOFAR measurement set given the
......
......@@ -51,7 +51,10 @@ app.title = 'LUCI - LOFAR Unified Calculator for Imaging'
Output('nRingsRowL', 'style'),
Output('pipeTypeRow', 'options'),
Output('pipeTypeRow', 'value')
Output('pipeTypeRow', 'value'),
Output('imNoiseRowL', 'style'),
Output('imNoiseRow', 'style')
],
[Input('obsModeRow', 'value')]
)
......@@ -67,12 +70,14 @@ def toggle_obs_mode(obs_value):
return {'display':'none'}, {'display':'none'}, {'display':'none'}, 'Incoherent', \
{'display':'none'}, {'display':'none'}, {'display':'none'}, \
{'display':'none'}, {'display':'none'}, {'display':'none'}, \
valid_pipes, 'none'
valid_pipes, 'none', \
{'display':'block'}, {'display':'block'}
else:
return {}, {'display':'block'}, {'display':'block'}, 'Incoherent', \
{}, {'display':'block'}, {'display':'block'}, \
{}, {'display':'block'}, {'display':'block'}, \
valid_pipes, 'none'
valid_pipes, 'none', \
{'display':'none'}, {'display':'none'}
################################################
# Show TAb stokes fields based on dropdown value
......@@ -338,13 +343,17 @@ def on_resolve_click(n, close_msg_box, target_name, is_open):
State('elevation-plot', 'figure'),
State('distance-table', 'figure'),
State('dateRow', 'date')
State('dateRow', 'date'),
State('obsModeRow', 'value'),
State('tabModeRow', 'value'),
State('stokesRow', 'value')
]
)
def on_genpdf_click(n_clicks, close_msg_box, obs_t, cal_t, n_cal, n_core, n_remote, n_int, n_chan,
n_sb, integ_t, ant_set, coord, pipe_type, t_avg, f_avg, is_dysco,
im_noise_val, raw_size, proc_size, pipe_time, is_msg_box_open,
elevation_fig, distance_table, obs_date):
elevation_fig, distance_table, obs_date, obs_mode, tab_mode, stokes):
"""Function defines what to do when the generate pdf button is clicked"""
if is_msg_box_open is True and close_msg_box is not None:
# The message box is open and the user has clicked the close
......@@ -367,7 +376,8 @@ def on_genpdf_click(n_clicks, close_msg_box, obs_t, cal_t, n_cal, n_core, n_remo
g.generate_pdf(rel_path, obs_t, cal_t, n_cal, n_core, n_remote, n_int, n_chan,
n_sb, integ_t, ant_set, coord, pipe_type, t_avg, f_avg,
is_dysco, im_noise_val, raw_size, proc_size, pipe_time,
elevation_fig, distance_table, obs_date)
elevation_fig, distance_table, obs_date,
obs_mode, tab_mode, stokes)
return {'display':'block'}, '/luci/{}'.format(rel_path), False
@app.server.route('/luci/static/<resource>')
......@@ -414,13 +424,16 @@ def serve_static(resource):
State('coordRow', 'value'),
State('dateRow', 'date'),
State('calListRow', 'value'),
State('demixListRow', 'value')
State('demixListRow', 'value'),
State('obsModeRow', 'value'),
State('tabModeRow', 'value'),
State('stokesRow', 'value')
]
)
def on_calculate_click(n, n_clicks, obs_t, cal_t, n_cal, n_core, n_remote, n_int, n_chan, n_sb,
integ_t, hba_mode, pipe_type, t_avg, f_avg, dy_compress,
is_open, src_name, coord, obs_date, calib_names,
ateam_names):
ateam_names, obs_mode, tab_mode, stokes):
"""Function defines what to do when the calculate button is clicked"""
if is_open is True:
# User has closed the error message box
......@@ -468,19 +481,42 @@ def on_calculate_click(n, n_clicks, obs_t, cal_t, n_cal, n_core, n_remote, n_int
im_noise = bk.calculate_im_noise(int(n_core), int(n_remote),
int(n_int), hba_mode, float(obs_t),
int(n_sb))
raw_size = bk.calculate_raw_size(float(obs_t), float(cal_t), int(n_cal), float(integ_t),
n_baselines, int(n_chan), int(n_sb), n_sap)
avg_size = bk.calculate_proc_size(float(obs_t), float(cal_t), int(n_cal), float(integ_t),
if obs_mode == 'Interferometric':
# Calculate interferometric raw size
raw_size = bk.calculate_raw_size(float(obs_t), float(cal_t), int(n_cal), float(integ_t),
n_baselines, int(n_chan), int(n_sb), n_sap)
avg_size = bk.calculate_proc_size(float(obs_t), float(cal_t), int(n_cal), float(integ_t),
n_baselines, int(n_chan), int(n_sb), n_sap,
pipe_type, int(t_avg), int(f_avg),
dy_compress)
if obs_mode == 'Beamformed':
# Calculate beamformed datasize
if stokes == 'I':
n_pol = 1
n_value = 1
if stokes == 'IQUV':
n_pol = 4
n_value = 1
if stokes == 'XXYY':
n_pol = 2
n_value =2
raw_size = bk.calculate_bf_size(int(n_sb), int(n_chan), \
n_pol, n_value, float(integ_t), \
float(obs_t))
if pipe_type == 'none':
# No pipeline
pipe_time = None
avg_size = 0
else:
pipe_time = bk.calculate_pipe_time(float(obs_t), float(cal_t), int(n_cal), int(n_sb), n_sap,
hba_mode, ateam_names,
pipe_type)
avg_size = bk.calculate_proc_size(float(obs_t), float(integ_t),
n_baselines, int(n_chan), int(n_sb),
pipe_type, int(t_avg), int(f_avg),
dy_compress)
# It is useful to have coord as a list from now on
......
......@@ -74,7 +74,7 @@ def make_pdf_plot(elevation_fig, outfilename):
def generate_pdf(pdf_file, obs_t, cal_t, n_cal, n_core, n_remote, n_int, n_chan, n_sb, integ_t,
antenna_set, coord, pipe_type, t_avg, f_avg, is_dysco, im_noise_val,
raw_size, proc_size, pipe_time, elevation_fig, distance_table,
obs_date):
obs_date, obs_mode, tab_mode, stokes):
"""Function to generate a pdf file summarizing the content of the calculator.
Return nothing."""
# Create an A4 sheet
......@@ -94,6 +94,20 @@ def generate_pdf(pdf_file, obs_t, cal_t, n_cal, n_core, n_remote, n_int, n_chan,
string += '<thead><tr><th width="70%" align="left">Parameter</th>'
string += '<th width="30%" align="left">Value</th></tr></thead>'
string += '<tbody>'
if obs_mode == 'Interferometric':
string += '<tr><td>Observation mode</td>'
string += ' <td>Interferometric</td></tr>'
else:
string += '<tr><td>Observation mode</td>'
string += ' <td>Beamformed</td></tr>'
string += '<tr><td>Tied array mode</td>'
string += ' <td>{}</td></tr>'.format(tab_mode)
string += '<tr><td>Stokes products to record</td>'
string += ' <td>{}</td></tr>'.format(stokes)
string += '<tr></tr>'
string += '<tr><td>Observation time (in seconds)</td>'
string += ' <td>{}</td></tr>'.format(obs_t)
string += '<tr><td>Calibrator duration (in seconds)</td>'
......@@ -104,7 +118,10 @@ def generate_pdf(pdf_file, obs_t, cal_t, n_cal, n_core, n_remote, n_int, n_chan,
string += '<tr><td>Number of simultaneous targets</td>'
string += ' <td>{}</td></tr>'.format(n_sap)
string += '<tr><td>No. of stations</td>'
string += ' <td>({}, {}, {})</td></tr>'.format(n_core, n_remote, n_int)
if obs_mode == 'Beamformed' and tab_mode == 'Coherent':
string += ' <td>({}, {}, {})</td></tr>'.format(n_core, 0, 0)
else:
string += ' <td>({}, {}, {})</td></tr>'.format(n_core, n_remote, n_int)
string += '<tr><td>No. of subbands</td>'
string += ' <td>{}</td></tr>'.format(n_sb)
string += '<tr><td>No. of channels per subband</td>'
......@@ -132,9 +149,10 @@ def generate_pdf(pdf_file, obs_t, cal_t, n_cal, n_core, n_remote, n_int, n_chan,
string += ' <td>{}</td></tr>'.format('enabled')
else:
string += ' <td>{}</td></tr>'.format('disabled')
string += '<tr></tr>'
string += '<tr><td>Theoretical image sensitivity (uJy/beam)</td>'
string += ' <td>{}</td></tr>'.format(im_noise_val)
if obs_mode == 'Interferometric':
string += '<tr></tr>'
string += '<tr><td>Theoretical image sensitivity (uJy/beam)</td>'
string += ' <td>{}</td></tr>'.format(im_noise_val)
string += '<tr><td>Raw data size (in GB)</td>'
string += ' <td>{}</td></tr>'.format(raw_size)
if pipe_type != 'none':
......
......@@ -402,7 +402,8 @@ pipeGUIFrame = html.Div(children=[
# Layout of the results tab
###############################################################################
imNoise = dbc.FormGroup([
dbc.Label('Theoretical image sensitivity (uJy/beam)', width=labelWidth),
dbc.Label('Theoretical image sensitivity (uJy/beam)', width=labelWidth,
id='imNoiseRowL'),
dbc.Col(
dbc.Input(type='text', id='imNoiseRow', value='',
disabled=True
......
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