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
6271985e
Commit
6271985e
authored
Jan 08, 2020
by
sarrvesh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compute solar system elevation in a function
parent
8ac9c712
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
30 deletions
+39
-30
targetvis.py
targetvis.py
+39
-30
No files found.
targetvis.py
View file @
6271985e
...
...
@@ -192,6 +192,42 @@ def resolve_source(names):
retString
=
None
return
retString
def
getElevationSolar
(
obsDate
,
offender
):
"""For a given observation date and bright solar system object, return its
elevation over the course of that day.
Input parameters:
* obsDate: Observation date in datetime.datetime format
* offender: Name of the solar system object. Allowed names are
Sun, Moon, and Jupiter.
Returns:
List of elevations in degrees. If offender is invalid, return None.
"""
# Create the telescope object
lofar
=
Observer
()
lofar
.
lon
=
'6.869882'
lofar
.
lat
=
'52.915129'
lofar
.
elevation
=
15.
if
offender
==
'Sun'
:
obj
=
Sun
()
elif
offender
==
'Moon'
:
obj
=
Moon
()
elif
offender
==
'Jupiter'
:
obj
=
Jupiter
()
else
:
return
None
yaxis
=
[]
for
time
in
obsDate
:
lofar
.
date
=
time
obj
.
compute
(
lofar
)
elevation
=
float
(
obj
.
alt
)
*
180.
/
np
.
pi
if
elevation
<
0
:
elevation
=
np
.
nan
yaxis
.
append
(
elevation
)
return
yaxis
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"""
...
...
@@ -236,40 +272,13 @@ def findTargetElevation(srcName, coord, obsDate, nInt):
retData
.
append
(
Scatter
(
x
=
xaxis
,
y
=
yaxis
,
mode
=
'lines'
,
line
=
{},
name
=
srcNameList
[
i
]
)
)
# We should also plot Sun, Moon, and Jupiter by default
sun
=
Sun
()
sun
.
_epoch
=
'2000'
yaxis
=
[]
for
item
in
xaxis
:
lofar
.
date
=
item
sun
.
compute
(
lofar
)
elevation
=
float
(
sun
.
alt
)
*
180.
/
np
.
pi
if
elevation
<
0
:
elevation
=
np
.
nan
yaxis
.
append
(
elevation
)
yaxis
=
getElevationSolar
(
xaxis
,
'Sun'
)
retData
.
append
(
Scatter
(
x
=
xaxis
,
y
=
yaxis
,
mode
=
'lines'
,
line
=
{},
name
=
'Sun'
)
)
moon
=
Moon
()
yaxis
=
[]
for
item
in
xaxis
:
lofar
.
date
=
item
moon
.
compute
(
lofar
)
elevation
=
float
(
moon
.
alt
)
*
180.
/
np
.
pi
if
elevation
<
0
:
elevation
=
np
.
nan
yaxis
.
append
(
elevation
)
yaxis
=
getElevationSolar
(
xaxis
,
'Moon'
)
retData
.
append
(
Scatter
(
x
=
xaxis
,
y
=
yaxis
,
mode
=
'lines'
,
line
=
{},
name
=
'Moon'
)
)
jupiter
=
Jupiter
()
yaxis
=
[]
for
item
in
xaxis
:
lofar
.
date
=
item
jupiter
.
compute
(
lofar
)
elevation
=
float
(
jupiter
.
alt
)
*
180.
/
np
.
pi
if
elevation
<
0
:
elevation
=
np
.
nan
yaxis
.
append
(
elevation
)
yaxis
=
getElevationSolar
(
xaxis
,
'Jupiter'
)
retData
.
append
(
Scatter
(
x
=
xaxis
,
y
=
yaxis
,
mode
=
'lines'
,
line
=
{},
name
=
'Jupiter'
)
)
return
retData
...
...
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