Skip to content
Snippets Groups Projects
Commit 342a47c6 authored by Valentin Bruch's avatar Valentin Bruch
Browse files

slightly restructured Keldysh contour ordering

parent 0d149b84
No related branches found
No related tags found
No related merge requests found
...@@ -401,6 +401,7 @@ class Diagram: ...@@ -401,6 +401,7 @@ class Diagram:
# Clear old data: # Clear old data:
if clear: if clear:
self.clear() self.clear()
self.isKeldysh = False
# Remove ignored characters # Remove ignored characters
for c in ignore: for c in ignore:
...@@ -476,6 +477,22 @@ class Diagram: ...@@ -476,6 +477,22 @@ class Diagram:
if vertex_indices: if vertex_indices:
print('Warning: diagram contains uncontracted indices:', *vertex_indices.keys(), file=sys.stderr) print('Warning: diagram contains uncontracted indices:', *vertex_indices.keys(), file=sys.stderr)
# Tell contours about their order in Keldysh diagram.
if self.isKeldysh:
self.updateKeldyshOrder()
def updateKeldyshOrder(self):
'Tell contours about their order in Keldysh diagram.'
keldysh_order = 0
for i, contour in enumerate(self.contours, 1):
# First draw the contour.
contour.keldysh_order = keldysh_order
try:
if self.interruptions[i].isKeldysh():
keldysh_order += 1
except IndexError:
break
def pprint(self): def pprint(self):
''' '''
Produce more or less human readable output (without contractions!) for debugging. Produce more or less human readable output (without contractions!) for debugging.
...@@ -528,10 +545,8 @@ class Diagram: ...@@ -528,10 +545,8 @@ class Diagram:
# Iterate over contours, interruptions and elements to draw vertices and interruptions. # Iterate over contours, interruptions and elements to draw vertices and interruptions.
last_node = self.interruptions[0] last_node = self.interruptions[0]
keldysh_order = -1 + self.isKeldysh
for i, contour in enumerate(self.contours, 1): for i, contour in enumerate(self.contours, 1):
# First draw the contour. # First draw the contour.
contour.keldysh_order = keldysh_order
for j, e in enumerate(contour.elements): for j, e in enumerate(contour.elements):
if type(e) != BaseLine: if type(e) != BaseLine:
factor = getattr(contour.elements[j-1], 'factor', 1) or 1 factor = getattr(contour.elements[j-1], 'factor', 1) or 1
...@@ -545,7 +560,6 @@ class Diagram: ...@@ -545,7 +560,6 @@ class Diagram:
else: else:
assert type(last_node) == Interrupt assert type(last_node) == Interrupt
last_node = self.interruptions[i] last_node = self.interruptions[i]
keldysh_order += 1
elif self.interruptions[i].label: elif self.interruptions[i].label:
factor = getattr(contour.elements[-1], 'factor', 1) or 1 factor = getattr(contour.elements[-1], 'factor', 1) or 1
print(self.interruptions[i].tikz(position='right of=%s, xshift=%g%s'%(last_node.right(), factor*self.sep, self.sep_unit)), file=file) print(self.interruptions[i].tikz(position='right of=%s, xshift=%g%s'%(last_node.right(), factor*self.sep, self.sep_unit)), file=file)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment