Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pulp #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Pulp #10

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 81 additions & 12 deletions calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

Output('pipeTypeRow', 'options'),
Output('pipeTypeRow', 'value'),

Output('imNoiseRowL', 'style'),
Output('imNoiseRow', 'style')
],
Expand Down Expand Up @@ -129,25 +129,84 @@ def toggle_stokes(value):
Output('pipeSizeRowL', 'style'),
Output('pipeSizeRow', 'style'),
Output('pipeProcTimeRow', 'style'),
Output('pipeProcTimeRowL', 'style')
Output('pipeProcTimeRowL', 'style'),
Output('tAvgPulpRow', 'style'),
Output('tAvgPulpRowL', 'style'),
Output('8bitRow', 'style'),
Output('8bitRowL', 'style'),
Output('digifilRow', 'style'),
Output('digifilRowL', 'style'),
Output('pdmpRow', 'style'),
Output('pdmpRowL', 'style'),
Output('singlePulseRow', 'style'),
Output('singlePulseRowL', 'style'),
Output('rratsRow', 'style'),
Output('rratsRowL', 'style'),
Output('tAvgPulpRow', 'value'),

],
[Input('pipeTypeRow', 'value')]
[Input('pipeTypeRow', 'value'),Input('stokesRow', 'value')],

)
def toggle_pipeline(value):
def toggle_pipeline(value,stokes):
"""Function to show relevant pipeline fields depending on
the user's pipeline choice."""
if value == 'none':
return {'display':'none'}, {'display':'none'}, \
{'display':'none'}, {'display':'none'}, \
{'display':'none'}, {'display':'none'}, \
{'display':'none'}, {'display':'none'}, \
{'display':'none'}, {'display':'none'}
{'display':'none'}, {'display':'none'}, \
{'display':'none'}, {'display':'none'}, \
{'display':'none'}, {'display':'none'}, \
{'display':'none'}, {'display':'none'}, \
{'display':'none'}, {'display':'none'}, \
{'display':'none'}, {'display':'none'}, \
{'display':'none'}, {'display':'none'}, \
60
elif value == 'preprocessing':
return {'display':'block'}, {'display':'block'}, \
{'display':'block'}, {'display':'block'}, \
{'display':'block'}, {'display':'block'}, \
{'display':'block'}, {'display':'block'}, \
{'display':'block'}, {'display':'block'}
{'display':'block'}, {'display':'block'}, \
{'display':'none'}, {'display':'none'}, \
{'display':'none'}, {'display':'none'}, \
{'display':'none'}, {'display':'none'}, \
{'display':'none'}, {'display':'none'}, \
{'display':'none'}, {'display':'none'}, \
{'display':'none'}, {'display':'none'}, \
60
elif value == 'pulp':
if stokes == 'XXYY':
return {'display':'none'}, {'display':'none'}, \
{'display':'none'}, {'display':'none'}, \
{'display':'none'}, {'display':'none'}, \
{'display':'none'}, {'display':'none'}, \
{'display':'none'}, {'display':'none'}, \
{'display':'block'}, {'display':'block'}, \
{'display':'block'}, {'display':'block'}, \
{'display':'block'}, {'display':'block'}, \
{'display':'block'}, {'display':'block'}, \
{'display':'none'}, {'display':'none'}, \
{'display':'none'}, {'display':'none'}, \
5
else:
return {'display':'none'}, {'display':'none'}, \
{'display':'none'}, {'display':'none'}, \
{'display':'none'}, {'display':'none'}, \
{'display':'none'}, {'display':'none'}, \
{'display':'none'}, {'display':'none'}, \
{'display':'block'}, {'display':'block'}, \
{'display':'none'}, {'display':'none'}, \
{'display':'none'}, {'display':'none'}, \
{'display':'none'}, {'display':'none'}, \
{'display':'block'}, {'display':'block'}, \
{'display':'block'}, {'display':'block'}, \
60




#######################################
# Validate time averaging factor
Expand Down Expand Up @@ -344,16 +403,25 @@ def on_resolve_click(n, close_msg_box, target_name, is_open):
State('distance-table', 'figure'),

State('dateRow', 'date'),

State('obsModeRow', 'value'),
State('tabModeRow', 'value'),
State('stokesRow', 'value')
State('stokesRow', 'value'),

