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
d5d3b409
Unverified
Commit
d5d3b409
authored
Oct 01, 2020
by
scisup
Committed by
GitHub
Oct 01, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into AddCalibrator
parents
3ea85391
632e1616
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
83 additions
and
17 deletions
+83
-17
backend.py
backend.py
+11
-0
calculator.py
calculator.py
+47
-11
generatepdf.py
generatepdf.py
+23
-5
gui.py
gui.py
+2
-1
No files found.
backend.py
View file @
d5d3b409
...
...
@@ -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
...
...
calculator.py
View file @
d5d3b409
...
...
@@ -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
...
...
generatepdf.py
View file @
d5d3b409
...
...
@@ -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'
:
...
...
gui.py
View file @
d5d3b409
...
...
@@ -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
...
...
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