Skip to content

Commit 3b708f1

Browse files
authored
Merge pull request #224 from desihub/documentation-fixes
Documentation fixes
2 parents e7a4ea4 + 56e7194 commit 3b708f1

29 files changed

+565
-442
lines changed

.travis.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ matrix:
8787
# Check for sphinx doc build warnings - we do this first because it
8888
# runs for a long time
8989
- os: linux
90-
env: PYTHON_VERSION=2.7 SETUP_CMD='build_sphinx'
91-
CONDA_DEPENDENCIES=$CONDA_ALL_DEPENDENCIES
90+
env: PYTHON_VERSION=3.5 SETUP_CMD='build_sphinx --warning-is-error'
9291

9392
# OPTIONAL_DEPS needed because the plot_directive in sphinx needs them
9493
# -w is an astropy extension

doc/api.rst

+56
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,21 @@ desisim API
55
.. automodule:: desisim
66
:members:
77

8+
.. automodule:: desisim.batch
9+
:members:
10+
11+
.. automodule:: desisim.batch.pixsim
12+
:members:
13+
814
.. automodule:: desisim.cosmology
915
:members:
1016

1117
.. automodule:: desisim.io
1218
:members:
1319

20+
.. automodule:: desisim.lya_spectra
21+
:members:
22+
1423
.. automodule:: desisim.obs
1524
:members:
1625

@@ -20,12 +29,59 @@ desisim API
2029
.. automodule:: desisim.pixsim
2130
:members:
2231

32+
.. automodule:: desisim.qso_template
33+
:members:
34+
35+
.. This is not even a proper module, just a script dumped here.
36+
.. .. automodule:: desisim.qso_template.boss_qsos_figs
37+
.. :members:
38+
39+
.. automodule:: desisim.qso_template.desi_qso_templ
40+
:members:
41+
42+
.. automodule:: desisim.qso_template.fit_boss_qsos
43+
:members:
44+
45+
.. automodule:: desisim.qso_template.qso_pca
46+
:members:
47+
48+
.. This is not even a proper module, just a script dumped here.
49+
.. .. automodule:: desisim.qso_template.run_qso_fits
50+
.. :members:
51+
52+
.. automodule:: desisim.qso_template.tests
53+
:members:
54+
2355
.. automodule:: desisim.quickcat
2456
:members:
2557

2658
.. automodule:: desisim.quicksurvey
2759
:members:
2860

61+
.. automodule:: desisim.scripts
62+
:members:
63+
64+
.. automodule:: desisim.scripts.brightsims
65+
:members:
66+
67+
.. automodule:: desisim.scripts.pixsim
68+
:members:
69+
70+
.. automodule:: desisim.scripts.quickgen
71+
:members:
72+
73+
.. automodule:: desisim.spec_qa
74+
:members:
75+
76+
.. automodule:: desisim.spec_qa.high_level
77+
:members:
78+
79+
.. automodule:: desisim.spec_qa.redshifts
80+
:members:
81+
82+
.. automodule:: desisim.specsim
83+
:members:
84+
2985
.. automodule:: desisim.targets
3086
:members:
3187

doc/changes.rst

+9-7
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,24 @@ desisim change log
55
0.18.2 (unreleased)
66
-------------------
77

8-
* No changes yet
8+
* Fixed a number of documentation errors (`PR #224`_).
9+
10+
.. _`PR #224`: https://github.com/desihub/desisim/pull/224
911

1012
0.18.1 (2016-03-05)
1113
-------------------
1214

13-
* update desisim.module to use DESI_BASIS_TEMPLATES v2.3
15+
* Update ``desisim.module`` to use :envvar:`DESI_BASIS_TEMPLATES` v2.3.
1416

1517
0.18.0 (2016-03-04)
1618
-------------------
1719

18-
* pixsims add new required keywords DOSVER, FEEVER, DETECTOR
19-
* small bug fixes in quickcat; drop unused truth,targets columns to save memory
20-
in quicksurvey loop (PRs #198, #199)
20+
* pixsims add new required keywords DOSVER, FEEVER, DETECTOR.
21+
* Small bug fixes in quickcat; drop unused truth,targets columns to save memory
22+
in quicksurvey loop (PRs #198, #199).
2123
* quickgen update to support white dwarf templates (PR #204)
2224
* several enhancements of the templates code
23-
25+
2426
* optionally output rest-frame templates (PR #208)
2527
* rewrite of lya_spectra to achieve factor of 10 speedup; use COSMO
2628
(astropy.cosmology setup) as a new optional keyword for qso_desi_templates;
@@ -34,7 +36,7 @@ desisim change log
3436
-------------------
3537

3638
* Fix bug when obsconditions contain tiles that don't overlap catalog
37-
* Add surveysim --start_epoch option
39+
* Add ``surveysim --start_epoch`` option
3840

3941
0.17.0 (2016-12-02)
4042
-------------------

doc/conf.py

+14-3
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,23 @@
133133
# This value contains a list of modules to be mocked up. This is useful when
134134
# some external dependencies are not met at build time and break the
135135
# building process.
136-
autodoc_mock_imports = ['desimodel.focalplane', 'desimodel.io',
137-
'desispec.cosmics', 'desispec.image',
136+
autodoc_mock_imports = ['astropy.constants', 'astropy.cosmology',
137+
'astropy.io', 'astropy.stats',
138+
'astropy.table', 'astropy.units',
139+
'desimodel.focalplane', 'desimodel.io',
140+
'desispec.cosmics', 'desispec.frame',
141+
'desispec.fiberflat', 'desispec.fluxcalibration',
142+
'desispec.image',
138143
'desispec.io', 'desispec.io.fibermap', 'desispec.io.util',
139144
'desispec.interpolation', 'desispec.log',
145+
'desispec.resolution', 'desispec.sky',
140146
'desitarget.mtl', 'desitarget.targets',
141-
'desitarget.targetmask']
147+
'desitarget.targetmask',
148+
'matplotlib', 'matplotlib.backends',
149+
'matplotlib.backends.backend_pdf', 'matplotlib.gridspec',
150+
'numpy', 'scipy', 'scipy.constants',
151+
'scipy.interpolate', 'scipy.special',
152+
'specsim.simulator']
142153

143154
# -- Options for HTML output ----------------------------------------------
144155

py/desisim/batch/__init__.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
"""
2+
desisim.batch
3+
=============
4+
5+
Batch scripts. Why exactly is this sub-package different from
6+
:mod:`desisim.scripts`?
7+
"""
18
from __future__ import absolute_import, division, print_function
29
import math
310

@@ -11,7 +18,7 @@ def calc_nodes(ntasks, tasktime, maxtime):
1118
'''
1219
#- number of tasks that can be serially run within maxtime
1320
n = int(maxtime / tasktime)
14-
21+
1522
nodes = max(4, int(math.ceil(ntasks / n)))
1623
runtime = math.ceil(ntasks / nodes) * tasktime
1724
_log.debug('Requesting {} nodes for {} tasks'.format(nodes, ntasks, runtime))

py/desisim/batch/pixsim.py

+23-20
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
'''
2+
desisim.batch.pixsim
3+
====================
4+
25
Provides utility functions for batch processing of pixel-level simulations at
36
NERSC. This is a temporary pragmatic package -- after desispec.pipeline code
47
is merged and vetted, this should use that infrastructure for more rigorous
@@ -46,10 +49,10 @@ def batch_newexp(batchfile, flavors, nspec=5000, night=None, expids=None,
4649

4750
if night is None:
4851
night = obs.get_night()
49-
52+
5053
if expids is None:
5154
expids = obs.get_next_expid(nexp)
52-
55+
5356
if nodes is None:
5457
nodes = calc_nodes(nexp, tasktime=1.5, maxtime=20)
5558

@@ -67,23 +70,23 @@ def batch_newexp(batchfile, flavors, nspec=5000, night=None, expids=None,
6770
obs.update_obslog(obstype='science', program='gray', tileid=t)
6871
else:
6972
obs.update_obslog(obstype='science', program='dark', tileid=t)
70-
73+
7174
if pixprod is None:
7275
if 'PIXPROD' in os.environ:
7376
pixprod = os.environ['PIXPROD']
7477
else:
7578
raise ValueError('must provide pixprod or set $PIXPROD')
76-
79+
7780
if desi_spectro_sim is None:
7881
if 'DESI_SPECTRO_SIM' in os.environ:
7982
desi_spectro_sim = os.environ['DESI_SPECTRO_SIM']
8083
else:
8184
raise ValueError('must provide desi_spectro_sim or set $DESI_SPECTRO_SIM')
82-
85+
8386
log.info('output dir {}/{}/{}'.format(desi_spectro_sim, pixprod, night))
84-
87+
8588
assert len(expids) == len(flavors)
86-
89+
8790
cmd = "srun -n 1 -N 1 -c $nproc /usr/bin/time newexp-desi --night {night} --nspec {nspec} --flavor {flavor} --expid {expid} --tileid {tileid} --seed {seed}"
8891
with open(batchfile, 'w') as fx:
8992
fx.write("#!/bin/bash -l\n\n")
@@ -93,26 +96,26 @@ def batch_newexp(batchfile, flavors, nspec=5000, night=None, expids=None,
9396
fx.write("#SBATCH --time={}\n".format(timestr))
9497
fx.write("#SBATCH --job-name=newexp\n")
9598
fx.write("#SBATCH --output={}\n".format(logfile))
96-
99+
97100
fx.write("if [ ${NERSC_HOST} = edison ]; then\n")
98101
fx.write(" nproc=24\n")
99102
fx.write("else\n")
100103
fx.write(" nproc=32\n")
101104
fx.write("fi\n\n")
102-
105+
103106
fx.write('export DESI_SPECTRO_SIM={}\n'.format(desi_spectro_sim))
104107
fx.write('export PIXPROD={}\n'.format(pixprod))
105108
fx.write('\n')
106109
fx.write('echo Starting at `date`\n\n')
107-
110+
108111
fx.write('mkdir -p $DESI_SPECTRO_SIM/$PIXPROD/etc\n')
109112
fx.write('mkdir -p $DESI_SPECTRO_SIM/$PIXPROD/{}\n'.format(night))
110113
fx.write('\n')
111-
114+
112115
for expid, flavor, tileid, seed in zip(expids, flavors, tileids, seeds):
113116
fx.write(cmd.format(nspec=nspec, night=night, expid=expid,
114117
flavor=flavor, tileid=tileid, seed=seed)+' &\n')
115-
118+
116119
fx.write('\nwait\n')
117120
fx.write('\necho Done at `date`\n')
118121

@@ -134,7 +137,7 @@ def batch_pixsim(batchfile, flavors, nspec=5000, night=None, expids=None,
134137

135138
if night is None:
136139
night = obs.get_night()
137-
140+
138141
if expids is None:
139142
expids = obs.get_next_expid(nexp)
140143

@@ -145,7 +148,7 @@ def batch_pixsim(batchfile, flavors, nspec=5000, night=None, expids=None,
145148
pixprod = os.environ['PIXPROD']
146149
else:
147150
raise ValueError('must provide pixprod or set $PIXPROD')
148-
151+
149152
if desi_spectro_sim is None:
150153
if 'DESI_SPECTRO_SIM' in os.environ:
151154
desi_spectro_sim = os.environ['DESI_SPECTRO_SIM']
@@ -158,7 +161,7 @@ def batch_pixsim(batchfile, flavors, nspec=5000, night=None, expids=None,
158161
if nodes is None:
159162
# nodes = calc_nodes(ntasks, tasktime=5, maxtime=20)
160163
nodes = nexp * nspectrographs
161-
164+
162165
cmd = "srun -n {nspectrographs} -N {nspectrographs} -c $nproc /usr/bin/time pixsim-desi --mpi --verbose --cosmics --night {night} --expid {expid} --seed {seed}"
163166
with open(batchfile, 'w') as fx:
164167
fx.write("#!/bin/bash -l\n\n")
@@ -174,20 +177,20 @@ def batch_pixsim(batchfile, flavors, nspec=5000, night=None, expids=None,
174177
fx.write("else\n")
175178
fx.write(" nproc=32\n")
176179
fx.write("fi\n\n")
177-
180+
178181
fx.write('export DESI_SPECTRO_SIM={}\n'.format(desi_spectro_sim))
179182
fx.write('export PIXPROD={}\n'.format(pixprod))
180183

181184
fx.write('\necho Starting at `date`\n')
182185

183186
for expid, flavor, seed in zip(expids, flavors, seeds):
184187
fx.write('\n#- Exposure {} ({})\n'.format(expid, flavor))
185-
188+
186189
cx = cmd.format(night=night, expid=expid, nspectrographs=nspectrographs, seed=seed)
187190
fx.write(cx + ' &\n')
188-
191+
189192
fx.write('\nwait\n')
190-
193+
191194
fx.write('\n#- Preprocess raw data\n')
192195
cmd = 'srun -n 1 -N 1 desi_preproc --infile {infile} --outdir {outdir} --cameras {cameras}'
193196
outdir = os.path.join(desi_spectro_sim, pixprod, night)
@@ -197,6 +200,6 @@ def batch_pixsim(batchfile, flavors, nspec=5000, night=None, expids=None,
197200
cameras = 'b{},r{},z{}'.format(i,i,i)
198201
cx = cmd.format(infile=infile, outdir=outdir, cameras=cameras)
199202
fx.write(cx+' &\n')
200-
203+
201204
fx.write('\nwait\n')
202205
fx.write('echo Done at `date`\n')

py/desisim/cosmology.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
"""
2-
All cosmology related routines of desisim should be put here for consistency
2+
desisim.cosmology
3+
=================
4+
5+
All cosmology related routines of desisim should be put here for consistency.
36
"""
47

58

69
import astropy.cosmology
710

811
# Fiducial cosmology is defined here
912
# It is LCDM , without neutrinos
10-
fiducial_cosmology=astropy.cosmology.FlatLambdaCDM(H0=100,Om0=0.3)
11-
13+
try:
14+
fiducial_cosmology=astropy.cosmology.FlatLambdaCDM(H0=100,Om0=0.3)
15+
except TypeError:
16+
#
17+
# TypeError will be thrown during Sphinx documentation builds
18+
# because the astropy.cosmology module is mocked up.
19+
#
20+
pass

py/desisim/io.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"""
2+
desisim.io
3+
==========
4+
25
I/O routines for desisim
36
"""
47

@@ -570,7 +573,7 @@ def read_basis_templates(objtype, subtype='', outwave=None, nspec=None,
570573
wavelengths outwave.
571574
572575
Args:
573-
576+
574577
objtype (str): object type to read (e.g., ELG, LRG, QSO, STAR, FSTD, WD,
575578
MWS_STAR, BGS).
576579
subtype (str, optional): template subtype, currently only for white
@@ -616,7 +619,7 @@ def read_basis_templates(objtype, subtype='', outwave=None, nspec=None,
616619
log.warning('Unrecognized white dwarf subtype {}!'.format(subtype))
617620
else:
618621
meta = meta[keep]
619-
622+
620623
return meta
621624

622625
log.info('Reading {}'.format(infile))

0 commit comments

Comments
 (0)