Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
L
LOFAR-calculator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Astronomy and Operations
SDC Operations
LOFAR-calculator
Commits
44243b2e
Commit
44243b2e
authored
Apr 07, 2020
by
sarrvesh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update frontend to support beamformed observations
parent
1c6e8203
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
138 additions
and
15 deletions
+138
-15
calculator.py
calculator.py
+79
-3
gui.py
gui.py
+59
-12
No files found.
calculator.py
View file @
44243b2e
...
...
@@ -32,6 +32,82 @@ app.title = 'LUCI - LOFAR Unified Calculator for Imaging'
# See https://community.plot.ly/t/dash-callback-in-a-separate-file/14122/16
##############################################
##############################################
# Show observational setup fields based on
# obsMode dropdown value
##############################################
@
app
.
callback
(
[
Output
(
'tabModeForm'
,
'style'
),
Output
(
'tabModeRowL'
,
'style'
),
Output
(
'tabModeRow'
,
'style'
),
Output
(
'tabModeRow'
,
'value'
),
Output
(
'stokesForm'
,
'style'
),
Output
(
'stokesRowL'
,
'style'
),
Output
(
'stokesRow'
,
'style'
),
Output
(
'nRemoteForm'
,
'style'
),
Output
(
'nRemoteRow'
,
'style'
),
Output
(
'nRemoteRowL'
,
'style'
),
Output
(
'nIntForm'
,
'style'
),
Output
(
'nIntRow'
,
'style'
),
Output
(
'nIntRowL'
,
'style'
),
Output
(
'nRingsForm'
,
'style'
),
Output
(
'nRingsRow'
,
'style'
),
Output
(
'nRingsRowL'
,
'style'
),
Output
(
'pipeTypeRow'
,
'options'
),
Output
(
'pipeTypeRow'
,
'value'
)
],
[
Input
(
'obsModeRow'
,
'value'
)]
)
def
toggle_obs_mode
(
value
):
"""Function to show relevant observational setup fields
depending on the user's choice"""
all_pipelines
=
{
'Interferometric'
:
[
'none'
,
'preprocessing'
],
'Beamformed'
:
[
'none'
,
'pulp'
]
}
valid_pipes
=
[{
'label'
:
i
,
'value'
:
i
}
for
i
in
all_pipelines
[
value
]]
if
value
==
'Interferometric'
:
return
{
'display'
:
'none'
},
{
'display'
:
'none'
},
{
'display'
:
'none'
},
''
,
\
{
'display'
:
'none'
},
{
'display'
:
'none'
},
{
'display'
:
'none'
},
\
{},
{
'display'
:
'block'
},
{
'display'
:
'block'
},
\
{},
{
'display'
:
'block'
},
{
'display'
:
'block'
},
\
{
'display'
:
'none'
},
{
'display'
:
'none'
},
{
'display'
:
'none'
},
\
valid_pipes
,
'none'
else
:
return
{},
{
'display'
:
'block'
},
{
'display'
:
'block'
},
'Coherent'
,
\
{},
{
'display'
:
'block'
},
{
'display'
:
'block'
},
\
{
'display'
:
'none'
},
{
'display'
:
'none'
},
{
'display'
:
'none'
},
\
{
'display'
:
'none'
},
{
'display'
:
'none'
},
{
'display'
:
'none'
},
\
{},
{
'display'
:
'block'
},
{
'display'
:
'block'
},
\
valid_pipes
,
'none'
################################################
# Show TAb stokes fields based on dropdown value
################################################
@
app
.
callback
(
[
Output
(
'stokesRow'
,
'options'
),
Output
(
'stokesRow'
,
'value'
)
],
[
Input
(
'tabModeRow'
,
'value'
)]
)
def
toggle_stokes
(
value
):
"""Function to show relevant Stokes products depending
on the user's TAB choice"""
if
value
==
''
:
value
=
'Coherent'
all_stokes
=
{
'Coherent'
:
[
'I'
,
'IQUV'
,
'XXYY'
],
'Incoherent'
:
[
'I'
,
'IQUV'
]
}
valid_stokes
=
[{
'label'
:
i
,
'value'
:
i
}
for
i
in
all_stokes
[
value
]]
return
valid_stokes
,
'I'
##############################################
# Show pipeline fields based on dropdown value
##############################################
...
...
@@ -410,6 +486,6 @@ def on_calculate_click(n, n_clicks, obs_t, n_core, n_remote, n_int, n_chan, n_sb
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)
gui.py
View file @
44243b2e
...
...
@@ -48,7 +48,9 @@ msgBox = dbc.Modal([
###############################################################################
# Default values for various input fields
###############################################################################
defaultParams
=
{
'obsTime'
:
'28800'
,
defaultParams
=
{
'obsMode'
:
'Interferometric'
,
'tabMode'
:
'Coherent'
,
'obsTime'
:
'28800'
,
'Ncore'
:
'24'
,
'Nremote'
:
'14'
,
'Nint'
:
'14'
,
...
...
@@ -56,6 +58,7 @@ defaultParams = {'obsTime':'28800',
'Nsb'
:
'488'
,
'intTime'
:
'1'
,
'hbaDual'
:
'hbadualinner'
,
'Nrings'
:
'0'
,
'pipeType'
:
'none'
,
'tAvg'
:
'1'
,
...
...
@@ -81,6 +84,39 @@ dropWidth = 4
###############################################################################
# Layout of observational setup
###############################################################################
obsMode
=
dbc
.
FormGroup
([
dbc
.
Label
(
'Observation mode'
,
width
=
labelWidth
),
dbc
.
Col
(
dcc
.
Dropdown
(
options
=
[
{
'label'
:
'Interferometric'
,
'value'
:
'Interferometric'
},
{
'label'
:
'Beamformed'
,
'value'
:
'Beamformed'
}
],
value
=
defaultParams
[
'obsMode'
],
searchable
=
False
,
clearable
=
False
,
id
=
'obsModeRow'
),
width
=
dropWidth
)
],
row
=
True
)
tabMode
=
dbc
.
FormGroup
([
dbc
.
Label
(
'Tied array mode'
,
width
=
labelWidth
,
id
=
'tabModeRowL'
),
dbc
.
Col
(
dcc
.
Dropdown
(
options
=
[
{
'label'
:
'Coherent'
,
'value'
:
'Coherent'
},
{
'label'
:
'Incoherent'
,
'value'
:
'Incoherent'
}
],
value
=
defaultParams
[
'tabMode'
],
searchable
=
False
,
clearable
=
False
,
id
=
'tabModeRow'
),
width
=
dropWidth
,
id
=
'tabModeCol'
)
],
row
=
True
,
id
=
'tabModeForm'
)
stokes
=
dbc
.
FormGroup
([
dbc
.
Label
(
'Stokes products to record'
,
width
=
labelWidth
,
id
=
'stokesRowL'
),
dbc
.
Col
(
dcc
.
Dropdown
(
options
=
[],
searchable
=
False
,
clearable
=
False
,
id
=
'stokesRow'
),
width
=
dropWidth
)
],
row
=
True
,
id
=
'stokesForm'
)
obsTime
=
dbc
.
FormGroup
([
dbc
.
Label
(
'Observation time (in seconds)'
,
width
=
labelWidth
),
dbc
.
Col
(
...
...
@@ -100,23 +136,27 @@ Ncore = dbc.FormGroup([
)
],
row
=
True
)
Nremote
=
dbc
.
FormGroup
([
dbc
.
Label
(
'No. of remote stations (0 - 14)'
,
width
=
labelWidth
),
dbc
.
Label
(
'No. of remote stations (0 - 14)'
,
width
=
labelWidth
,
id
=
'nRemoteRowL'
),
dbc
.
Col
(
dbc
.
Input
(
type
=
'number'
,
id
=
'nRemoteRow'
,
value
=
defaultParams
[
'Nremote'
]
),
width
=
inpWidth
)
],
row
=
True
)
],
row
=
True
,
id
=
'nRemoteForm'
)
Nint
=
dbc
.
FormGroup
([
dbc
.
Label
(
'No. of international stations (0 - 14)'
,
width
=
labelWidth
),
dbc
.
Label
(
'No. of international stations (0 - 14)'
,
width
=
labelWidth
,
id
=
'nIntRowL'
),
dbc
.
Col
(
dbc
.
Input
(
type
=
'number'
,
id
=
'nIntRow'
,
value
=
defaultParams
[
'Nint'
]
),
width
=
inpWidth
)
],
row
=
True
)
],
row
=
True
,
id
=
'nIntForm'
)
Nchan
=
dbc
.
FormGroup
([
dbc
.
Label
(
'Number of channels per subband'
,
width
=
labelWidth
),
dbc
.
Col
(
...
...
@@ -174,7 +214,7 @@ link = html.Div([
style
=
{
'display'
:
'none'
}
)
])
obsGUISetup
=
dbc
.
Form
([
obsTime
,
Ncore
,
Nremote
,
Nint
,
Nchan
,
obsGUISetup
=
dbc
.
Form
([
obs
Mode
,
tabMode
,
stokes
,
obs
Time
,
Ncore
,
Nremote
,
Nint
,
Nchan
,
Nsb
,
intTime
,
hbaDual
,
buttons
,
link
])
obsGUIFrame
=
html
.
Div
(
children
=
[
html
.
H3
(
'Observational setup'
),
...
...
@@ -189,11 +229,8 @@ pipeType = dbc.FormGroup([
dbc
.
Label
(
'Pipeline'
,
width
=
labelWidth
-
inpWidth
),
dbc
.
Col
(
dcc
.
Dropdown
(
options
=
[
{
'label'
:
'None'
,
'value'
:
'none'
},
{
'label'
:
'Preprocessing'
,
'value'
:
'preprocessing'
},
#{'label':'Prefactor', 'value':'prefactor'}
],
value
=
defaultParams
[
'pipeType'
],
searchable
=
False
,
options
=
[],
value
=
defaultParams
[
'pipeType'
],
searchable
=
False
,
clearable
=
False
,
id
=
'pipeTypeRow'
),
width
=
dropWidth
)
...
...
@@ -262,6 +299,16 @@ targetCoord = dbc.FormGroup([
dbc
.
Label
(
'Coordinates'
,
width
=
labelWidth
-
inpWidth
),
dbc
.
Col
(
dbc
.
Input
(
id
=
'coordRow'
),
width
=
inpWidth
*
2
)
],
row
=
True
)
Nrings
=
dbc
.
FormGroup
([
dbc
.
Label
(
'No. of TAB rings (0 - 8)'
,
width
=
labelWidth
-
inpWidth
,
id
=
'nRingsRowL'
),
dbc
.
Col
(
dbc
.
Input
(
type
=
'number'
,
id
=
'nRingsRow'
,
value
=
defaultParams
[
'Nrings'
]
),
width
=
inpWidth
,
)
],
row
=
True
,
id
=
'nRingsForm'
)
obsDate
=
dbc
.
FormGroup
([
dbc
.
Label
(
'Observation date'
,
width
=
labelWidth
-
inpWidth
),
dbc
.
Col
(
dcc
.
DatePickerSingle
(
date
=
date
.
today
(),
...
...
@@ -297,7 +344,7 @@ demixList = dbc.FormGroup([
),
width
=
dropWidth
)
],
row
=
True
)
targetGUISetup
=
dbc
.
Form
([
targetName
,
targetCoord
,
obsDate
,
calList
,
demixList
])
targetGUISetup
=
dbc
.
Form
([
targetName
,
targetCoord
,
Nrings
,
obsDate
,
calList
,
demixList
])
pipeGUIFrame
=
html
.
Div
(
children
=
[
html
.
H3
(
'Target setup'
),
html
.
Hr
(),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment