Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactored newexp (again) #250

Merged
merged 60 commits into from
Aug 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
d710ae3
new simspec io
sbailey Apr 12, 2017
f02607c
metadata I/O update
sbailey Apr 17, 2017
87e1f22
fix quickgen merge conflict
Jul 26, 2017
5dbb326
fix simspec flux units
sbailey Apr 19, 2017
ceb80ba
newexp-desi working again
sbailey Apr 20, 2017
876ce1e
checkpoint
sbailey Apr 21, 2017
e14f35d
checkpoint
sbailey Apr 21, 2017
278ed3b
more cleanup; checkpoint
sbailey Apr 21, 2017
160b1fc
checkpoint while fixing unit tests
sbailey Apr 23, 2017
b97ca64
tests finally pass
sbailey Apr 23, 2017
90d9cea
fix simplest case of simulate_spectra use
sbailey Apr 24, 2017
ef22b11
fix sphinx build for astropy.time
sbailey Apr 24, 2017
3c90eea
requires specsim master for tests
sbailey Apr 24, 2017
6503043
fix YEARMMDD night vs. UTC
Apr 27, 2017
ec4d65c
fix FLAVOR keyword in fibermap
sbailey Apr 27, 2017
5ebbec3
fix quickgen fiberflat var vs. ivar bug
Apr 28, 2017
b8d7e88
continued refactor
sbailey May 2, 2017
f027aad
add +x to bin/mpi-newexp permissions
sbailey May 2, 2017
ba1601d
bug fixes for MPI wrappers; getting closer...
May 5, 2017
3f88594
add --outdir option for newarc and newflat
sbailey May 5, 2017
dc10ce6
fastframe gracefully skip arcs
sbailey May 5, 2017
feae85f
include CAMERA header keyword
May 13, 2017
0530518
fix fiberflat units
sbailey May 18, 2017
8753004
newexp fixes; WIP
May 30, 2017
6494fdb
fix missing datetime import
sbailey Jun 1, 2017
98c4921
new simspec io
sbailey Apr 12, 2017
62dcde6
metadata I/O update
sbailey Apr 17, 2017
fabda21
newexp -> quickgen handoff for science frames
sbailey Apr 19, 2017
e72d207
fix simspec flux units
sbailey Apr 19, 2017
90a29c5
newexp-desi working again
sbailey Apr 20, 2017
3918dbc
checkpoint
sbailey Apr 21, 2017
ad112c3
more cleanup; checkpoint
sbailey Apr 21, 2017
4fd921c
checkpoint while fixing unit tests
sbailey Apr 23, 2017
a1d9f40
tests finally pass
sbailey Apr 23, 2017
a200743
continued refactor
sbailey May 2, 2017
8e058b2
add +x to bin/mpi-newexp permissions
sbailey May 2, 2017
786809a
bug fixes for MPI wrappers; getting closer...
May 5, 2017
e06f617
add --outdir option for newarc and newflat
sbailey May 5, 2017
b31eb7d
fix missing datetime import
sbailey Jun 1, 2017
53a9140
fix bugs found by tests; fix tests too
sbailey Jun 5, 2017
b31c612
fix sphinx error but not formatting
sbailey Jun 6, 2017
3151cee
catch up with latest formats
Jul 18, 2017
d2112f8
add --dryrun and tile subset options to mpi-newexp and -fastframe
Jul 18, 2017
0938fec
updates for mpi-newexp
Jul 25, 2017
d313c2b
make MPI optional for newexp and fastframe wrappers
Jul 26, 2017
b861d88
revert to superset of old simspec format (almost)
Jul 26, 2017
030473c
back to tests working...
Jul 26, 2017
46401f9
re-enable testslit; obsconditions
Jul 26, 2017
1fea7de
cleanup
Jul 27, 2017
49c49bf
group by flavor to better balance MPI ranks
Jul 28, 2017
f83a497
renaming cleanup
Jul 28, 2017
d81ffd0
fix sphinx syntax
sbailey Jul 28, 2017
883a458
obs.new_exposure cleanup for previous usage
sbailey Jul 31, 2017
68a498d
partial fix for quickgen integration test
sbailey Aug 1, 2017
46e3b66
WIP; moving to NERSC for more testing
sbailey Aug 1, 2017
c22bbbe
asymptotically approaching cleanup
Aug 1, 2017
70e8b00
BGS fiberloss placeholder; hdr keywords
Aug 1, 2017
b082b40
fix obscond keywords for flat exp
Aug 1, 2017
fd878de
update changes.rst for PR #250
Aug 1, 2017
9529f90
work around astropy fits BinTableHDU bug
sbailey Aug 1, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ env:
- DESIMODEL_DATA=branches/test-0.7.0
- DESISIM_TESTDATA_VERSION=0.3.3
- SPECLITE_VERSION=0.5
- SPECSIM_VERSION=v0.9
- SPECSIM_VERSION=master
- SPECTER_VERSION=0.7.0
- DESISPEC_VERSION=master
- DESITARGET_VERSION=master
Expand Down
9 changes: 9 additions & 0 deletions bin/fastframe
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env python

