def say(self, det=None): """print header/detector information""" if det is None: self.sayHeader() else: bin = self.detector[det] say("Bin : ", bin.nb) say("Title : ", bin.name) say("Type : ", bin.type) say("E : [", bin.elow, "-", bin.ehigh, "] x", bin.ne, "dx=", bin.de)
def say(self, det=None): """print header/detector information""" if det is None: self.sayHeader() else: bin = self.detector[det] say("Bin : ", bin.nb) say("Title : ", bin.name) say("Type : ", bin.type) say("Score : ", bin.score) say("X : [", bin.xlow, "-", bin.xhigh, "] x", bin.nx, "dx=", bin.dx) say("Y : [", bin.ylow, "-", bin.yhigh, "] x", bin.ny, "dy=", bin.dy) say("Z : [", bin.zlow, "-", bin.zhigh, "] x", bin.nz, "dz=", bin.dz) say("L : ", bin.lntzer) say("bk : ", bin.bk) say("b2 : ", bin.b2) say("tc : ", bin.tc)
def say(self, det=None): """print header/detector information""" if det is None: self.sayHeader() else: det = self.detector[det] say("BDX : ", det.nb) say("Title : ", det.name) say("Type : ", det.type) say("Dist : ", det.dist) say("Reg1 : ", det.reg1) say("Reg2 : ", det.reg2) say("Area : ", det.area) say("2way : ", det.twoway) say("Fluence: ", det.fluence) say("LowNeu : ", det.lowneu) say("Energy : [", det.elow, "..", det.ehigh, "] ne=", det.ne, "de=", det.de) if det.lowneu: say("LOWNeut : [", det.egroup[-1], "..", det.egroup[0], "] ne=", det.ngroup) say("Angle : [", det.alow, "..", det.ahigh, "] na=", det.na, "da=", det.da) say("Total : ", det.total, "+/-", det.totalerror)
def say(self, det=None): """print header/detector information""" if det is None: self.sayHeader() else: bin = self.detector[det] say("Bin : ", bin.nb) say("Title : ", bin.name) say("Type : ", bin.type) say("Region : ", bin.region) say("Volume : ", bin.volume) say("Mhigh : ", bin.mhigh) say("Zhigh : ", bin.zhigh) say("NMZmin : ", bin.nmzmin)
def sayHeader(self): say("File : ", self.file) say("Title : ", self.title) say("Time : ", self.time) say("Weight : ", self.weight) say("NCase : ", self.ncase) say("NBatch : ", self.nbatch)
return icode # ---------------------------------------------------------------------- def readSource(self, ncase, npflka, nstmax, tkesum, weipri): self.ncase = ncase self.npflka = npflka self.nstmax = nstmax self.tkesum = tkesum self.weipri = weipri data = fortran.read(self.hnd) if data is None: raise IOError("Invalid source event") fmt = "=" + ("i8f" * npflka) self.data = struct.unpack(fmt, data) return ncase # =============================================================================== if __name__ == "__main__": import sys say("=" * 80) usr = Usrbdx(sys.argv[1]) usr.say() for i, _ in enumerate(usr.detector): say("-" * 50) usr.say(i) data = unpackArray(usr.readData(i)) stat = unpackArray(usr.readStat(i))
if i < l and '0' <= str[i] <= '9': while i < l and '0' <= str[i] <= '9': i += 1 else: return False if i != l: return False return True if __name__ == "__main__": from pymchelper.flair.common.log import say say("abbrev") assert abbrev('information', 'info', 4) assert abbrev('information', '', 0) assert not abbrev('information', 'Info', 4) assert not abbrev('information', 'info', 5) assert not abbrev('information', 'info ') assert abbrev('information', 'info', 3) assert not abbrev('info', 'information', 3) assert not abbrev('info', 'info', 5) say("center") assert center('****', 0, '-') == '' assert center('****', 8, '-') == '--****--' assert center('****', 7, '-') == '-****--' assert center('*****', 8, '-') == '-*****--' assert center('*****', 7, '-') == '-*****-'
if i < length and '0' <= str[i] <= '9': while i < length and '0' <= str[i] <= '9': i += 1 else: return False if i != length: return False return True if __name__ == "__main__": from pymchelper.flair.common.log import say say("abbrev") assert abbrev('information', 'info', 4) assert abbrev('information', '', 0) assert not abbrev('information', 'Info', 4) assert not abbrev('information', 'info', 5) assert not abbrev('information', 'info ') assert abbrev('information', 'info', 3) assert not abbrev('info', 'information', 3) assert not abbrev('info', 'info', 5) say("center") assert center('****', 0, '-') == '' assert center('****', 8, '-') == '--****--' assert center('****', 7, '-') == '-****--' assert center('*****', 8, '-') == '-*****--' assert center('*****', 7, '-') == '-*****-'