ATLAS Offline Software
Loading...
Searching...
No Matches
python.DetStatusLib.StatusList Class Reference
Collaboration diagram for python.DetStatusLib.StatusList:

Public Member Functions

 __init__ (self)
 merge (self, mobj, override=False)
 compress (self)
 size (self)
 list (self)
 __str__ (self)

Protected Attributes

list _seq = []

Detailed Description

Definition at line 188 of file DetStatusLib.py.

Constructor & Destructor Documentation

◆ __init__()

python.DetStatusLib.StatusList.__init__ ( self)

Definition at line 190 of file DetStatusLib.py.

190 def __init__(self):
191 "Initialise to empty sequence"
192 # sequence stores the detector status in time order
193 self._seq=[]
194

Member Function Documentation

◆ __str__()

python.DetStatusLib.StatusList.__str__ ( self)

Definition at line 282 of file DetStatusLib.py.

282 def __str__(self):
283 "Print representation of StatusList"
284 rep=''
285 for i in self._seq:
286 rep+='[%i %i] : %i %6.3f %6.3f %s\n' % (i.start,i.stop,i.code,i.deadfrac,i.thrust,i.comment)
287 return rep

◆ compress()

python.DetStatusLib.StatusList.compress ( self)

Definition at line 255 of file DetStatusLib.py.

255 def compress(self):
256 "Compress StatusList removing redundant entries with IoVs which can be combined"
257 ix=1
258 while (ix<len(self._seq)):
259 # check if payload of this entry is same as previous
260 # and start/stop times match without any gap
261 if (self._seq[ix].start==self._seq[ix-1].stop and
262 self._seq[ix].code==self._seq[ix-1].code and
263 self._seq[ix].deadfrac==self._seq[ix-1].deadfrac and
264 self._seq[ix].thrust==self._seq[ix-1].thrust and
265 self._seq[ix].nconfig==self._seq[ix-1].nconfig and
266 self._seq[ix].nworking==self._seq[ix-1].nworking and
267 self._seq[ix].comment==self._seq[ix-1].comment):
268 self._seq[ix].updateStart(self._seq[ix-1].start)
269 self._seq[ix-1:]=self._seq[ix:]
270 else:
271 ix+=1
272 return len(self._seq)
273

◆ list()

python.DetStatusLib.StatusList.list ( self)

Definition at line 278 of file DetStatusLib.py.

278 def list(self):
279 "Return the list itself"
280 return self._seq
281

◆ merge()

python.DetStatusLib.StatusList.merge ( self,
mobj,
override = False )

Definition at line 195 of file DetStatusLib.py.

195 def merge(self,mobj,override=False):
196 "Merge the given StatusObj into the list, ANDing (default) or override"
197 if (mobj.start>=mobj.stop):
198 return
199 # loop over the list, looking for places affected by the new obj
200 ix=0
201 oldstop=0
202 while (ix<len(self._seq)):
203 # first check for a gap between current and previous object
204 # where a new object has to be inserted
205 if (mobj.start<self._seq[ix].start and mobj.stop>oldstop):
206 # calculate extent of object to insert
207 nstart=max(oldstop,mobj.start)
208 nstop=min(self._seq[ix].start,mobj.stop)
209 # only insert if gap is of non-zero length
210 if (nstop>nstart):
211 # insert the new object at this position
212 self._seq.insert(ix,StatusObj(nstart,nstop,mobj.code,mobj.deadfrac,mobj.thrust,mobj.nconfig,mobj.nworking,mobj.comment))
213 ix+=1
214 # now check if object intersects current one
215 if (mobj.start<self._seq[ix].stop and mobj.stop>self._seq[ix].start):
216 # use mobj if override set or
217 # (new status is <= existing and new is not undefined) or
218 # old is undefined
219 if (override or
220 (mobj.code<=self._seq[ix].code and mobj.code!=0) or
221 (self._seq[ix].code==0)):
222 # record existing status for splitting
223 ecode=self._seq[ix].code
224 edeadfrac=self._seq[ix].deadfrac
225 ethrust=self._seq[ix].thrust
226 enconfig=self._seq[ix].nconfig
227 enworking=self._seq[ix].nworking
228 ecomment=self._seq[ix].comment
229 estart=self._seq[ix].start
230 estop=self._seq[ix].stop
231 # position where status will be updated
232 iy=ix
233 if (mobj.start>estart):
234 # need to split at front
235 self._seq.insert(ix,StatusObj(estart,mobj.start,ecode,edeadfrac,ethrust,enconfig,enworking,ecomment))
236 ix+=1
237 iy+=1
238 if (mobj.stop<estop):
239 # need to split at end
240 self._seq.insert(ix+1,StatusObj(mobj.stop,estop,ecode,edeadfrac,ethrust,enconfig,enworking,ecomment))
241 ix+=1
242 # now update entry at iy with new status
243 self._seq[iy]=StatusObj(max(mobj.start,estart),min(mobj.stop,estop),mobj.code,mobj.deadfrac,mobj.thrust,mobj.nconfig,mobj.nworking,mobj.comment)
244 # move on to next object
245 oldstop=self._seq[ix].stop
246 ix+=1
247 # check if merged object extends over end of current list
248 # may not have processed the whole list in the loop
249 if (len(self._seq)>0):
250 oldstop=self._seq[-1].stop
251 if (mobj.stop>oldstop):
252 nstart=max(oldstop,mobj.start)
253 self._seq+=[StatusObj(nstart,mobj.stop,mobj.code,mobj.deadfrac,mobj.thrust,mobj.nconfig,mobj.nworking,mobj.comment)]
254
#define min(a, b)
Definition cfImp.cxx:40
#define max(a, b)
Definition cfImp.cxx:41
Definition merge.py:1

◆ size()

python.DetStatusLib.StatusList.size ( self)

Definition at line 274 of file DetStatusLib.py.

274 def size(self):
275 "Return size of list"
276 return len(self._seq)
277

Member Data Documentation

◆ _seq

python.DetStatusLib.StatusList._seq = []
protected

Definition at line 193 of file DetStatusLib.py.


The documentation for this class was generated from the following file: