From 2c40a2e4c24cf413a476e017304b61c574a5e266 Mon Sep 17 00:00:00 2001 From: Andreas Freise <adf@star.bham.ac.uk> Date: Fri, 21 Feb 2014 12:28:11 +0000 Subject: [PATCH] changing blocks to be an ordered dictionary, so that it presevers the order in which blocks have been read in. Again, just for making the kat files a bit more readable. --- pykat/finesse.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pykat/finesse.py b/pykat/finesse.py index b30b36d..ae1214e 100644 --- a/pykat/finesse.py +++ b/pykat/finesse.py @@ -33,8 +33,9 @@ import pickle import pykat import warnings import re +#import collections -from collections import namedtuple +from collections import namedtuple, OrderedDict from pykat.node_network import NodeNetwork from pykat.detectors import Detector @@ -245,7 +246,7 @@ class kat(object): self.scene = None # scene object for GUI self.verbose = True - self.__blocks = {} # dictionary of blocks that are used + self.__blocks = OrderedDict() # dictionary of blocks that are used self.__components = {} # dictionary of optical components self.__detectors = {} # dictionary of detectors self.__commands = {} # dictionary of commands @@ -856,8 +857,7 @@ class kat(object): for t in txt: out.append(t+ "\n") else: out.append(txt + "\n") - - + if self.scale != None and self.scale !='': out.append("scale {0}\n".format(self.scale)) if self.phase != None: out.append("phase {0}\n".format(self.phase)) if self.maxtem != None: -- GitLab