def setX3(self, X3): "Sets self's X3 value and self's header X3 value to X3." self.checkHeader(2) self.X3 = X3 self.h[1] = self.h[1][:45] + endlmisc.headerFunkyDouble2String( X3) + self.h[1][56:]
def setX4(self, X4): "Sets self's X4 value and self's header X4 value to X4." self.checkHeader(2) self.X4 = X4 self.h[1] = self.h[1][:57] + endlmisc.headerFunkyDouble2String( X4) + self.h[1][68:]
def setX1(self, X1): "Sets self's X1 value and self's header X1 value to X1." self.checkHeader(2) self.X1 = X1 self.h[1] = self.h[1][:21] + endlmisc.headerFunkyDouble2String( X1) + self.h[1][32:]
def setX2(self, X2): "Sets self's X2 value and self's header X2 value to X2." self.checkHeader(2) self.X2 = X2 self.h[1] = self.h[1][:33] + endlmisc.headerFunkyDouble2String( X2) + self.h[1][44:]
def setTemperature(self, T): "Sets self's Temperature value and self's header Temperature value to T." self.checkHeader(1) self.Temperature = T self.h[0] = self.h[0][:59] + endlmisc.headerFunkyDouble2String( T) + self.h[0][70:]
def setQ(self, Q): "Sets self's Q value and self's header Q value to Q." self.checkHeader(2) self.Q = Q self.h[1] = self.h[1][:9] + endlmisc.headerFunkyDouble2String( Q) + self.h[1][20:]
def setMass(self, Mass): "Sets self's Mass value and self's header Mass value to Mass." self.checkHeader(1) self.Mass = Mass self.h[0] = self.h[0][:13] + endlmisc.headerFunkyDouble2String( Mass) + self.h[0][24:]
def setHalflife(self, Halflife): "Sets self's Halflife value and self's header Halflife value to Halflife." self.checkHeader(1) self.Halflife = Halflife self.h[0] = self.h[0][:47] + endlmisc.headerFunkyDouble2String( Halflife) + self.h[0][58:]
def setELevel(self, ELevel): "Sets self's ELevel value and self's header ELevel value to ELevel." self.checkHeader(1) self.ELevel = ELevel self.h[0] = self.h[0][:35] + endlmisc.headerFunkyDouble2String( ELevel) + self.h[0][46:]
def addData(self, data=[], date=None, interpolation=0, eLevel=0., temperature=2.586e-8, Q=None, X1=0., X2=0., X3=0., X4=0., mass=None, halflife=None): """Adds data to self with the header information provided.""" i = 0 for l in self.levels: c = l.compareQXs(Q, X1, X2, X3, X4) if (c == 0): raise Exception( "\nError in endlFile.addData: data already exist for X1 = %e, X2 = %e, X3 = %e, X4 = %e, Q = %e" % (X1, X2, X3, X4, l.Q)) elif (c > 0): break i += 1 if (Q == None): Q = 0. if (len(self.levels) > 0): Q = self.levels[0].Q if (date == None): date = time.localtime(time.time()) date = 10000 * (date[0] - 2000) + 100 * date[1] + date[2] if (type(date) == type(1)): date = "%.6d" % date if (mass == None): mass = self.bdflsFile.mass(self.ZA) if (mass == None): raise Exception( "\nError in endlFile.addData: bdfls file does not have mass for ZA = %d" % self.ZA) mass = endlmisc.headerFunkyDouble2String(mass) if (halflife == None): halflife = self.bdflsFile.halflife(self.ZA) if (halflife == None): halflife = self.halflife if (halflife == None): raise Exception( "\nError in endlFile.addData: bdfls file does not have halflife for ZA = %d" % self.ZA) halflife = endlmisc.headerFunkyDouble2String(halflife) h = [ "%6d %2d %2d %s %6s%1d12 %s %s %s\n" % (self.ZA, self.yi, self.yo, mass, date, interpolation, endlmisc.headerFunkyDouble2String(eLevel), halflife, endlmisc.headerFunkyDouble2String(temperature)), "%2d%3d%3d %s %s %s %s %s\n" % (self.C, self.I, self.S, endlmisc.headerFunkyDouble2String(Q), endlmisc.headerFunkyDouble2String(X1), endlmisc.headerFunkyDouble2String(X2), endlmisc.headerFunkyDouble2String(X3), endlmisc.headerFunkyDouble2String(X4)) ] # # ???? Need to check that data is proper type of data. # d = endlIClasses.endlAddIObject(None, self.yo, self.C, self.I, self.S, h, data, bdflsFile=self.bdflsFile) self.levels.insert(i, d) return self.levels[i]