"""
Let's try to make a faster frame maker than quickgen --frameonly
"""

import sys
from desisim.scripts import fastframe
sys.exit(fastframe.main())
9 changes: 9 additions & 0 deletions bin/newarc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env python

"""
Generate a new DESI arc calibration exposure
"""

import sys
from desisim.scripts.newarc import main
sys.exit(main())
114 changes: 0 additions & 114 deletions bin/newexp-desi

This file was deleted.

9 changes: 9 additions & 0 deletions bin/newexp-mock
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env python

"""
Generate a new DESI science exposure
"""

import sys
from desisim.scripts.newexp_mock import main
sys.exit(main())
9 changes: 9 additions & 0 deletions bin/newexp-random
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env python

"""
Generate a new DESI science exposure
"""

import sys
from desisim.scripts.newexp_random import main
sys.exit(main())
9 changes: 9 additions & 0 deletions bin/newflat
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env python

"""
Generate a new DESI arc calibration exposure
"""

import sys
from desisim.scripts.newflat import main
sys.exit(main())
File renamed without changes.
115 changes: 115 additions & 0 deletions bin/wrap-fastframe
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#!/usr/bin/env python

"""
MPI wrapper for fastframe
"""

#- Parse args first to enable --help from login node where MPI would crash
from __future__ import absolute_import, division, print_function
import argparse
parser=argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--outdir', type=str, help="output directory")
parser.add_argument('--clobber', action='store_true', help="overwrite any pre-existing output files")
parser.add_argument('--dryrun', action='store_true', help="print commands but don't run them")
parser.add_argument('--mpi', action='store_true', help="use MPI parallelism")
parser.add_argument('--start', type=str, help="start date YEARMMDD")
parser.add_argument('--stop', type=str, help="stop date YEARMMDD")
args = parser.parse_args()

#- Load MPI and establish communication
if args.mpi:
from mpi4py import MPI
comm = MPI.COMM_WORLD
size = comm.Get_size()
rank = comm.Get_rank()
else:
comm = None
size = 1
rank = 0

#- The proceed with other imports
import sys, os, glob, time
tstart = time.time()
import numpy as np

from astropy.io import fits
import astropy.time
from astropy.table import Table

import desisim.io
import desisim.scripts.fastframe

if args.start is None:
args.start = '11112233'
else:
args.start = args.start.replace('-', '')

if args.stop is None:
args.stop = '99998877'
else:
args.stop = args.stop.replace('-', '')

#- Assemble full list of simspec files; group by flavor to help MPI balancing
if rank == 0:
allfiles = sorted(glob.glob('{}/*/simspec*.fits'.format(desisim.io.simdir())))

#- TODO: check if outputs already exist

simspecfiles = list()
for filename in allfiles:
night = os.path.basename(os.path.split(filename)[0])
if (args.start <= night) & (night < args.stop):
flavor = fits.getval(filename, 'FLAVOR')
simspecfiles.append( (flavor, filename) )

simspecfiles = sorted(simspecfiles)
else:
simspecfiles = None

if comm is not None:
simspecfiles = comm.bcast(simspecfiles, root=0)

#- Proceed with simulating exposures, using all ranks

if rank == 0:
print('{} MPI ranks processing {}/{} exposures'.format(size, len(simspecfiles), len(allfiles)))

if rank < len(simspecfiles):
for flavor, filename in simspecfiles[rank::size]:
cmd = "fastframe --simspec {}".format(filename)
if args.outdir:
cmd = cmd + " --outdir {}".format(args.outdir)
if args.clobber:
cmd = cmd + " --clobber"

print('Rank {} running {}: {}'.format(rank, flavor, cmd))
sys.stdout.flush()
if args.dryrun:
continue

try:
t0 = time.time()
desisim.scripts.fastframe.main(cmd.split()[1:])
runtime = time.time() - t0
print("rank {} took {:.1f} seconds for {} frame".format(rank, runtime, flavor))
sys.stdout.flush()
except:
print('Rank {} FAILED {}: {}'.format(rank, flavor, cmd))
import traceback
traceback.print_exc()
sys.stdout.flush()

if comm is not None:
comm.barrier()

if rank == 0:
import collections
nflavor = collections.Counter([x[0] for x in simspecfiles])
tottime = time.time() - tstart
print('{:.1f} minutes for {} arc, {} flat, {} science exposures'.format(
tottime/60, nflavor['arc'], nflavor['flat'], nflavor['science']
))

if comm is not None:
MPI.Finalize()

Loading