Skip to content

Commit

Permalink
Merge pull request #406 from DarkEnergyScienceCollaboration/Issue#402…
Browse files Browse the repository at this point in the history
…/CompleteWFDVisitsEarly

All WFD visits completed at the end of Run 3.1b
  • Loading branch information
drphilmarshall authored Nov 15, 2016
2 parents f7d8587 + d98818f commit 75eaf1e
Show file tree
Hide file tree
Showing 3 changed files with 258 additions and 121 deletions.
13 changes: 8 additions & 5 deletions bin/get_twinkles_visits.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@
import os
import argparse
import pandas as pd
from desc.twinkles import get_twinkles_visits
#from desc.twinkles import get_twinkles_visits
from desc.twinkles import OpSimOrdering
from lsst.utils import getPackageDir

parser = argparse.ArgumentParser(description="Write an ascii file of visits derived from an OpSim db file given a fieldID")
parser.add_argument('opsimDB', help='OpSim database sqlite file')
parser.add_argument('--fieldID', type=int, default=1427,
help='ID number of the desired field')
parser.add_argument('--outfile', type=str, default=None, help='output file')
help='ID number of the desired field, defaults to 1427')
parser.add_argument('--outfile', type=str, default=None, help='output file, defaults to twinkes_visits_fieldID_1427.txt')
parser.add_argument('--orderObsHistID', type=bool, default=True,
help='order obsHistIDs as decided for Twinkles 3')
help='order obsHistIDs as decided for Twinkles 3, defaults to True')
parser.add_argument('--RF_pickle_file', type=str, default=None,
help='absolute path for a pickle of a RandomForest Predictor of PhoSim Run times, defaults to None which effectively sets the variable to Twinkles/data/RF_pickle.p')
parser.add_argument('--maxPredTime', type=float, default=100.0,
help='max predicted phosim run time for the opsim record'
' in hours beyond which the record index obsHistID will '
'not be included')
'not be included, defaults to 100.')
args = parser.parse_args()

# output filename is common
Expand All @@ -44,6 +44,9 @@
with open(args.outfile, 'w') as output:
output.write('# Begin Section Twinkles 3.1\n')
ops.Twinkles_3p1.obsHistID.to_csv(args.outfile, index=False, mode='a')
with open(args.outfile, 'a') as output:
output.write('# Begin Section Twinkles 3.1b\n')
ops.Twinkles_3p1b.obsHistID.to_csv(args.outfile, index=False, mode='a')
with open(args.outfile, 'a') as output:
output.write('# Begin Section Twinkles 3.2\n')
ops.Twinkles_3p2.obsHistID.to_csv(args.outfile, index=False, mode='a')
Expand Down
Loading

0 comments on commit 75eaf1e

Please sign in to comment.