State('tAvgPulpRow', 'value'),
State('8bitRow', 'value'),
State('digifilRow', 'value'),
State('pdmpRow', 'value'),
State('singlePulseRow', 'value'),
State('rratsRow', '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, obs_mode, tab_mode, stokes):
elevation_fig, distance_table, obs_date, obs_mode, tab_mode, stokes, pulp_avg, pulp_8bit, pulp_digifil, pulp_pdmp, pulp_singlepulse, pulp_rrats):
"""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
Expand All @@ -376,8 +444,9 @@ 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,
obs_mode, tab_mode, stokes)
elevation_fig, distance_table, obs_date,
obs_mode, tab_mode, stokes,
pulp_avg, pulp_8bit, pulp_digifil, pulp_pdmp, pulp_singlepulse, pulp_rrats)
return {'display':'block'}, '/luci/{}'.format(rel_path), False

@app.server.route('/luci/static/<resource>')
Expand Down Expand Up @@ -504,7 +573,7 @@ def on_calculate_click(n, n_clicks, obs_t, cal_t, n_cal, n_core, n_remote, n_int
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
Expand Down
14 changes: 9 additions & 5 deletions generatepdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ 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_mode, tab_mode, stokes):
obs_date, obs_mode, tab_mode, stokes,
pulp_avg, pulp_8bit, pulp_digifil, pulp_pdmp, pulp_singlepulse, pulp_rrats):
"""Function to generate a pdf file summarizing the content of the calculator.
Return nothing."""
# Create an A4 sheet
Expand All @@ -94,7 +95,7 @@ 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>'
Expand All @@ -105,9 +106,9 @@ def generate_pdf(pdf_file, obs_t, cal_t, n_cal, n_core, n_remote, n_int, n_chan,
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>'
Expand Down Expand Up @@ -140,7 +141,7 @@ def generate_pdf(pdf_file, obs_t, cal_t, n_cal, n_core, n_remote, n_int, n_chan,
string += '<tr><td>Pipeline type</td>'
if pipe_type == 'none':
string += ' <td>{}</td></tr>'.format('None')
else:
elif pipe_type == 'preprocessing':
string += ' <td>{}</td></tr>'.format('Preprocessing')
string += '<tr><td>Averaging factor (time, freq)</td>'
string += ' <td>{}, {}</td></tr>'.format(t_avg, f_avg)
Expand All @@ -149,6 +150,9 @@ 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')
elif pipe_type == 'pulp':
string += ' <td>{}</td></tr>'.format('Pulp')

if obs_mode == 'Interferometric':
string += '<tr></tr>'
string += '<tr><td>Theoretical image sensitivity (uJy/beam)</td>'
Expand Down
112 changes: 112 additions & 0 deletions gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@
'fAvg':'4',
'dyCompress':'enable',

'tAvgPulp':'60',
'8bit':'NO',
'digifil':'NO',
'no_pdmp':'NO',
'single_pulse':'NO',
'rrats':'NO',

'targetName':'',
'target_coord':'',
}
Expand Down Expand Up @@ -257,6 +264,8 @@
options=[
{'label':'None', 'value':'none'},
{'label':'Preprocessing', 'value':'preprocessing'},
{'label':'Pulsar pipeline', 'value':'pulp'},

#{'label':'Prefactor', 'value':'prefactor'}
], value=defaultParams['pipeType'], searchable=False,
clearable=False, id='pipeTypeRow'
Expand Down Expand Up @@ -319,6 +328,108 @@
], row=True)
pipeGUISetup = dbc.Form([pipeType, tAvg, fAvg, dyCompress])

###############################################################################
# Define the layout of the pulp setup
###############################################################################

tAvgPulp = dbc.FormGroup([
dbc.Label('Length of subintegration (sec)', width=labelWidth-inpWidth,
id='tAvgPulpRowL'
),
dbc.Col(
dbc.Input(type='number',
id='tAvgPulpRow',
min=0,
value=defaultParams['tAvgPulp']
), width=inpWidth
)
], row=True)


rawTo8bitPulp = dbc.FormGroup([
dbc.Label('Convert raw data to 8-bit', width=labelWidth-inpWidth,
id='8bitRowL'
),
dbc.Col(
dcc.Dropdown(
options=[
{'label':'YES', 'value':'YES'},
{'label':'NO', 'value':'NO'},
{'label':'ONLY', 'value':'ONLY'},
], value=defaultParams['8bit'],
clearable=False, id='8bitRow',
), width=dropWidth
)
], row=True)

digifilPulp = dbc.FormGroup([
dbc.Label('Run digifil', width=labelWidth-inpWidth,
id='digifilRowL'
),
dbc.Col(
dcc.Dropdown(
options=[
{'label':'YES', 'value':'YES'},
{'label':'NO', 'value':'NO'},
], value=defaultParams['digifil'],
clearable=False, id='digifilRow',
), width=dropWidth
)
], row=True)

pdmpPulp = dbc.FormGroup([
dbc.Label('Skip pdmp', width=labelWidth-inpWidth,
id='pdmpRowL'
),
dbc.Col(
dcc.Dropdown(
options=[
{'label':'YES', 'value':'YES'},
{'label':'NO', 'value':'NO'},
], value=defaultParams['no_pdmp'],
clearable=False, id='pdmpRow',
), width=dropWidth
)
], row=True)

singlePulsePulp = dbc.FormGroup([
dbc.Label('Single pulse search', width=labelWidth-inpWidth,
id='singlePulseRowL'
),
dbc.Col(
dcc.Dropdown(
options=[
{'label':'YES', 'value':'YES'},
{'label':'NO', 'value':'NO'},
], value=defaultParams['single_pulse'],
clearable=False, id='singlePulseRow',
), width=dropWidth
)
], row=True)

rratsPulp = dbc.FormGroup([
dbc.Label('Search for RRATS', width=labelWidth-inpWidth,
id='rratsRowL'
),
dbc.Col(
dcc.Dropdown(
options=[
{'label':'YES', 'value':'YES'},
{'label':'NO', 'value':'NO'},
], value=defaultParams['rrats'],
clearable=False, id='rratsRow',
), width=dropWidth
)
], row=True)




pipeGUISetupPulp = dbc.Form([rawTo8bitPulp, digifilPulp, pdmpPulp, tAvgPulp, singlePulsePulp , rratsPulp ])




###############################################################################
# Define the layout of the target setup
###############################################################################
Expand Down Expand Up @@ -396,6 +507,7 @@
html.H3('Pipeline setup'),
html.Hr(),
pipeGUISetup,
pipeGUISetupPulp,
], style={'width':'95%', 'padding':'20px'})

###############################################################################
Expand Down