Index: trunk/uvmapgenerator.py
===================================================================
--- trunk/uvmapgenerator.py	(revision 62)
+++ trunk/uvmapgenerator.py	(revision 63)
@@ -3,4 +3,6 @@
 import collections
 import numpy as np
+
+import pointingerrorgenerators
 
 
@@ -9,10 +11,18 @@
     """
 
-    def __init__(self, parameters):
+    def __init__(self, parameters, previous_results):
         self.parameters = parameters
+        self.previous_results = previous_results
         self.result = collections.OrderedDict()
 
     def run(self):
         print 'UVMapGenerator.run'
+
+        # The FTS mirror positions per scan. This is found from the 
+        # FTS results that should have already been calculated.
+        fts = self.previous_results['fts']
+        self.result['ftsnsample'] = ftsnsample = fts['ftsnsample']
+        delta_opd = fts['delta_opd']
+
         interferometer = self.parameters['substages']['Interferometer']
 
@@ -31,18 +41,82 @@
             n_laps = (bmax - bmin) / bstep
 
+#            n_baselines = 50
             bxby = np.zeros([n_baselines,2])     
+#            bxby[0,0] = 10.0
+#            bxby[0,1] = 0.0
+#            bxby[1,0] = 20.0
+#            bxby[1,1] = 0.0
+#            bxby[2,0] = 30.0
+#            bxby[2,1] = 0.0
+#            bxby[3,0] = 40.0
+#            bxby[3,1] = 0.0
+#            bxby[4,0] = 0.0
+#            bxby[4,1] = 10.0
+#            bxby[5,0] = 0.0
+#            bxby[5,1] = 20.0
+#            bxby[6,0] = 0.0
+#            bxby[6,1] = 30.0
+#            bxby[7,0] = 0.0
+#            bxby[7,1] = 40.0
+#            bxby[8,0] = 40.0
+#            bxby[8,1] = 40.0
+#            bxby[9,0] = 20.0
+#            bxby[9,1] = 20.0
+#            bxby[10,0] = 30.0
+#            bxby[10,1] = 30.0
+
 
             # n_baselines is total number of points along spiral
-            for i in range(n_baselines):
+            for ib in range(n_baselines):
                 # phi is angle around spiral, r its radius
-                phi = n_laps * 2 * np.pi * (n_baselines-i) / n_baselines
+                phi = n_laps * 2 * np.pi * (n_baselines-ib) / n_baselines
                 r = bmin + bstep * phi / (2 * np.pi)
 
-                bxby[i,:] = [r * np.cos(phi), r * np.sin(phi)]
+                bxby[ib,:] = [r * np.cos(phi), r * np.sin(phi)]
 
+            self.result['pattern'] = pattern
             self.result['bxby'] = bxby
             self.result['bmin'] = bmin
             self.result['bmax'] = bmax
             self.result['n_baselines'] = n_baselines
+
+            # Construct the obs framework that will give one FTS
+            # scan at each baseline.
+     
+            # The framework will hold the baseline and FTS mirror position
+            # for each time that the detector is read. 
+
+            # The observation consists of a series of FTS scans. The 
+            # instrument baseline, pointing etc. can change continuously
+            # as the scan is performed.
+ 
+            obs_framework = []
+            Config = collections.namedtuple('Config', [
+              'scan_number',
+              'baseline_x', 'baseline_y', 'baseline_z', 'baseline_number',
+              'fts_position', 'fts_nominal_position', 'fts_start',
+              'point1_x_error', 'point1_y_error',
+              'point2_x_error', 'point2_y_error',
+              'data'],
+              verbose=False)
+
+            for ib in range(n_baselines):
+                opd_start = -((ftsnsample + 1) / 2) * delta_opd
+
+                fts_start = True
+                for ifts in np.arange(ftsnsample):
+                    opd = opd_start + float(ifts) * delta_opd
+                    fts_mirror = opd / 2.0
+                    config = Config(ib, bxby[ib][0], bxby[ib][1], 0.0, ib,
+                      fts_mirror, fts_mirror, fts_start, 0.0, 0.0, 0.0,
+                      0.0, None)
+                    obs_framework.append(config) 
+                    fts_start = False
+
+            png = pointingerrorgenerators.GaussianPointingErrors(mu0=1.0,
+              sigma0=0.0, mu1=0.0, sigma1=0.0)
+            png.fill(obs_framework)
+
+            self.result['obs_framework'] = obs_framework
 
         else:
@@ -52,4 +126,13 @@
 
     def __repr__(self):
-        return 'UVMapGenerator'
+        return '''
+UVMapGenerator:
+  uv pattern      : {pattern}
+  FTS samples/scan: {ftsnsample}
+  obs.framework length: {len_framework}
+'''.format(
+          pattern=self.result['pattern'],
+          ftsnsample=self.result['ftsnsample'],
+          len_framework=len(self.result['obs_framework']))
 
+
