Skip to content

Commit

Permalink
Merge cda2dc6 into e4ef1e5
Browse files Browse the repository at this point in the history
  • Loading branch information
dkirkby committed Dec 15, 2018
2 parents e4ef1e5 + cda2dc6 commit 4e135e2
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 19 deletions.
47 changes: 43 additions & 4 deletions doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,86 @@
Full desisurvey API Reference
=============================

.. automodule:: desisurvey
:members:
Modules
=======

desisurvey.config
-----------------

.. automodule:: desisurvey.config
:members:

desisurvey.ephem
----------------

.. automodule:: desisurvey.ephem
:members:

desisurvey.etc
--------------

.. automodule:: desisurvey.etc
:members:

desisurvey.optimize
-------------------

.. automodule:: desisurvey.optimize
:members:

desisurvey.plan
---------------

.. automodule:: desisurvey.plan
:members:

desisurvey.plots
----------------

.. automodule:: desisurvey.plots
:members:

desisurvey.rules
----------------

.. automodule:: desisurvey.rules
:members:

desisurvey.tiles
----------------

.. automodule:: desisurvey.tiles
:members:

desisurvey.scheduler
--------------------

.. automodule:: desisurvey.scheduler
:members:

desisurvey.forecast
-------------------

.. automodule:: desisurvey.forecast
:members:

.. automodule:: desisurvey.scripts
:members:
desisurvey.utils
----------------

.. automodule:: desisurvey.utils
:members:

Command-Line Scripts
====================

surveyinit
----------

.. automodule:: desisurvey.scripts.surveyinit
:members:

surveymovie
-----------

.. automodule:: desisurvey.scripts.surveymovie
:members:
3 changes: 2 additions & 1 deletion doc/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ desisurvey change log
0.11.1 (unreleased)
-------------------

* No changes yet.
* Minor updates to conform to data model standards.
* Improved documentation.

0.11.0 (2018-11-26)
-------------------
Expand Down
7 changes: 6 additions & 1 deletion py/desisurvey/ephem.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def __init__(self, start_date, stop_date, num_obj_steps=25, restore=None):
return

# Initialize an empty table to fill.
meta = dict(NAME='Survey Ephemerides',
meta = dict(NAME='Survey Ephemerides', EXTNAME='EPHEM',
START=str(start_date), STOP=str(stop_date))
self._table = astropy.table.Table(meta=meta)
mjd_format = '%.5f'
Expand Down Expand Up @@ -357,6 +357,11 @@ def get_row(self, row_index):
.format(row_index))
return self._table[row_index]

@property
def table(self):
"""Read-only access to our internal table."""
return self._table

def get_night(self, night, as_index=False):
"""Return the row of ephemerides for a single night.
Expand Down
4 changes: 4 additions & 0 deletions py/desisurvey/optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ def wrap(angle, offset):
class Optimizer(object):
"""Initialize the hour angle assignments for specified tiles.
See `DESI-3060
<https://desi.lbl.gov/DocDB/cgi-bin/private/ShowDocument?docid=3060>`__
for details.
Parameters
----------
program : 'DARK', 'GRAY' or 'BRIGHT'
Expand Down
7 changes: 2 additions & 5 deletions py/desisurvey/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,17 +192,14 @@ def save(self, name):
'CADENCE': self.fiberassign_cadence,
'FIRST': self.first_night.isoformat() if self.first_night else '',
'LAST': self.last_night.isoformat() if self.last_night else '',
'EXTNAME': 'PLAN'
})
t['TILEID'] = self.tiles.tileID
t['COVERED'] = self.tile_covered
t['COUNTDOWN'] = self.tile_countdown
t['AVAILABLE'] = self.tile_available
t['PRIORITY'] = self.tile_priority
hdus = astropy.io.fits.HDUList()
hdus.append(astropy.io.fits.PrimaryHDU())
hdus.append(astropy.io.fits.table_to_hdu(t))
hdus[-1].name = 'PLAN'
hdus.writeto(fullname, overwrite=True)
t.write(fullname, overwrite=True)
self.log.debug(
'Saved plan with {} ({}) / {} tiles covered (available) to "{}".'
.format(np.count_nonzero(self.tile_covered),
Expand Down
2 changes: 2 additions & 0 deletions py/desisurvey/test/test_ephem.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ def test_ephem_table(self):
ephem = get_ephem()
self.assertEqual(ephem.num_nights, (ephem.stop_date - ephem.start_date).days)

self.assertEqual(id(ephem._table), id(ephem.table))

etable = ephem._table
self.assertEqual(len(etable), 31)
self.assertTrue(np.all(etable['dusk'] > etable['noon']))
Expand Down
18 changes: 10 additions & 8 deletions py/desisurvey/tiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@


class Tiles(object):

# Define the valid programs in canonical order.
PROGRAMS = ['DARK', 'GRAY', 'BRIGHT']
# Define a mapping from program name to index 0,1,2.
# Note that this mapping is independent of the programs actually present
# in a tiles file.
PROGRAM_INDEX = {pname: pidx for pidx, pname in enumerate(PROGRAMS)}

"""Manage static info associated with the tiles file.
Parameters
Expand Down Expand Up @@ -109,6 +101,16 @@ def __init__(self, tiles_file=None):
self._overlapping = None
self._fiberassign_delay = None

PROGRAMS = ['DARK', 'GRAY', 'BRIGHT']
"""Enumeration of the valid programs in their canonical order."""

PROGRAM_INDEX = {pname: pidx for pidx, pname in enumerate(PROGRAMS)}
"""Canonical mapping from program name to a small integer.
Note that this mapping is independent of the programs actually present
in a tiles file.
"""

def airmass(self, hour_angle, mask=None):
"""Calculate tile airmass given hour angle.
Expand Down

0 comments on commit 4e135e2

Please sign in to comment.