Skip to content

Commit

Permalink
Refs #8549. Working on Latest_isis_runs
Browse files Browse the repository at this point in the history
As the scientists don't seem interested in other cycles, the latest_isis_runs script is bieng altered to return a list rather than a map
  • Loading branch information
keithnbrown committed Dec 5, 2013
1 parent c963574 commit c583d2a
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions Code/Mantid/scripts/Reflectometry/isis_reflgui/latest_isis_runs.py
Expand Up @@ -28,18 +28,19 @@ def __init__(self, instrument):
print "DataMountPoint is missing from the config.xml file."
raise

self.__cycleMap = self.makeMappings(firstonly = True)
self.__cycleMap = self.makeList()
print self.__cycleMap

def __make_map_entry(self, map, element, base_path, instr_path):
def __list(self, list, element, base_path, instr_path):
journal_file = element.attrib.get('name')
journal_path = os.path.join(base_path, journal_file)
cycle_id = self.__findCycleId(journal_path)
cycle = 'cycle_'+ cycle_id
cycle_dir_path = os.path.join(instr_path, 'data', cycle)
map[cycle] = journal_path, cycle_dir_path
list = journal_path, cycle_dir_path
self.__most_recent_cycle = cycle

def makeMappings(self, firstonly = False):
def makeMappings(self):
instr_path = os.path.join(self.__mountpoint, 'NDX'+ self.__instrument, 'Instrument')
self.__checkPath(instr_path)

Expand All @@ -48,15 +49,11 @@ def makeMappings(self, firstonly = False):

path = os.path.join(base_path, 'journal_main.xml')
tree = xml.parse(path)
map = dict()
list = []

dom = tree.getroot()
if firstonly:
self.__make_map_entry(map, dom[-1], base_path, instr_path)
else:
for elem in dom:
self.__make_map_entry(map, elem, base_path, instr_path)
return map
self.__list(list, dom[-1], base_path, instr_path)
return list

def getLatestCycle(self):
return self.__most_recent_cycle
Expand All @@ -77,8 +74,12 @@ def getCycles(self):
def __findCycleId(self, path):
tree = xml.parse(path)
root = tree.getroot()
print root.tag
for run in root:
print run.tag
for elem in run:
print elem.tag
print elem.tag.split('}')
if elem.tag.split('}')[-1] == 'isis_cycle':
return elem.text

Expand Down

0 comments on commit c583d2a

Please sign in to comment.