Index: park_integration/.project
===================================================================
--- park_integration/.project	(revision 103a0b01aacb82e91d4a8a969004d5972d1cf30f)
+++ park_integration/.project	(revision 103a0b01aacb82e91d4a8a969004d5972d1cf30f)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>park_integration</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.python.pydev.PyDevBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.python.pydev.pythonNature</nature>
+	</natures>
+</projectDescription>
Index: park_integration/.pydevproject
===================================================================
--- park_integration/.pydevproject	(revision 103a0b01aacb82e91d4a8a969004d5972d1cf30f)
+++ park_integration/.pydevproject	(revision 103a0b01aacb82e91d4a8a969004d5972d1cf30f)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?eclipse-pydev version="1.0"?>
+
+<pydev_project>
+<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
+<path>/park_integration/src</path>
+</pydev_pathproperty>
+<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.5</pydev_property>
+</pydev_project>
Index: park_integration/docs/requirements.txt
===================================================================
--- park_integration/docs/requirements.txt	(revision 103a0b01aacb82e91d4a8a969004d5972d1cf30f)
+++ park_integration/docs/requirements.txt	(revision 103a0b01aacb82e91d4a8a969004d5972d1cf30f)
@@ -0,0 +1,17 @@
+Functional Requirements:
+
+ - Client should be able to set models
+ - Client should be able to set data sets
+ - Client should be able to enter constraints
+ - Client should be able to start a fit
+ - Client should be able to access the results of a fit
+ 
+ Non-Functional Requirements:
+ - Models and Data belong in their own class
+ - Data loader should be external to the module
+ - The Models should be compatible with SANS models
+ 
+ 
+ Risks:
+ - Can we run Park standalone without a server?
+ - Can we define an interface to Park that is as simple as scipy.optimizer?
Index: park_integration/docs/use-cases.txt
===================================================================
--- park_integration/docs/use-cases.txt	(revision 103a0b01aacb82e91d4a8a969004d5972d1cf30f)
+++ park_integration/docs/use-cases.txt	(revision 103a0b01aacb82e91d4a8a969004d5972d1cf30f)
@@ -0,0 +1,121 @@
+1.	Use Case 1: 1 data set and 1 model
+
+This use case describes an application (the client) performing a fit on a single
+data set with a single model.
+
+1.1.	Flow of Events
+1.1.1.	Basic Flow
+1.1.1.1.	The client chooses a data set to fit.
+1.1.1.2.	The client chooses a model to use.
+1.1.1.3.	The client enters the initial parameters of the model.
+1.1.1.4.	The client starts the fit.
+1.1.1.5.	The client reads back the fit results from the fitting object.
+
+
+1.1.2.	Alternative Flows
+
+Any of the following actions can take place:
+
+1.1.2.1.	The client does not enter initial parameters
+
+
+1.1.3. Error Conditions
+1.1.3.1. 	The user does not choose a data set before starting the fit.
+1.1.3.2. 	The user does not choose a model before starting the fit.
+
+
+1.2.	Special requirements
+1.2.1.	Preconditions
+None
+
+1.2.2.	Post Conditions
+The client now has a fitting object that contains the results of his fit.
+He can modify that object and perform another fit.
+It will be possible for him to use the fit output as the initial parameters
+for any subsequent fit.
+
+
+2.	Use Case 2: 2 data sets and 1 model
+
+This use case describes an application (the client) performing a fit on multiple
+data sets with a single model.
+
+2.1.	Flow of Events
+2.1.1.	Basic Flow
+2.1.1.1.	The client chooses two data sets to fit.
+2.1.1.2.	The client chooses a model to use.
+2.1.1.3.	The client enters the initial parameters of the model.
+2.1.1.4.	The client starts the fit.
+2.1.1.5.	The client reads back the fit results from the fitting object.
+
+
+2.1.2.	Alternative Flows
+
+Any of the following actions can take place:
+
+2.1.2.1.	The client does not enter initial parameters
+
+
+2.1.3. Error Conditions
+2.1.3.1. 	The user does not choose a data set before starting the fit.
+2.1.3.2. 	The user does not choose a model before starting the fit.
+
+
+2.2.	Special requirements
+2.2.1.	Preconditions
+None
+
+2.2.2.	Post Conditions
+The client now has a fitting object that contains the results of his fit.
+He can modify that object and perform another fit.
+It will be possible for him to use the fit output as the initial parameters
+for any subsequent fit.
+
+
+3.	Use Case 3: 2 data sets, 2 models and one constraint
+
+This use case describes an application (the client) performing a fit on multiple
+data sets with a single model.
+
+3.1.	Flow of Events
+3.1.1.	Basic Flow
+3.1.1.1.	The client chooses two data sets to fit.
+3.1.1.2.	The client chooses one model to use with each data set.
+3.1.1.3.	The client enters the initial parameters of the models.
+3.1.1.4		The client enters a string describing a condition between the two models.
+3.1.1.5.	The client starts the fit.
+3.1.1.6.	The client reads back the fit results from the fitting object.
+
+
+3.1.2.	Alternative Flows
+
+Any of the following actions can take place:
+
+3.1.2.1.	The client does not enter initial parameters for one or both models
+
+
+3.1.3. Error Conditions
+3.1.3.1. 	The user does not choose a data set before starting the fit.
+3.1.3.2. 	The user does not choose a model before starting the fit.
+3.1.3.3. 	The user does not choose a model for one of the data sets.
+
+
+3.2.	Special requirements
+3.2.1.	Preconditions
+None
+
+3.2.2.	Post Conditions
+The client now has a fitting object that contains the results of his fit.
+He can modify that object and perform another fit.
+It will be possible for him to use the fit output as the initial parameters
+for any subsequent fit.
+
+Note: The test-case for this should use the testdata_generator module in the
+test directory and use two models:
+      1- A Line: Y = A*x + B for the file "testdata_line.txt"
+      2- A constant: Y = A for the file "testdata_cst.txt"
+The constraint should be that parameter "A" has the same value for both models.
+
+
+
+
Index: park_integration/test/testdata_cst.txt
===================================================================
--- park_integration/test/testdata_cst.txt	(revision 103a0b01aacb82e91d4a8a969004d5972d1cf30f)
+++ park_integration/test/testdata_cst.txt	(revision 103a0b01aacb82e91d4a8a969004d5972d1cf30f)
@@ -0,0 +1,52 @@
+#y=A
+#A=2.5
+0  2.5852  0.375
+0.204082  2.19143  0.375
+0.408163  2.57106  0.375
+0.612245  2.51277  0.375
+0.816327  2.26897  0.375
+1.02041  2.20776  0.375
+1.22449  2.45739  0.375
+1.42857  2.15075  0.375
+1.63265  1.86874  0.375
+1.83673  2.33998  0.375
+2.04082  1.62786  0.375
+2.2449  2.72658  0.375
+2.44898  2.48138  0.375
+2.65306  2.81075  0.375
+2.85714  2.25486  0.375
+3.06122  2.17361  0.375
+3.26531  2.1977  0.375
+3.46939  3.16184  0.375
+3.67347  3.00213  0.375
+3.87755  2.1984  0.375
+4.08163  2.76865  0.375
+4.28571  2.35003  0.375
+4.4898  2.98548  0.375
+4.69388  3.15354  0.375
+4.89796  2.87848  0.375
+5.10204  2.00554  0.375
+5.30612  2.384  0.375
+5.5102  2.56871  0.375
+5.71429  2.57468  0.375
+5.91837  2.02424  0.375
+6.12245  2.81453  0.375
+6.32653  1.79367  0.375
+6.53061  2.23765  0.375
+6.73469  2.36467  0.375
+6.93878  2.89383  0.375
+7.14286  2.43143  0.375
+7.34694  2.66729  0.375
+7.55102  2.85271  0.375
+7.7551  2.23553  0.375
+7.95918  2.37953  0.375
+8.16327  2.55255  0.375
+8.36735  1.83512  0.375
+8.57143  2.82562  0.375
+8.77551  2.36114  0.375
+8.97959  2.58935  0.375
+9.18367  2.19231  0.375
+9.38776  2.92396  0.375
+9.59184  2.48175  0.375
+9.79592  1.90806  0.375
+10  3.02146  0.375
Index: park_integration/test/testdata_generator.py
===================================================================
--- park_integration/test/testdata_generator.py	(revision 103a0b01aacb82e91d4a8a969004d5972d1cf30f)
+++ park_integration/test/testdata_generator.py	(revision 103a0b01aacb82e91d4a8a969004d5972d1cf30f)
@@ -0,0 +1,67 @@
+"""
+    Generate two correlated sets of data
+        1- A line: y = ax + b
+        2- A constant equal to a of set #1
+        
+"""
+
+class Generator:
+    ## Parameter A
+    constant_a = 2.5
+    ## Parameter B
+    constant_b = 4.0
+    ## Randomness factor
+    randomness = 0.15
+    
+    def __init__(self):
+        pass
+    
+    def create(self, filename, xmin=0.0, xmax=10.0, npts=50):
+        """
+            Create files with the generate data
+            The file names will be:
+                - Set #1: [filename]_line.txt
+                - Set #2: [filename]_cst.txt
+                
+            @param filename: string to prepend to the file name
+            @param xmin: minimum x-value
+            @param xmax: maximum x-value
+            @param npts: number of points to generate
+        """
+        import random, time
+        random.seed(time.time())
+        
+        # Write line data set
+        fd = open(filename+'_line.txt', 'w')
+        fd.write("#y=A*x+B\n#A=%g\n#B=%g\n" % (self.constant_a, self.constant_b))
+        
+        for i in range(npts):
+            x = xmin+(xmax-xmin)/(npts-1)*i
+            mu = self.constant_a*x+self.constant_b
+            err = self.randomness*mu
+            y = random.gauss(mu, err)
+            fd.write("%g  %g  %g\n" % (x,y,err))
+            
+        fd.close()
+        
+        # Write constant data set
+        fd = open(filename+'_cst.txt', 'w')
+        fd.write("#y=A\n#A=%g\n" % self.constant_a)
+        
+        for i in range(npts):
+            x = xmin+(xmax-xmin)/(npts-1)*i
+            err = self.randomness*self.constant_a
+            y = random.gauss(self.constant_a, err)
+            fd.write("%g  %g  %g\n" % (x,y,err))
+            
+        fd.close()
+        
+        
+
+if __name__ == "__main__": 
+    gen = Generator()
+    gen.create("testdata")
+    print "Files created"
+
+            
+            
Index: park_integration/test/testdata_line.txt
===================================================================
--- park_integration/test/testdata_line.txt	(revision 103a0b01aacb82e91d4a8a969004d5972d1cf30f)
+++ park_integration/test/testdata_line.txt	(revision 103a0b01aacb82e91d4a8a969004d5972d1cf30f)
@@ -0,0 +1,53 @@
+#y=A*x+B
+#A=2.5
+#B=4
+0  2.83954  0.6
+0.204082  3.44938  0.676531
+0.408163  5.82026  0.753061
+0.612245  5.27591  0.829592
+0.816327  5.2781  0.906122
+1.02041  5.22531  0.982653
+1.22449  7.47487  1.05918
+1.42857  7.85852  1.13571
+1.63265  10.2278  1.21224
+1.83673  8.33195  1.28878
+2.04082  9.22407  1.36531
+2.2449  7.95013  1.44184
+2.44898  10.0289  1.51837
+2.65306  11.0736  1.5949
+2.85714  12.2957  1.67143
+3.06122  12.3108  1.74796
+3.26531  12.6916  1.82449
+3.46939  12.5859  1.90102
+3.67347  14.5972  1.97755
+3.87755  10.9443  2.05408
+4.08163  11.4356  2.13061
+4.28571  19.3213  2.20714
+4.4898  14.3191  2.28367
+4.69388  14.6961  2.3602
+4.89796  19.27  2.43673
+5.10204  12.1831  2.51327
+5.30612  21.4745  2.5898
+5.5102  20.0393  2.66633
+5.71429  13.2472  2.74286
+5.91837  14.9428  2.81939
+6.12245  22.1974  2.89592
+6.32653  17.3418  2.97245
+6.53061  19.8174  3.04898
+6.73469  17.6186  3.12551
+6.93878  21.329  3.20204
+7.14286  20.2873  3.27857
+7.34694  23.4112  3.3551
+7.55102  26.063  3.43163
+7.7551  29.8775  3.50816
+7.95918  19.0027  3.58469
+8.16327  19.4248  3.66122
+8.36735  27.4876  3.73776
+8.57143  33.8399  3.81429
+8.77551  24.2611  3.89082
+8.97959  29.8796  3.96735
+9.18367  24.6149  4.04388
+9.38776  35.7664  4.12041
+9.59184  32.145  4.19694
+9.79592  24.8085  4.27347
+10  31.3767  4.35
