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
df32a013
Commit
df32a013
authored
Jan 07, 2020
by
sarrvesh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add sunrise and sunset to target visibility plot
parent
e3a2e890
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
7 deletions
+80
-7
calculator.py
calculator.py
+8
-6
targetvis.py
targetvis.py
+72
-1
No files found.
calculator.py
View file @
df32a013
...
...
@@ -361,15 +361,17 @@ def on_calculate_click(n, n_clicks, obsT, nCore, nRemote, nInt, nChan, nSB,
return
''
,
''
,
''
,
''
,
msg
,
True
,
\
{
'display'
:
'none'
},
{},
{
'display'
:
'none'
},
{}
# Find target elevation across a 24-hour period
data
=
tv
.
findTargetElevation
(
srcName
,
coord_list
,
obsDate
)
data
=
tv
.
findTargetElevation
(
srcName
,
coord_list
,
obsDate
,
int
(
nInt
)
)
displayFig
=
{
'display'
:
'block'
,
'height'
:
600
}
elevationFig
=
{
'data'
:
data
,
'layout'
:
go
.
Layout
(
xaxis
=
{
'title'
:
'Time (UTC)'
},
yaxis
=
{
'title'
:
'Elevation'
},
title
=
'Target visibility plot'
)
'layout'
:{
'xaxis'
:{
'title'
:
'Time (UTC)'
},
'yaxis'
:{
'title'
:
'Elevation'
},
'title'
:
'Target visibility plot'
,
'shapes'
:[]
}
}
elevationFig
=
tv
.
addSunRiseAndSetTimes
(
obsDate
,
int
(
nInt
),
elevationFig
)
# Find the position of the station and tile beam
beamFig
=
tv
.
findBeamLayout
(
srcNameInput
,
coordInput
,
\
int
(
nCore
),
int
(
nRemote
),
int
(
nInt
),
hbaMode
)
...
...
targetvis.py
View file @
df32a013
...
...
@@ -175,7 +175,7 @@ def resolve_source(names):
retString
=
None
return
retString
def
findTargetElevation
(
srcName
,
coord
,
obsDate
):
def
findTargetElevation
(
srcName
,
coord
,
obsDate
,
nInt
):
"""For a given date and coordinate, find the elevation of the source every
10 mins. Return both the datetime object array and the elevation array"""
# Find the start and the end times
...
...
@@ -256,3 +256,74 @@ def findTargetElevation(srcName, coord, obsDate):
retData
.
append
(
Scatter
(
x
=
xaxis
,
y
=
yaxis
,
mode
=
'lines'
,
line
=
{},
name
=
'Jupiter'
)
)
return
retData
def
addSunRiseAndSetTimes
(
obsDate
,
nInt
,
elevationFig
):
"""
For a given obsDate, find the sun rise and set times. Add these to the supplied
elevationFig and return the modified elevationFig.
"""
d
=
obsDate
.
split
(
'-'
)
startTime
=
datetime
(
int
(
d
[
0
]),
int
(
d
[
1
]),
int
(
d
[
2
]),
0
,
0
,
0
)
sun
=
Sun
()
sun
.
_epoch
=
'2000'
if
nInt
==
0
:
# Only Dutch array is being used. Calculate Sun rise and set times in NL
lofar
=
Observer
()
lofar
.
lon
=
'6.869882'
lofar
.
lat
=
'52.915129'
lofar
.
elevation
=
15.
lofar
.
date
=
startTime
sun_rise
=
lofar
.
next_rising
(
sun
).
datetime
()
sun_set
=
lofar
.
next_setting
(
sun
).
datetime
()
# Define a 1 hour window around Sun rise and Sun set.
sun_rise_beg
=
sun_rise
-
timedelta
(
minutes
=
30
)
sun_rise_end
=
sun_rise
+
timedelta
(
minutes
=
30
)
sun_set_beg
=
sun_set
-
timedelta
(
minutes
=
30
)
sun_set_end
=
sun_set
+
timedelta
(
minutes
=
30
)
else
:
# Calculate sun rise and set times using Latvian and Irish stations
lv
=
Observer
()
lv
.
lon
=
'21.854916'
lv
.
lat
=
'57.553493'
lv
.
date
=
startTime
ie
=
Observer
()
ie
.
lon
=
'-7.921790'
ie
.
lat
=
'53.094967'
ie
.
date
=
startTime
lv_sun_rise
=
lv
.
next_rising
(
sun
).
datetime
()
lv_sun_set
=
lv
.
next_setting
(
sun
).
datetime
()
ie_sun_rise
=
ie
.
next_rising
(
sun
).
datetime
()
ie_sun_set
=
ie
.
next_setting
(
sun
).
datetime
()
print
(
lv_sun_set
)
print
(
lv
.
next_setting
(
sun
))
# Define a window around sun rise and sun set.
sun_rise_beg
=
lv_sun_rise
-
timedelta
(
minutes
=
30
)
sun_rise_end
=
ie_sun_rise
+
timedelta
(
minutes
=
30
)
sun_set_beg
=
lv_sun_set
-
timedelta
(
minutes
=
30
)
sun_set_end
=
ie_sun_set
+
timedelta
(
minutes
=
30
)
# Add to elevationFig
elevationFig
[
'layout'
][
'shapes'
].
append
({
'type'
:
"rect"
,
'xref'
:
'x'
,
'yref'
:
'y'
,
'x0'
:
sun_rise_beg
,
'x1'
:
sun_rise_end
,
'y0'
:
0
,
'y1'
:
90
,
'fillcolor'
:
'LightSkyBlue'
,
'opacity'
:
0.4
,
'line'
:
{
'width'
:
0
,}
})
elevationFig
[
'layout'
][
'shapes'
].
append
({
'type'
:
"rect"
,
'xref'
:
'x'
,
'yref'
:
'y'
,
'x0'
:
sun_set_beg
,
'x1'
:
sun_set_end
,
'y0'
:
0
,
'y1'
:
90
,
'fillcolor'
:
'LightSkyBlue'
,
'opacity'
:
0.4
,
'line'
:
{
'width'
:
0
,}
})
return
elevationFig
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