Skip to content

Commit

Permalink
Add support for hfir instruments
Browse files Browse the repository at this point in the history
  • Loading branch information
peterfpeterson committed Nov 20, 2018
1 parent 1005f09 commit 105e437
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions scripts/finddata
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,19 @@ def getFileLoc(facility, instrument, runs):
########################################################################

if __name__ == "__main__":
FACILITY = {}
for facility in ['HFIR', 'SNS']:
instruments = getInstruments(facility, withLower=True)
for instrument in instruments:
FACILITY[instrument] = facility

# set up optparse
import argparse # for command line options
import argcomplete # for bash completion
parser = argparse.ArgumentParser(description="Find data files using ICAT")

parser.add_argument('inst', nargs='?', help='Specify the instrument name',
choices=getInstruments('SNS', withLower=True))
choices=FACILITY.keys())
parser.add_argument('runs', nargs='*',
help='Specify the run numbers')
parser.add_argument("-l", "--loglevel", dest="loglevel", default="WARNING",
Expand Down Expand Up @@ -212,6 +218,7 @@ if __name__ == "__main__":
sys.exit(0)

options.inst = options.inst.upper()
options.facility = FACILITY[options.inst]

# convert the run numbers into a list of integers
runnumbers = []
Expand All @@ -220,7 +227,7 @@ if __name__ == "__main__":

if options.listruns:
# is actual the proposal number
print(getRunsInProp('SNS', options.inst, options.listruns))
print(getRunsInProp(options.facility, options.inst, options.listruns))
sys.exit(0)

if len(runnumbers) <= 0:
Expand All @@ -230,13 +237,13 @@ if __name__ == "__main__":
if options.getproposal:
multiRun = (len(runnumbers) > 1)
for run in runnumbers:
result = getProposal('SNS', options.inst, run)
result = getProposal(options.facility, options.inst, run)
if multiRun:
print(run,)
print(result)
else:
runnumbers = list(set(runnumbers)) # get rid of duplicates
runnumbers.sort() # and put them in order

for location in getFileLoc('SNS', options.inst, runnumbers):
for location in getFileLoc(options.facility, options.inst, runnumbers):
print(location)

0 comments on commit 105e437

Please sign in to comment.