def __readHeader(self): input = self.__input input.seek(self.__start_of_header) line = input.readline() if not line: raise PrematureEndofData data = split(line) try: self["Branch number"] = atoi(data[0]) self["Point number"] = atoi(data[1]) self["Type number"] = atoi(data[2]) self["Type name"] = parseB.type_translation(self["Type number"])["short name"] self["Label"] = atoi(data[3]) self.__numChangingParameters = atoi(data[4]) self["ISW"] = atoi(data[5]) self.__numSValues = atoi(data[6]) self.__numEntriesPerBlock = atoi(data[7]) self.__numLinesPerEntry = atoi(data[8]) self["NTST"] = atoi(data[9]) self["NCOL"] = atoi(data[10]) if len(data) == 12: # This is the case for AUTO97 and beyond self.__numFreeParameters = atoi(data[11]) else: # This is the case for AUTO94 and before self.__numFreeParameters = NPAR except IndexError: raise PrematureEndofData self.__start_of_data = self.__input.tell()
def __getitem__(self, key): big_data_keys = ["data", "Active ICP", "rldot", "p", "udotps"] if (isinstance(key, str) and key not in self.coordnames and key != self.indepvarname and key not in self.__parnames): shortkey = self.long_data_keys.get(key, key) if shortkey in big_data_keys: self.__readAll() if shortkey in self.data_keys: if shortkey == "TY": return parseB.type_translation( self.data["TY number"])["short name"] return self.data[shortkey] if shortkey == "p": return self.PAR if shortkey == "data": return self if isinstance(key, str) and hasattr(self, "b") and key in self.b: if not self.__fullyParsed or not key in self.PAR: if key not in self.coordnames: return self.b[key] self.__readAll() if isinstance(key, str): try: return Points.Pointset.__getitem__(self, key) except: try: return self.PAR[key] except: return self.data[key] ret = Points.Pointset.__getitem__(self, key) if not isinstance(key, int): return ret return SLPoint(ret, self, key)
def type(self): return parseB.type_translation(self["Type number"])["long name"]