Skip to content

Commit

Permalink
re #6669 add missing import for numpy
Browse files Browse the repository at this point in the history
  • Loading branch information
NickDraper committed May 16, 2013
1 parent b93af3e commit c0233bc
Showing 1 changed file with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import datetime
import numbers
import bisect
import numpy
from mantid.api import * # PythonAlgorithm, registerAlgorithm, WorkspaceProperty
from mantid.kernel import * # StringArrayProperty
from mantid.simpleapi import * # needed for Load
Expand All @@ -44,9 +45,8 @@ def getGeneralLogValue(self,ws,name,begin):
# average time series over run
# for beamlog, etc return flag=true and value to push into previous run
if(name=="comment"):
print "returning comment string"
return (ws.getComment(),False,0)

try:
v=ws.getRun().getProperty(name)
except:
Expand All @@ -66,22 +66,16 @@ def getGeneralLogValue(self,ws,name,begin):
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)
return (numpy.amax(v.value[i:]),True,numpy.amax(v.value[:i]))
#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"
return (numpy.average(v.value[i:]),False,0)
#print "returning hopefully single value, ",v.value
return (v.value,False,0)

def PyExec(self):

#ws=self.getProperty("InputWS").value
file1=self.getProperty("FirstFile").value
file9=self.getProperty("LastFile").value
i1=file1.rindex('.')
Expand All @@ -102,8 +96,7 @@ def PyExec(self):
raise Exception("File numbering error")
if(lastnum < firstnum):
raise Exception("Run numbers must increase")
# runpaths.append(firstfn[:j]+str(n+firstnum).zfill(i-j)+firstfn[i:])


# table. Rows=runs, columns=logs (col 0 = run number)
collist=self.getProperty("LogNames").value
ows=WorkspaceFactory.createTable()
Expand Down Expand Up @@ -156,4 +149,4 @@ def PyExec(self):

self.setProperty("OutputWS",ows)

registerAlgorithm(LoadLogPropertyTable())
AlgorithmFactory.subscribe(LoadLogPropertyTable())

0 comments on commit c0233bc

Please sign in to comment.