rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
def __init__(self, map, dx, skip): self.dx=dx self.skip=skip self.attrName="curvChangeLin_%s_%s" % (self.dx,self.skip) self.attrName=self.attrName.translate(string.maketrans(".+-", "__n"))
def __init__(self, map):
def __init__(self, map, dx, skip): self.dx=dx self.skip=skip self.attrName="curvChangeLin_%s_%s" % (self.dx,self.skip) self.attrName=self.attrName.translate(string.maketrans(".+-", "__n")) for edge in map.edgeIter(): self.calcCurvChangeLin(edge) map.postMergeEdgesHooks.append(self.postMergeEdges) self.map = ref(map) # ...
def calcCurvChangeLin(self,edge): stats = EdgeStatistics() try: l=curvatureList(edge,self.dx,self.skip) except: l=[] l2=[] for i in range(len(l)-1): l2.append((l[i+1][0]-l[i][0],l[i+1][1]-l[i][1])) if len(l2)>1: for i in range(len(l2)-1): stats(-math.log(abs(l2[i+1][1]/l2[i+1][0]-l2[i][1]/l2[i][0])+1),l2[i][0]+l2[i+1][...
def calcCurvChangeLin(self, edge): fit = ParabolaFit() fit.addTangentList(edge.tangents) edge.curvChangeLin = fit.sumOfSquaredErrors() / len(edge.tangents)
def calcCurvChangeLin(self,edge): stats = EdgeStatistics() try: l=curvatureList(edge,self.dx,self.skip) except: l=[] l2=[] for i in range(len(l)-1): l2.append((l[i+1][0]-l[i][0],l[i+1][1]-l[i][1])) if len(l2)>1: for i in range(len(l2)-1): stats(-math.log(abs(l2[i+1][1]/l2[i+1][0]-l2[i][1]/l2[i][0])+1),l2[i][0]+l2[i+1][...
self.attrName="regularity_%s" % (self.seglength) self.attrName=self.attrName.translate(string.maketrans(".+-", "__n"))
self.attrName = _makeAttrName("regularity_%s" % (self.seglength))
def __init__(self, map, seglength): self.seglength=seglength self.attrName="regularity_%s" % (self.seglength) self.attrName=self.attrName.translate(string.maketrans(".+-", "__n")) for edge in map.edgeIter(): self.calcRegularity(edge)
e = Experiment(filename, "grad")
def cannyEdgeImageThinning(img): lut = [0]*256 for k in [183, 222, 123, 237, 219, 111, 189, 246, 220, 115, 205, 55, 103, 157, 118, 217]: lut[k] = 1 res=GrayImage(img.size()) res[1:-1,1:-1].copyValues(img[1:-1,1:-1]) for y in range(1, res.height()-1): for x in range(1, res.width()-1): if res[x,y]: res[x,y] = 1 continue ...
def pixelMap2subPixelMap(geomap, scale = 1.0, offset = Vector2(0, 0), labelImageSize = None): nodes, edges = pixelMapData(geomap, offset, scale) if labelImageSize == None: labelImageSize = geomap.cellImage.size() * scale return Map(nodes, edges, labelImageSize, performBorderClosing = False, performEdgeSplits = False)
crackEdges = 8
crackEdges = 0
def pixelMap2subPixelMap(geomap, scale = 1.0, offset = Vector2(0, 0), labelImageSize = None): nodes, edges = pixelMapData(geomap, offset, scale) if labelImageSize == None: labelImageSize = geomap.cellImage.size() * scale return Map(nodes, edges, labelImageSize, performBorderClosing = False, performEdgeSplits = False)
fe.f.fig2dev(lang = eps)
fe.f.fig2dev(lang = "eps")
def saveEPS(self, basepath, *args, **kwargs): """display.saveEPS(basepath, geometry=None, scale=None)
edgeImage = self.cannyEdgeImageThinning(edgeImage) lab,count = labelImageWithBackground4(edgeImage) geomap = GeoMap(lab, 0, CellType.Line) spmap = self.pixelMap2subPixelMap(geomap, offset = Vector2(1,1), labelImageSize = i.size()) return spmap
edgeImage = cannyEdgeImageThinning(edgeImage) geomap = GeoMap(edgeImage, 0, CellType.Line) spmap = pixelMap2subPixelMap(geomap, offset = Vector2(1,1), labelImageSize = i.size()) return spmap
def cannyEdgeMap(i, scale, thresh): edgeImage = cannyEdgeImage(i, scale, thresh) edgeImage = self.cannyEdgeImageThinning(edgeImage) lab,count = labelImageWithBackground4(edgeImage) geomap = GeoMap(lab, 0, CellType.Line) spmap = self.pixelMap2subPixelMap(geomap, offset = Vector2(1,1), labelImageSize = i.size()) return s...
crackEdges = 0
crackEdges = 8
def cannyEdgeMap(i, scale, thresh): edgeImage = cannyEdgeImage(i, scale, thresh) edgeImage = self.cannyEdgeImageThinning(edgeImage) lab,count = labelImageWithBackground4(edgeImage) geomap = GeoMap(lab, 0, CellType.Line) spmap = self.pixelMap2subPixelMap(geomap, offset = Vector2(1,1), labelImageSize = i.size()) return s...
nodePositions, edgeData = triangle.constrainedDelaunay( points, segments, performCleaning)
if markContour: nodePositions, edgeData = triangle.constrainedDelaunay( points, segments, performCleaning) else: nodePositions, edgeData = triangle.delaunay(points)
def constrainedDelaunayMap(points, jumpPoints, imageSize, markContour = True, performCleaning = True, boundaryProtection = None): segments = [(i-1, i) for i in range(len(points)+1)] for i, jp in enumerate(jumpPoints[:-1]): segments[jp] = (jumpPoints[i+1]-1, jumpPoints[i]) del segments[-1] print "- performing Constrain...
Qt.black : fig.colorBlack, Qt.blue : fig.colorBlue, Qt.green : fig.colorGreen, Qt.cyan : fig.colorCyan, Qt.red : fig.colorRed, Qt.magenta : fig.colorMagenta, Qt.yellow : fig.colorYellow, Qt.white : fig.colorWhite,
qt.Qt.black : fig.colorBlack, qt.Qt.blue : fig.colorBlue, qt.Qt.green : fig.colorGreen, qt.Qt.cyan : fig.colorCyan, qt.Qt.red : fig.colorRed, qt.Qt.magenta : fig.colorMagenta, qt.Qt.yellow : fig.colorYellow, qt.Qt.white : fig.colorWhite,
def clipPoly(polygon, clipRect): result = []
parts = self.addClippedPoly( edge, penColor = qtColor2figColor(edge.color), **attr)
penColor = edge.color if type(penColor) == qt.QColor: penColor = qtColor2figColor(penColor) thisattr = dict(attr) thisattr["penColor"] = penColor parts = self.addClippedPoly(edge, **thisattr)
def addMapEdges(self, map, **attr): result = [] for edge in map.edgeIter(): if hasattr(edge, "color"): parts = self.addClippedPoly( edge, penColor = qtColor2figColor(edge.color), **attr) else: parts = self.addClippedPoly(edge, **attr) result.extend(parts) return result
origEdgePoints = simplifyPolygon(origEdgePoints * self._zoom, 0.5) \ .roundToInteger()
offset = Vector2(self._zoom / 2.0 - 0.5, self._zoom / 2.0 - 0.5) origEdgePoints = ( simplifyPolygon(origEdgePoints * self._zoom, 0.5) + offset).roundToInteger()
def _calculateEdgePoints(self, index, origEdgePoints): qpa = self._zoomedEdges[index]
d0 = Point2D(int(self._zoom / 2), int(self._zoom / 2))
def _calculateEdgePoints(self, index, origEdgePoints): qpa = self._zoomedEdges[index]
qpa.setPoint(0, *(oldPos + d0))
qpa.setPoint(0, oldPos[0], oldPos[1])
def _calculateEdgePoints(self, index, origEdgePoints): qpa = self._zoomedEdges[index]
qpa.setPoint(qpaIndex, *(pos + d0))
qpa.setPoint(qpaIndex, pos[0], pos[1])
def _calculateEdgePoints(self, index, origEdgePoints): qpa = self._zoomedEdges[index]
if self.useIndividualColors: edges = self._map().edges for edge, zoomedEdge in map(None, edges, self._zoomedEdges): if edge and hasattr(edge, "color") and edge.color: p.setPen(qt.QPen(edge.color, self.width))
map = self._map() if self.colors: for i, zoomedEdge in enumerate(self._zoomedEdges): if not (zoomedEdge and (r.isNull() or r.contains(zoomedEdge.boundingRect()))): continue try: edgeColor = self.colors[i] if edgeColor: p.setPen(qt.QPen(edgeColor, self.width)) p.drawPolyline(zoomedEdge) except IndexError, e: print "Inde...
def draw(self, p): if not self._map(): return if self._dirty: self._calculatePoints() r = p.clipRegion() r.translate(-self.viewer.x, -self.viewer.y) if self.useIndividualColors: edges = self._map().edges for edge, zoomedEdge in map(None, edges, self._zoomedEdges): if edge and hasattr(edge, "color") and edge.color: p.se...
d0 = Vector2(0.5 * self._zoom - self.radius, 0.5 * self._zoom - self.radius)
d0 = Vector2(0.5 * (self._zoom-1) - self.radius, 0.5 * (self._zoom-1) - self.radius)
def _calculatePoints(self): if not self._map(): self._qpointlist = [] return c = time.clock() if self.relativeRadius: self.radius = int(self._zoom * self.origRadius + 0.5) d0 = Vector2(0.5 * self._zoom - self.radius, 0.5 * self._zoom - self.radius) w = 2 * self.radius + 1 self.s = qt.QSize(w, w) self._qpointlist = [Non...
if type(darts) == int: darts = [darts]
def highlight(self, darts, color = qt.Qt.yellow): """highlight(darts) Highlight the given darts (can be any iterable returning labels or Dart objects)."""
dartObjects.append(self._map().dart(dart)) else: dartObjects.append(dart)
dart = self._map().dart(dart) elif hasattr(dart, "anchor"): dart = dart.anchor() elif hasattr(dart, "dart"): dart = dart.dart() dartObjects.append(dart)
def highlight(self, darts, color = qt.Qt.yellow): """highlight(darts) Highlight the given darts (can be any iterable returning labels or Dart objects)."""
if type(overlay) == MapNodes: radius = overlay.origRadius if not overlay.relativeRadius: radius /= float(overlay._zoom) color = qtColor2figColor(overlay.color, fe.f) fe.addMapNodes(self.map, radius, fillColor = color, lineWidth = 0, depth = depth) elif type(overlay) == MapEdges: attr = {"depth" : depth} if not overlay....
if type(overlay) in (MapNodes, MapEdges): extraZoom = float(overlay._zoom) / self.viewer.scale oldScale, oldOffset = fe.scale, fe.offset fe.scale *= extraZoom if type(overlay) == MapNodes: radius = overlay.origRadius if not overlay.relativeRadius: radius /= float(overlay._zoom) color = qtColor2figColor(overlay.color, ...
def saveFig(self, basepath, geometry = None, scale = None, bgFilename = None): """display.saveFig(basepath, geometry=None, scale=None, bgFilename = None)
str(self.dart.edge())[9:-1], str(self.dart.startNode())[5:-1], str(self.dart.endNode())[5:-1],
str(self.dart.edge())[12:-1], str(self.dart.startNode())[8:-1], str(self.dart.endNode())[8:-1],
def updateLabel(self): self.dh.highlight(self.dart.label()) self.dartLabel.setText( "%s%s\nStart node: %s\nEnd node: %s\nFaces: %d (left), %d (right)" % (self.dart.edge().isLoop() and "Loop" or ( self.dart.edge().isBridge() and "Bridge" or "Edge"), str(self.dart.edge())[9:-1], str(self.dart.startNode())[5:-1], str(self...
if not edge.protection & BORDER_PROTECTION:
if not edge.protection & spmap.BORDER_PROTECTION:
def extractMapPoints(map, includeNodes = True): if not includeNodes: result = [] else: result = [node.position() for node in map.nodeIter()] for edge in map.edgeIter(): if not edge.protection & BORDER_PROTECTION: result.extend(list(edge)[1:-1]) return result
if not edge.protection & BORDER_PROTECTION:
if not edge.protection & spmap.BORDER_PROTECTION:
def maxSegmentLength(map): result = 0.0 for edge in map.edgeIter(): if not edge.protection & BORDER_PROTECTION: result = max(result, max( [(edge[i+1]-edge[i]).magnitude() for i in range(len(edge)-1)])) return result
def __init__(self, map, bi):
def __init__(self, map, minima):
def __init__(self, map, bi): DynamicEdgeStatistics.__init__(self, map) self.attrName = _makeAttrName("minDist_"+bi.name) minimaMap = PositionedMap() minima=localMinmax(bi.gm,True,False,False) for y in range(minima.height()): for x in range(minima.width()): if minima[x,y]<0: minimaMap.insert(Vector2(x,y), Vector2(x,y)) ...
self.attrName = _makeAttrName("minDist_"+bi.name)
self.attrName = "minDist"
def __init__(self, map, bi): DynamicEdgeStatistics.__init__(self, map) self.attrName = _makeAttrName("minDist_"+bi.name) minimaMap = PositionedMap() minima=localMinmax(bi.gm,True,False,False) for y in range(minima.height()): for x in range(minima.width()): if minima[x,y]<0: minimaMap.insert(Vector2(x,y), Vector2(x,y)) ...
minima=localMinmax(bi.gm,True,False,False) for y in range(minima.height()): for x in range(minima.width()): if minima[x,y]<0: minimaMap.insert(Vector2(x,y), Vector2(x,y)) for edge in map.edgeIter(): mindist = 1e8
for min in minima: minimaMap.insert(min, min) for edge in map.edgeIter(): mindist2 = 1e16
def __init__(self, map, bi): DynamicEdgeStatistics.__init__(self, map) self.attrName = _makeAttrName("minDist_"+bi.name) minimaMap = PositionedMap() minima=localMinmax(bi.gm,True,False,False) for y in range(minima.height()): for x in range(minima.width()): if minima[x,y]<0: minimaMap.insert(Vector2(x,y), Vector2(x,y)) ...
d = (minimaMap(p)-p).magnitude() if (d < mindist): mindist = d setattr(edge, self.attrName, mindist)
near = minimaMap(p, mindist2) if near: mindist2 = (near-p).squaredMagnitude() setattr(edge, self.attrName, math.sqrt(mindist2))
def __init__(self, map, bi): DynamicEdgeStatistics.__init__(self, map) self.attrName = _makeAttrName("minDist_"+bi.name) minimaMap = PositionedMap() minima=localMinmax(bi.gm,True,False,False) for y in range(minima.height()): for x in range(minima.width()): if minima[x,y]<0: minimaMap.insert(Vector2(x,y), Vector2(x,y)) ...
defaultValue = originalImage[0, 0] for i in range(originalImage.bands()): defaultValue[i] = 0.0
defaultValue = 0.0 if originalImage.bands() > 1: defaultValue = originalImage[0, 0] for i in range(originalImage.bands()): defaultValue[i] = 0.0
def __init__(self, map, originalImage, defaultValue = None, minSampleCount = 1, SIV = SplineImageView5): self.originalImage = originalImage self.map = ref(map)
def loadFromStream(self, file):
def loadFromStream(self, file, name=None):
def loadFromStream(self, file): """Return a WSDL instance loaded from a file object.""" document = DOM.loadDocument(file) wsdl = WSDL() wsdl.location = file.name wsdl.load(document) return wsdl
wsdl.location = file.name
if name: wsdl.location = name else: wsdl.location = file.name
def loadFromStream(self, file): """Return a WSDL instance loaded from a file object.""" document = DOM.loadDocument(file) wsdl = WSDL() wsdl.location = file.name wsdl.load(document) return wsdl
self.logger = logging.getLogger('%s-%s(%x)' %(module, self.__class__, get_idstr(self)))
self.logger = logging.getLogger('%s-%s(%s)' %(module, self.__class__, _get_idstr(self)))
def __init__(self, module=__name__): self.logger = logging.getLogger('%s-%s(%x)' %(module, self.__class__, get_idstr(self)))
def _getFileRepresentationType(): """ Cocoa filetype representation function to mach the filetype with the _fileRepresentationMapping dictionary""" base, ext = os.path.splitext(shotFile) return _fileRepresentationMapping[ext.lower()]
if (config.system == 'darwin'): class CocoaScreenshot(NSObject): """ NSObject wrapper for the Cocoa screenshooting code """ _fileRepresentationMapping = { '.png': 'NSPNGFileType', '.gif': 'NSGIFFileType', '.jpg': 'NSJPEGFileType', '.jpeg': 'NSJPEGFileType', '.bmp': 'NSBMPFileType', '.tif': 'NSTIFFFileType', '.tiff': ...
def _getFileRepresentationType(): """ Cocoa filetype representation function to mach the filetype with the _fileRepresentationMapping dictionary""" base, ext = os.path.splitext(shotFile) return _fileRepresentationMapping[ext.lower()]
if iconfig['screenshot']['format'] in ('jpeg', 'jpg', 'JPEG', 'JPG'):
if iconfig['screenshot']['format'] in ('jpeg', 'png', 'JPEG', 'JPG'):
def Screenshot(self): """ Cocoa screenshot implementation """ # FIXME: See http://www.cocoadev.com/index.pl?NSImageToJPEG for JPEG compressiom # http://www.paulhammond.org/2005/08/webkit2png/webkit2png-0.4.txt
if (os.path.exists(os.path.join(os.environ['HOME'], "itaka/config.xml"))): self.configfile = os.path.join(os.environ['HOME'], "itaka/config.xml")
if (os.path.exists(os.path.join(os.environ['HOME'], ".itaka/config.xml"))): self.configfile = os.path.join(os.environ['HOME'], ".itaka/config.xml")
def load(self): """ Set up ConfigParser instance and configuration file. """ self.configfile = None # Check for the location of the file, or create it if (system == "posix"): if (os.path.exists(os.path.join(os.environ['HOME'], "itaka/config.xml"))): self.configfile = os.path.join(os.environ['HOME'], "itaka/config.xml"...
create(local_config) elif (system == "nt"):
self.create(local_config) elif (system == "nt"): print "nt"
def load(self): """ Set up ConfigParser instance and configuration file. """ self.configfile = None # Check for the location of the file, or create it if (system == "posix"): if (os.path.exists(os.path.join(os.environ['HOME'], "itaka/config.xml"))): self.configfile = os.path.join(os.environ['HOME'], "itaka/config.xml"...
create(local_config)
self.create(local_config)
def load(self): """ Set up ConfigParser instance and configuration file. """ self.configfile = None # Check for the location of the file, or create it if (system == "posix"): if (os.path.exists(os.path.join(os.environ['HOME'], "itaka/config.xml"))): self.configfile = os.path.join(os.environ['HOME'], "itaka/config.xml"...
self.pieces.append(self.plural(self.td.days, 'day'))
self.pieces.append(self.__plural(self.td.days, 'day'))
def __calcsince(self, dtime):
pieces.append(plural(self.hours, 'hour')) if minutes or len(pieces) == 0: self.pieces.append(self.plural(self.minutes, 'minute')) if len(self.pieces) == 1: return self.pieces[0] self.labelTime.set_text("Time: " + ", ".join(self.pieces[:-1]) + " and " + self.pieces[-1] + " ago")
self.pieces.append(self.__plural(self.hours, 'hour')) if self.minutes or len(self.pieces) == 0: self.pieces.append(self.__plural(self.minutes, 'minute')) self.labelTime.set_text("Time: " + ", ".join(self.pieces) + " ago")
def __calcsince(self, dtime):
results = Numeric.zeros([2, nfrag, nfrag, nmocoeffs], "f")
results.append(Numeric.zeros([nfrag, nfrag, nmocoeffs], "f"))
def calculate(self, indices=None, fupdate=0.05): """Perform an overlap population analysis given the results of a parser""" if not self.parser.parsed: self.parser.parse()
else: results=Numeric.zeros([1, nfrag, nfrag, nmocoeffs], "f")
def calculate(self, indices=None, fupdate=0.05): """Perform an overlap population analysis given the results of a parser""" if not self.parser.parsed: self.parser.parse()
ca = self.parser.mocoeffs[spin,:,a]
ca = self.parser.mocoeffs[spin][:,a]
def calculate(self, indices=None, fupdate=0.05): """Perform an overlap population analysis given the results of a parser""" if not self.parser.parsed: self.parser.parse()
cb = self.parser.mocoeffs[spin,:,b]
cb = self.parser.mocoeffs[spin][:,b]
def calculate(self, indices=None, fupdate=0.05): """Perform an overlap population analysis given the results of a parser""" if not self.parser.parsed: self.parser.parse()
results[spin,A,B] = Numeric.add(results[spin,A,B],temp) results[spin,B,A] = Numeric.add(results[spin,B,A],temp)
results[spin][A,B] = Numeric.add(results[spin][A,B],temp) results[spin][B,A] = Numeric.add(results[spin][B,A],temp)
def calculate(self, indices=None, fupdate=0.05): """Perform an overlap population analysis given the results of a parser""" if not self.parser.parsed: self.parser.parse()
temparray2 = Numeric.swapaxes(results,2,3) self.results = Numeric.swapaxes(temparray2,1,2)
temparray2 = Numeric.swapaxes(results[0],1,2) self.results = [ Numeric.swapaxes(temparray2,0,1) ] if unrestricted: temparray2 = Numeric.swapaxes(results[1],1,2) self.results.append(Numeric.swapaxes(temparray2, 0, 1))
def calculate(self, indices=None, fupdate=0.05): """Perform an overlap population analysis given the results of a parser""" if not self.parser.parsed: self.parser.parse()
else: inputfile.next()
def parse(self,fupdate=0.05,cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename,"r") if self.progress: inputfile.seek(0,2) #go to end of file nstep=inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep=0 for line in inputfile: if self.progress and random.r...
"""Create a list of pyopenbabel molecules.
"""Create an Open Babel molecule.
def makeopenbabel(atomcoords, atomnos): """Create a list of pyopenbabel molecules. >>> import Numeric >>> atomnos = Numeric.array([1,8,1],"i") >>> a = Numeric.array([[-1,1,0],[0,0,0],[1,1,0]],"f") >>> pyOBmol = pyopenbabel(a,atomnos) >>> print pyOBmol.write("inchi").strip() InChI=1/H2O/h1H2 """
>>> import Numeric
>>> import Numeric, openbabel
def makeopenbabel(atomcoords, atomnos): """Create a list of pyopenbabel molecules. >>> import Numeric >>> atomnos = Numeric.array([1,8,1],"i") >>> a = Numeric.array([[-1,1,0],[0,0,0],[1,1,0]],"f") >>> pyOBmol = pyopenbabel(a,atomnos) >>> print pyOBmol.write("inchi").strip() InChI=1/H2O/h1H2 """
>>> a = Numeric.array([[-1,1,0],[0,0,0],[1,1,0]],"f") >>> pyOBmol = pyopenbabel(a,atomnos) >>> print pyOBmol.write("inchi").strip()
>>> coords = Numeric.array([[-1.,1.,0.],[0.,0.,0.],[1.,1.,0.]]) >>> obmol = makeopenbabel(coords, atomnos) >>> obconversion = openbabel.OBConversion() >>> formatok = obconversion.SetOutFormat("inchi") >>> print obconversion.WriteString(obmol).strip()
def makeopenbabel(atomcoords, atomnos): """Create a list of pyopenbabel molecules. >>> import Numeric >>> atomnos = Numeric.array([1,8,1],"i") >>> a = Numeric.array([[-1,1,0],[0,0,0],[1,1,0]],"f") >>> pyOBmol = pyopenbabel(a,atomnos) >>> print pyOBmol.write("inchi").strip() InChI=1/H2O/h1H2 """
for coords, atomno in zip(atomcoords, atomnos):
for i in range(len(atomnos)): coords = atomcoords[i].tolist() atomno = atomnos[i]
def makeopenbabel(atomcoords, atomnos): """Create a list of pyopenbabel molecules. >>> import Numeric >>> atomnos = Numeric.array([1,8,1],"i") >>> a = Numeric.array([[-1,1,0],[0,0,0],[1,1,0]],"f") >>> pyOBmol = pyopenbabel(a,atomnos) >>> print pyOBmol.write("inchi").strip() InChI=1/H2O/h1H2 """
return pob.Molecule(obmol)
return obmol
def makeopenbabel(atomcoords, atomnos): """Create a list of pyopenbabel molecules. >>> import Numeric >>> atomnos = Numeric.array([1,8,1],"i") >>> a = Numeric.array([[-1,1,0],[0,0,0],[1,1,0]],"f") >>> pyOBmol = pyopenbabel(a,atomnos) >>> print pyOBmol.write("inchi").strip() InChI=1/H2O/h1H2 """
import doctest, cclib2openbabel doctest.testmod(cclib2openbabel)
import doctest doctest.testmod()
def makeopenbabel(atomcoords, atomnos): """Create a list of pyopenbabel molecules. >>> import Numeric >>> atomnos = Numeric.array([1,8,1],"i") >>> a = Numeric.array([[-1,1,0],[0,0,0],[1,1,0]],"f") >>> pyOBmol = pyopenbabel(a,atomnos) >>> print pyOBmol.write("inchi").strip() InChI=1/H2O/h1H2 """
if line.find("DENSITY CONV=")==5 or line.find("DENSITY MATRIX CONV")==11: scftarget = float(line.split()[-1])
if line.find("DENSITY CONV=")>=0 or line.find("DENSITY MATRIX CONV=")>=0: index = line.find("DENSITY CONV=") if index<0: index = line.find("DENSITY MATRIX CONV=") index += len("DENSITY MATRIX CONV=") else: index += len("DENSITY CONV=") scftarget = float(line[index:].split()[0])
def parse(self): """Extract information from the logfile.""" inputfile = open(self.filename,"r") if self.progress: inputfile.seek(0,2) #go to end of file nstep=inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep=0
self.mocoeffs[spin,row+symoffset,i+symoffset+base]=float(cols[i+1])
self.mocoeffs[spin,i+symoffset+base,row+symoffset]=float(cols[i+1])
def parse(self,fupdate=0.05,cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename,"r") if self.progress: inputfile.seek(0,2) #go to end of file nstep=inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep=0 # Used to avoid extracting the final geometry twice i...
self.etenergies = Numeric.array(self.etenergies,"f") self.etoscs = Numeric.array(self.etoscs,"f")
def parse(self,fupdate=0.05,cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename,"r") if self.progress: inputfile.seek(0,2) #go to end of file nstep=inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep=0 optfinished = False # Flag that indicates whether it ...
print temp
def parse(self, fupdate=0.05, cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename, "r") if self.progress: inputfile.seek(0, 2) #go to end of file nstep = inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep = 0 optfinished = False # Flag that indicates whe...
parts = line.split()[0:2] newlist = [self.float(x.split('=')[1]) for x in parts]
parts = line.split() newlist = [self.float(x.split('=')[1]) for x in parts[0:2]]
def parse(self, fupdate=0.05, cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename, "r") if self.progress: inputfile.seek(0, 2) #go to end of file nstep = inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep = 0 optfinished = False # Flag that indicates whe...
line = inputfile.next()
def parse(self, fupdate=0.05, cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename, "r") if self.progress: inputfile.seek(0, 2) #go to end of file nstep = inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep = 0 # Used to avoid extracting the final geometry...
line = inputfile.next()
def parse(self, fupdate=0.05, cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename, "r") if self.progress: inputfile.seek(0, 2) #go to end of file nstep = inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep = 0 # Used to avoid extracting the final geometry...
sum = coeff**2 while sum < 1.0:
line = inputfile.next() while line.strip() and not line[:7].strip(): info = line[43:].split() if len(info)>0: frag += "+" + fragname + info[-1] coeff = float(info[-4]) if coeff < 0: orbital += '-' + info[-3] + info[-2].replace(":", "") else: orbital += '+' + info[-3] + info[-2].replace(":", "")
def parse(self, fupdate=0.05, cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename, "r") if self.progress: inputfile.seek(0, 2) #go to end of file nstep = inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep = 0 # Used to avoid extracting the final geometry...
info = line.split() if line[42] == ' ' and len(info) > 4: frag += "+" + fragname + info[6] coeff = float(info[3]) if coeff < 0: orbital += '-' + info[4] + info[5].replace(":", "") else: orbital += '+' + info[4] + info[5].replace(":", "") elif line[42] == ' ': frag += "+" + fragname + info[3] coeff = float(info[0]) if...
def parse(self, fupdate=0.05, cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename, "r") if self.progress: inputfile.seek(0, 2) #go to end of file nstep = inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep = 0 # Used to avoid extracting the final geometry...
inputfile.next(); inputfile.next(); inputfile.next()
inputfile.next(); inputfile.next()
def parse(self, fupdate=0.05, cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename, "r") if self.progress: inputfile.seek(0, 2) #go to end of file nstep = inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep = 0 # Used to avoid extracting the final geometry...
unrestrictedflag = False
def parse(self,fupdate=0.05,cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename,"r") if self.progress: inputfile.seek(0,2) #go to end of file nstep=inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep=0 # Used to avoid extracting the final geometry twice i...
if line[1:37]=='Orbital Energies, per Irrep and Spin' and not hasattr(self,"mosyms") and nosymflag:
if line[1:37]=='Orbital Energies, per Irrep and Spin' and not hasattr(self,"mosyms") and nosymflag and not unrestrictedflag:
def parse(self,fupdate=0.05,cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename,"r") if self.progress: inputfile.seek(0,2) #go to end of file nstep=inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep=0 # Used to avoid extracting the final geometry twice i...
break self.logger.info("Creating attribute mosyms[[]]") self.mosyms=[[]]
else: self.logger.info("Creating attribute mosyms[[]]") self.mosyms=[[]] self.logger.info("Creating attribute moenergies[[]]") self.moenergies=[[]] homoA=None while len(line)>3: info=line.split() self.mosyms[0].append('A') self.moenergies[0].append(utils.convertor(float(info[2]),'hartree','eV')) if info[1]=='0.000' ...
def parse(self,fupdate=0.05,cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename,"r") if self.progress: inputfile.seek(0,2) #go to end of file nstep=inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep=0 # Used to avoid extracting the final geometry twice i...
self.moenergies=[[]] homoA=None
self.moenergies=[[],[]] underline=inputfile.next() blank=inputfile.next() header=inputfile.next() underline=inputfile.next() line=inputfile.next() homoa=None homob=None
def parse(self,fupdate=0.05,cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename,"r") if self.progress: inputfile.seek(0,2) #go to end of file nstep=inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep=0 # Used to avoid extracting the final geometry twice i...
self.mosyms[0].append('A') self.moenergies[0].append(utils.convertor(float(info[2]),'hartree','eV')) if info[1]=='0.000' and not hasattr(self,'homos'): self.logger.info("Creating attribute homos[]") self.homos=[len(self.moenergies[0])-2]
if info[2]=='A': self.mosyms[0].append('A') self.moenergies[0].append(utils.convertor(float(info[4]),'hartree','eV')) if info[3]=='0.00' and not homoa: homoa=len(self.moenergies[0])-2 elif info[2]=='B': self.mosyms[1].append('A') self.moenergies[1].append(utils.convertor(float(info[4]),'hartree','eV')) if info[3]=='0.0...
def parse(self,fupdate=0.05,cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename,"r") if self.progress: inputfile.seek(0,2) #go to end of file nstep=inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep=0 # Used to avoid extracting the final geometry twice i...
self.homos=Numeric.array(self.homos,"i")
self.logger.info("Creating attribute homos[]") self.homos=Numeric.array([homoa,homob],"i")
def parse(self,fupdate=0.05,cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename,"r") if self.progress: inputfile.seek(0,2) #go to end of file nstep=inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep=0 # Used to avoid extracting the final geometry twice i...
"""Example regression test for Gaussian/basicGaussian03/dvb_un_sp.out Note: the name of the test must match the full path to the datafile exactly, except that all periods are replaced by underscores, and path separators are also replaced by underscores.
def testGaussian_basicGaussian03_dvb_un_sp_out(logfile): """Example regression test for Gaussian/basicGaussian03/dvb_un_sp.out Note: the name of the test must match the full path to the datafile exactly, except that all periods are replaced by underscores, and path separators are also replaced by underscores. """ asse...
assert len(logfile.atomnos) == 20 and logfile.atomcoords.shape == (1,20,3)
This file had no atomcoords at all at all, due to only having an Input Orientation section and no Standard Orientation. """ assert len(logfile.atomnos) == 20 assert logfile.atomcoords.shape == (1,20,3)
def testGaussian_basicGaussian03_dvb_un_sp_out(logfile): """Example regression test for Gaussian/basicGaussian03/dvb_un_sp.out Note: the name of the test must match the full path to the datafile exactly, except that all periods are replaced by underscores, and path separators are also replaced by underscores. """ asse...
The following file had no atomcoords as it did not contain any
This file had no atomcoords as it did not contain any
def testGaussian_Gaussian03_Mo4OSibdt2_opt_log(logfile): """ The following file had no atomcoords as it did not contain any "Input orientation" sections, only "Standard orientation" sections """ assert hasattr(logfile,"atomcoords")
def testGaussian_basicGaussian03_dvb_raman_out(logfile): """ Was extracting the "Depolar P" instead of the "Raman activity". Oops! """ assert logfile.vibramans[1] - 2.6872 < 0.0001
def testGaussian_Gaussian03_Mo4OSibdt2_opt_log(logfile): """ The following file had no atomcoords as it did not contain any "Input orientation" sections, only "Standard orientation" sections """ assert hasattr(logfile,"atomcoords")
decomposition = title.find("decomposition")>=0
def parse(self, fupdate=0.05, cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename, "r") if self.progress: inputfile.seek(0, 2) #go to end of file nstep = inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep = 0
if decomposition: temp = line[91:].strip().split() for i in range(1,len(temp),2): mosyms.append(self.normalisesym(temp[i])) else: temp = line[25:30].strip()
temp = line[25:30].strip() if temp[-1]=='?': t = line[91:].strip().split() for i in range(1,len(t),2): mosyms.append(self.normalisesym(t[i])) if t[i][0]=='e': mosyms.append(self.normalisesym(t[i])) else:
def parse(self, fupdate=0.05, cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename, "r") if self.progress: inputfile.seek(0, 2) #go to end of file nstep = inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep = 0
for mo in range(0, self.nmo, 7):
mo = 0 while mo < self.nmo:
def parse(self, fupdate=0.05, cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename, "r") if self.progress: inputfile.seek(0, 2) #go to end of file nstep = inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep = 0
for attr in __parsedattr:
for attr in self.attrlist:
def clean(self): """Delete all of the parsed attributes.""" for attr in __parsedattr: if hasattr(self, attr): delattr(self, attr)
mosyms.append(self.normalisesym(t[i])) if t[i][0]=='e':
for j in range(multiple[t[i][0]]):
def parse(self, fupdate=0.05, cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename, "r") if self.progress: inputfile.seek(0, 2) #go to end of file nstep = inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep = 0
mosyms.append(self.normalisesym(temp)) if temp[0]=='e': mosyms.append(self.normalisesym(temp))
for j in range(multiple[temp[0]]): mosyms.append(self.normalisesym(temp))
def parse(self, fupdate=0.05, cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename, "r") if self.progress: inputfile.seek(0, 2) #go to end of file nstep = inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep = 0
self.moenergies = [[], []]
moenergies = [[], []]
def parse(self, fupdate=0.05, cupdate=0.002): """Extract information from the logfile.""" inputfile = utils.openlogfile(self.filename) if self.progress: inputfile.seek(0, 2) #go to end of file nstep = inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep = 0 # Used to avoid extracting the final ...
self.moenergies[0].append(utils.convertor(float(info[4]), 'hartree', 'eV'))
moenergies[0].append(utils.convertor(float(info[4]), 'hartree', 'eV'))
def parse(self, fupdate=0.05, cupdate=0.002): """Extract information from the logfile.""" inputfile = utils.openlogfile(self.filename) if self.progress: inputfile.seek(0, 2) #go to end of file nstep = inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep = 0 # Used to avoid extracting the final ...
homoa = len(self.moenergies[0]) - 1
homoa = len(moenergies[0]) - 1
def parse(self, fupdate=0.05, cupdate=0.002): """Extract information from the logfile.""" inputfile = utils.openlogfile(self.filename) if self.progress: inputfile.seek(0, 2) #go to end of file nstep = inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep = 0 # Used to avoid extracting the final ...
self.moenergies[1].append(utils.convertor(float(info[4]), 'hartree', 'eV'))
moenergies[1].append(utils.convertor(float(info[4]), 'hartree', 'eV'))
def parse(self, fupdate=0.05, cupdate=0.002): """Extract information from the logfile.""" inputfile = utils.openlogfile(self.filename) if self.progress: inputfile.seek(0, 2) #go to end of file nstep = inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep = 0 # Used to avoid extracting the final ...
homob = len(self.moenergies[1]) - 1
homob = len(moenergies[1]) - 1
def parse(self, fupdate=0.05, cupdate=0.002): """Extract information from the logfile.""" inputfile = utils.openlogfile(self.filename) if self.progress: inputfile.seek(0, 2) #go to end of file nstep = inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep = 0 # Used to avoid extracting the final ...
aolist = range(len(self.moenergies[spin]))
aolist = range(self.nbasis)
def parse(self, fupdate=0.05, cupdate=0.002): """Extract information from the logfile.""" inputfile = utils.openlogfile(self.filename) if self.progress: inputfile.seek(0, 2) #go to end of file nstep = inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep = 0 # Used to avoid extracting the final ...
temp = line[91:].strip().split() for i in range(1,len(temp),2): mosyms.append(self.normalisesym(temp[i])) line = inputfile.next() assert len(mosyms) == self.nmo
if decomposition: temp = line[91:].strip().split() for i in range(1,len(temp),2): mosyms.append(self.normalisesym(temp[i])) else: temp = line[25:30].strip() mosyms.append(self.normalisesym(temp)) line = inputfile.next() assert len(mosyms) == self.nmo, "mosyms: %d but nmo: %d" % (len(mosyms), self.nmo)
def parse(self, fupdate=0.05, cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename, "r") if self.progress: inputfile.seek(0, 2) #go to end of file nstep = inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep = 0
k = float(parts[j].replace("D","E"))
k = float(parts[j+1].replace("D","E"))
def parse(self,fupdate=0.05,cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename,"r") if self.progress: inputfile.seek(0,2) #go to end of file nstep=inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep=0 for line in inputfile: if self.progress and random.r...
if not hasattr(self.parser,"mocoeffs") \ and not hasattr(self.parser,"nbasis"): self.logger.error("Missing mocoeffs or nbasis") return False
if not hasattr(self.parser,"mocoeffs"): self.logger.error("Missing mocoeffs") return False if not hasattr(self.parser,"nbasis"): self.logger.error("Missing nbasis") return False if not hasattr(self.parser,"homos"): self.logger.error("Missing homos") return False
def calculate(self,indices=None,fupdate=0.05): """Perform a C-squared population analysis given the results of a parser""" if not self.parser.parsed: self.parser.parse()
self.mosyms = []
self.mosyms = [[]]
def parse(self): """Extract information from the logfile.""" inputfile = open(self.filename,"r") if self.progress: inputfile.seek(0,2) #go to end of file nstep=inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep=0
self.mosyms.extend(line.split())
self.mosyms[0].extend(line.split())
def parse(self): """Extract information from the logfile.""" inputfile = open(self.filename,"r") if self.progress: inputfile.seek(0,2) #go to end of file nstep=inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep=0
self.moenergies.extend(map(float,line.split())) line = inputfile.next() self.mosyms.extend(line.split())
self.moenergies[1].extend([convertor(float(x),"hartree","eV") for x in line.split()]) line = inputfile.next() self.mosyms[1].extend(line.split())
def parse(self): """Extract information from the logfile.""" inputfile = open(self.filename,"r") if self.progress: inputfile.seek(0,2) #go to end of file nstep=inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep=0
if hasattr(self,"scfvalues"): self.scfvalues = Numeric.array(self.scftargets,"f")
if hasattr(self,"scfvalues"): self.scfvalues = [Numeric.array(x,"f") for x in self.scfvalues]
def parse(self,fupdate=0.05,cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename,"r") if self.progress: inputfile.seek(0,2) #go to end of file nstep=inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep=0 for line in inputfile: if self.progress and random.r...
while line.find("SCF CONVERGED") == -1 and line.find("SCF not fully converged, result acceptable") == -1:
while line.find("SCF CONVERGED") == -1 and line.find("SCF not fully converged, result acceptable") == -1 and line.find("SCF NOT CONVERGED") == -1:
def parse(self, fupdate=0.05, cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename, "r") if self.progress: inputfile.seek(0, 2) #go to end of file nstep = inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep = 0 # Used to avoid extracting the final geometry...
if line.find("SCF not fully converged, result acceptable") == -1:
if line.find("SCF not fully converged, result acceptable") > 0:
def parse(self, fupdate=0.05, cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename, "r") if self.progress: inputfile.seek(0, 2) #go to end of file nstep = inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep = 0 # Used to avoid extracting the final geometry...
line = inputfile.next() while not line.startswith(stop): line = inputfile.next() atomcoords.append(map(float,line.split()[3:6]))
empty = inputfile.next() while not empty.startswith(stop): line = inputfile.next().split() atomcoords.append(map(float,line[3:6])) self.atomnos.append(int(round(float(line[2]))))
def parse(self, fupdate=0.05, cupdate=0.002): """Extract information from the logfile.""" inputfile = utils.openlogfile(self.filename) if self.progress: inputfile.seek(0, 2) #go to end of file nstep = inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep = 0
line = inputfile.next()
empty = inputfile.next()
def parse(self, fupdate=0.05, cupdate=0.002): """Extract information from the logfile.""" inputfile = utils.openlogfile(self.filename) if self.progress: inputfile.seek(0, 2) #go to end of file nstep = inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep = 0
self.mosyms[0].append(self.normalisesym(info[0])) self.moenergies[0].append(utils.convertor(float(info[3]), 'hartree', 'eV'))
for repeat in range(multiple.get(info[0][0], 1)): self.mosyms[0].append(self.normalisesym(info[0])) self.moenergies[0].append(utils.convertor(float(info[3]), 'hartree', 'eV'))
def parse(self, fupdate=0.05, cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename, "r") if self.progress: inputfile.seek(0, 2) #go to end of file nstep = inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep = 0 # Used to avoid extracting the final geometry...
self.mosyms[0].append(self.normalisesym(info[0])) self.moenergies[0].append(utils.convertor(float(info[4]), 'hartree', 'eV'))
for repeat in range(multiple.get(info[0][0], 1)): self.mosyms[0].append(self.normalisesym(info[0])) self.moenergies[0].append(utils.convertor(float(info[4]), 'hartree', 'eV'))
def parse(self, fupdate=0.05, cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename, "r") if self.progress: inputfile.seek(0, 2) #go to end of file nstep = inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep = 0 # Used to avoid extracting the final geometry...
self.mosyms[1].append(self.normalisesym(info[0])) self.moenergies[1].append(utils.convertor(float(info[4]), 'hartree', 'eV'))
for repeat in range(multiple.get(info[0][0], 1)): self.mosyms[1].append(self.normalisesym(info[0])) self.moenergies[1].append(utils.convertor(float(info[4]), 'hartree', 'eV'))
def parse(self, fupdate=0.05, cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename, "r") if self.progress: inputfile.seek(0, 2) #go to end of file nstep = inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep = 0 # Used to avoid extracting the final geometry...
if sym == "L": assert temp[6][-1] == temp[9][-1] == ')' coeff.setdefault("S", []).append( (float(temp[3]), float(temp[6][:-1])) ) coeff.setdefault("P", []).append( (float(temp[3]), float(temp[9][:-1])) )
if sym == "L": if len(temp)==6: coeff.setdefault("S", []).append( (float(temp[3]), float(temp[4])) ) coeff.setdefault("P", []).append( (float(temp[3]), float(temp[5])) ) else: assert temp[6][-1] == temp[9][-1] == ')' coeff.setdefault("S", []).append( (float(temp[3]), float(temp[6][:-1])) ) coeff.setdefault("P", []).app...
def parse(self): """Extract information from the logfile.""" inputfile = open(self.filename, "r") if self.progress: inputfile.seek(0, 2) #go to end of file nstep = inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep = 0
assert temp[6][-1] == ')' coeff.setdefault(sym, []).append( (float(temp[3]), float(temp[6][:-1])) )
if len(temp)==5: coeff.setdefault(sym, []).append( (float(temp[3]), float(temp[4])) ) else: assert temp[6][-1] == ')' coeff.setdefault(sym, []).append( (float(temp[3]), float(temp[6][:-1])) )
def parse(self): """Extract information from the logfile.""" inputfile = open(self.filename, "r") if self.progress: inputfile.seek(0, 2) #go to end of file nstep = inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep = 0
self.atomnos = Numeric.array(atomnos,'f')
self.atomnos = Numeric.array(atomnos,'i')
def parse(self,fupdate=0.05,cupdate=0.002): """Extract information from the logfile.""" inputfile = open(self.filename,"r") if self.progress: inputfile.seek(0,2) #go to end of file nstep=inputfile.tell() inputfile.seek(0) self.progress.initialize(nstep) oldstep=0 optfinished = False # Flag that indicates whether it ...