Skip to content

Commit

Permalink
fix start_epoch
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen Bailey authored and Stephen Bailey committed Dec 16, 2016
1 parent d7754ae commit a2c386f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion py/desisim/quicksurvey.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ def create_surveyfile(self, epoch):
tiles = np.concatenate(self.epoch_tiles[epoch:])
np.savetxt(surveyfile, tiles, fmt='%d')
print("{} tiles to be included in fiberassign".format(len(tiles)))
return len(tiles)

def create_fiberassign_input(self):
"""Creates input files for fiberassign from the provided template
Expand Down Expand Up @@ -292,9 +293,22 @@ def simulate(self):
if 'MOCKID' in truth.colnames:
truth.remove_column('MOCKID')

mtl=zcat=None
if self.start_epoch == 0:
mtl = zcat = None
else:
print('INFO: starting at epoch {}'.format(self.start_epoch))
print('INFO: reading mtl and zcat from previous epoch')
epochdir = os.path.join(self.output_path, str(self.start_epoch-1))
mtl = Table.read(os.path.join(epochdir, 'mtl.fits'))
zcat = Table.read(os.path.join(epochdir, 'zcat.fits'))

for epoch in self.epochs_list[self.start_epoch:]:
print('--- Epoch {} ---'.format(epoch))

ntiles = sum([len(x) for x in self.epoch_tiles[epoch:]])
if ntiles == 0:
print('INFO: no remaining tiles; ending simulation')
break

self.create_surveyfile(epoch)

Expand Down

0 comments on commit a2c386f

Please sign in to comment.