def average(self,t1=<NUM_LIT:0>,t2=None,setsweep=False):
if setsweep:<EOL><INDENT>self.setsweep(setsweep)<EOL><DEDENT>if t2 is None or t2>self.sweepLength:<EOL><INDENT>t2=self.sweepLength<EOL>self.log.debug("<STR_LIT>",t2)<EOL><DEDENT>t1=max(t1,<NUM_LIT:0>)<EOL>if t1>t2:<EOL><INDENT>self.log.error("<STR_LIT>")<EOL>return False<EOL><DEDENT>I1,I2=int(t1*self.pointsPerSec),int(t2*self.pointsPerSec)<EOL>if I1==I2:<EOL><INDENT>return np.nan<EOL><DEDENT>return np.average(self.sweepY[I1:I2])<EOL>
return the average of part of the current sweep.