Skip to content

Commit

Permalink
Add option to specify the specsim config
Browse files Browse the repository at this point in the history
  • Loading branch information
dkirkby committed Mar 7, 2016
1 parent 233fefb commit 359fae0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion bin/quickbrick
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ parser.add_option("-b", "--brickname", type=str, help="brickname")
parser.add_option( "--objtype", type=str, help="elg,lrg,qso,star or mix")
parser.add_option("-n", "--nspec", type=int, help="number of spectra to simulate")
parser.add_option("-o", "--outdir", type=str, help="output data directory; default .", default='.')
parser.add_option("--config", type=str, help="specsim configuration", default="desi")
#- Average DESI airmass 1.25; (See Science Req. Doc L3.3.2)
parser.add_option("-a", "--airmass", type=float, help="airmass [%default]", default=1.25)
parser.add_option("-t", "--testwavelength", type=float, help="test quickbrick with a single emission line", default=None)
Expand All @@ -53,7 +54,7 @@ assert opts.objtype in ['ELG', 'LRG', 'QSO', 'STAR', 'TEST', 'MIX']
random_state = np.random.RandomState(opts.seed)

#- Initialize the quick simulator object
qsim = specsim.simulator.Simulator('desi')
qsim = specsim.simulator.Simulator(opts.config)
qsim.atmosphere.airmass = opts.airmass
qsim.instrument.exposure_time = desiparams['exptime'] * u.s

Expand Down
5 changes: 3 additions & 2 deletions bin/quickgen
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ parser.add_argument("--fibermap",type=str, help='input fibermap file')
parser.add_argument("--nspec",type=int,default=5000,help='no. of spectra to be simulated, starting from first')
parser.add_argument("--nstart", type=int, default=0,help='starting spectra # for simulation 0-4999')
parser.add_argument("--spectrograph",type=int, default=None,help='Spectrograph no. 0-9')
parser.add_argument("--config", type=str, default='desi', help='specsim configuration')
parser.add_argument("--seed", type=int, default=0, help="random seed")
args = parser.parse_args()

Expand Down Expand Up @@ -140,8 +141,8 @@ print "Simulating spectra",args.nstart, "to", nmax

print "************************************************"

print "Initializing SpecSim"
qsim = specsim.simulator.Simulator('desi')
print "Initializing SpecSim with config '{0}'".format(args.config)
qsim = specsim.simulator.Simulator(args.config)

# Set simulation parameters from the simspec header.
qsim.atmosphere.airmass = simspec.header['AIRMASS']
Expand Down

0 comments on commit 359fae0

Please sign in to comment.