Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Divya Singh
ligo.skymap
Commits
5620799e
Commit
5620799e
authored
Mar 26, 2019
by
Leo Pound Singer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add options to specify site manually
parent
574cb4a2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
7 deletions
+46
-7
CHANGES.rst
CHANGES.rst
+2
-1
ligo/skymap/tool/ligo_skymap_plot_airmass.py
ligo/skymap/tool/ligo_skymap_plot_airmass.py
+44
-6
No files found.
CHANGES.rst
View file @
5620799e
...
...
@@ -5,7 +5,8 @@ Changelog
0.1.6 (unreleased)
==================
- No changes yet.
- Add options to ``ligo-skymap-plot-airmass`` to specify site coordinates
explicitly rather than by a site nickname.
0.1.5 (2019-03-20)
==================
...
...
ligo/skymap/tool/ligo_skymap_plot_airmass.py
View file @
5620799e
...
...
@@ -33,11 +33,27 @@ def parser():
parser
.
add_argument
(
'input'
,
metavar
=
'INPUT.fits[.gz]'
,
type
=
FileType
(
'rb'
),
default
=
'-'
,
nargs
=
'?'
,
help
=
'Input FITS file'
)
parser
.
add_argument
(
'--time'
,
help
=
'UTC time'
)
parser
.
add_argument
(
'--site'
,
choices
=
EarthLocation
.
get_site_names
(),
help
=
'Observatory site'
,
required
=
True
)
help
=
'Observatory site'
)
parser
.
add_argument
(
'--time'
,
help
=
'UTC time'
)
'--site-longitude'
,
metavar
=
'DEG'
,
type
=
float
,
help
=
'Observatory longitude on the WGS84 ellipsoid. '
'Mutually exclusive with --site.'
)
parser
.
add_argument
(
'--site-latitude'
,
metavar
=
'DEG'
,
type
=
float
,
help
=
'Observatory latitude on the WGS84 ellipsoid. '
'Mutually exclusive with --site.'
)
parser
.
add_argument
(
'--site-height'
,
metavar
=
'METERS'
,
type
=
float
,
help
=
'Observatory height from the WGS84 ellipsoid .'
'Mutually exclusive with --site.'
)
parser
.
add_argument
(
'--site-timezone'
,
help
=
'Observatory time zone, e.g. "US/Pacific". '
'Mutually exclusive with --site.'
)
return
parser
...
...
@@ -52,7 +68,8 @@ def clip_verylarge(x, max=1e300):
def
main
(
args
=
None
):
opts
=
parser
().
parse_args
(
args
)
p
=
parser
()
opts
=
p
.
parse_args
(
args
)
# Late imports
import
operator
...
...
@@ -60,9 +77,10 @@ def main(args=None):
from
astroplan
import
Observer
from
astroplan.plots
import
plot_airmass
from
astropy.coordinates
import
SkyCoord
from
astropy.coordinates
import
EarthLocation
,
SkyCoord
from
astropy.table
import
Table
from
astropy.time
import
Time
from
astropy
import
units
as
u
from
matplotlib
import
dates
from
matplotlib.patches
import
Patch
from
matplotlib
import
pyplot
as
plt
...
...
@@ -74,13 +92,33 @@ def main(args=None):
from
..
import
plot
# noqa
from
..extern.quantile
import
percentile
if
opts
.
site
is
None
:
if
opts
.
site_longitude
is
None
or
opts
.
site_latitude
is
None
:
p
.
error
(
'must specify either --site or both '
'--site-longitude and --site-latitude'
)
location
=
EarthLocation
(
lon
=
opts
.
site_longitude
*
u
.
deg
,
lat
=
opts
.
site_latitude
*
u
.
deg
,
height
=
(
opts
.
site_height
or
0
)
*
u
.
m
)
if
opts
.
site_timezone
is
not
None
:
location
.
info
.
meta
=
{
'timezone'
:
opts
.
site_timezone
}
observer
=
Observer
(
location
)
else
:
if
not
((
opts
.
site_longitude
is
None
)
and
(
opts
.
site_latitude
is
None
)
and
(
opts
.
site_height
is
None
)
and
(
opts
.
site_timezone
is
None
)):
p
.
error
(
'argument --site not allowed with arguments '
'--site-longitude, --site-latitude, '
'--site-height, or --site-timezone'
)
observer
=
Observer
.
at_site
(
opts
.
site
)
m
=
fits
.
read_sky_map
(
opts
.
input
.
name
,
moc
=
True
)
# Make an empty airmass chart.
# FIXME: have to add a dummy target until
# https://github.com/astropy/astroplan/pull/349
# is in a release of astroplan
observer
=
Observer
.
at_site
(
opts
.
site
)
t0
=
Time
(
opts
.
time
)
if
opts
.
time
is
not
None
else
Time
.
now
()
t0
=
observer
.
midnight
(
t0
)
ax
=
plot_airmass
(
...
...
@@ -152,7 +190,7 @@ def main(args=None):
zorder
=
3
,
linewidth
=
0
)
# Add local time axis
timezone
=
observer
.
location
.
info
.
meta
.
get
(
'timezone'
)
timezone
=
(
observer
.
location
.
info
.
meta
or
{})
.
get
(
'timezone'
)
if
timezone
:
tzinfo
=
pytz
.
timezone
(
timezone
)
ax2
=
ax
.
twiny
()
...
...
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