Skip to content

Commit

Permalink
re #6669 sorted another missing import
Browse files Browse the repository at this point in the history
  • Loading branch information
NickDraper committed Mar 15, 2013
1 parent 00cafae commit b93af3e
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import bisect
from mantid.api import * # PythonAlgorithm, registerAlgorithm, WorkspaceProperty
from mantid.kernel import * # StringArrayProperty
from mantid.simpleapi import * # needed for Load

class LoadLogPropertyTable(PythonAlgorithm):
# same concept as built in "CreateLogPropertyTable" but loads its own workspaces and needn't hold all in memory at once
Expand Down Expand Up @@ -61,20 +62,21 @@ def getGeneralLogValue(self,ws,name,begin):
for tt in v.times:
times2.append((datetime.datetime(*(time.strptime(str(tt),"%Y-%m-%dT%H:%M:%S")[0:6]))-begin).total_seconds())
except:
print "probably not a time series"
#print "probably not a time series"
pass

if(name[0:8]=="Beamlog_" and (name.find("Counts")>0 or name.find("Frames")>0)):
print "Beamlog times array ",times2
i=bisect.bisect_right(times2,2) # allowance for "slow" clearing of DAE
print "returning max beam log, list cut 0:",i,":",len(times2)
#print "returning max beam log, list cut 0:",i,":",len(times2)
return (numpy.amax(v.value[i:]),True,numpy.amax(v.value[:i]))
print "class check: ",v.__class__.__name__
#print "class check: ",v.__class__.__name__
if(v.__class__.__name__ =="TimeSeriesProperty_dbl" or v.__class__.__name__ =="FloatTimeSeriesProperty"):
print "SE log times array ",times2
i=bisect.bisect_left(times2,0)
print "returning averaged time series"
#print "returning averaged time series"
return (numpy.average(v.value[i:]),False,0)
print "returning hopefully single value, ",v.value
#print "returning hopefully single value, ",v.value
return (v.value,False,0)

def PyExec(self):
Expand Down Expand Up @@ -126,7 +128,7 @@ def PyExec(self):
#check if the ws is a group
ws = loadedWs
if (ws.id() == 'WorkspaceGroup'):
print "Loaded file is multiperiod; Logs will be from the first period, but unfilterd"
print "Multiperiod File: Logs will be from the first period, but unfiltered. ",
ws=ws[0]

begin=datetime.datetime(*(time.strptime(ws.getRun().getProperty("run_start").value,"%Y-%m-%dT%H:%M:%S")[0:6])) # start of day
Expand All @@ -148,7 +150,7 @@ def PyExec(self):
if(lval>ows.cell(cc,ff-firstnum-1)):
ows.setCell(cc,ff-firstnum-1,lval)
ows.addRow(vallist)
print "finished file ",thispath
print "Finished file ",thispath
DeleteWorkspace(loadedWs)


Expand Down

0 comments on commit b93af3e

Please sign in to comment.