Index: sansview/ testdata_line1.txt
===================================================================
--- sansview/ testdata_line1.txt	(revision d89f09b35713186021727a80260c3d5a38746821)
+++ sansview/ testdata_line1.txt	(revision d89f09b35713186021727a80260c3d5a38746821)
@@ -0,0 +1,47 @@
+#y=A*x+B
+#A=2.5
+#B=4
+0  2.83954  0.6
+0.204082  3.44938  0.6
+0.408163  5.82026  0.7
+0.612245  5.27591  0.8
+0.816327  5.2781  0.906122
+1.02041  5.22531  0.982653
+1.22449  7.47487  1
+1.42857  7.85852  1.13571
+1.63265  10.2278  1.21224
+1.83673  8.33195  1.28878
+2.04082  9.22407  1.36
+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
+
+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 3.04898
+6.73469  17.6186  3.12551
+6.93878  21  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
+
Index: sansview/.project
===================================================================
--- sansview/.project	(revision d89f09b35713186021727a80260c3d5a38746821)
+++ sansview/.project	(revision d89f09b35713186021727a80260c3d5a38746821)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>miniview2</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: sansview/.pydevproject
===================================================================
--- sansview/.pydevproject	(revision d89f09b35713186021727a80260c3d5a38746821)
+++ sansview/.pydevproject	(revision d89f09b35713186021727a80260c3d5a38746821)
@@ -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>/miniview2/src</path>
+</pydev_pathproperty>
+<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.5</pydev_property>
+</pydev_project>
Index: sansview/_THETA_weights.txt
===================================================================
--- sansview/_THETA_weights.txt	(revision d89f09b35713186021727a80260c3d5a38746821)
+++ sansview/_THETA_weights.txt	(revision d89f09b35713186021727a80260c3d5a38746821)
@@ -0,0 +1,1000 @@
+0  1
+0.00157237  0.999999
+0.00314474  0.999995
+0.00471712  0.999989
+0.00628949  0.99998
+0.00786186  0.999969
+0.00943423  0.999955
+0.0110066  0.999939
+0.012579  0.999921
+0.0141514  0.9999
+0.0157237  0.999876
+0.0172961  0.99985
+0.0188685  0.999822
+0.0204408  0.999791
+0.0220132  0.999758
+0.0235856  0.999722
+0.025158  0.999684
+0.0267303  0.999643
+0.0283027  0.9996
+0.0298751  0.999554
+0.0314474  0.999506
+0.0330198  0.999455
+0.0345922  0.999402
+0.0361646  0.999346
+0.0377369  0.999288
+0.0393093  0.999228
+0.0408817  0.999165
+0.0424541  0.999099
+0.0440264  0.999031
+0.0455988  0.998961
+0.0471712  0.998888
+0.0487435  0.998813
+0.0503159  0.998735
+0.0518883  0.998655
+0.0534607  0.998572
+0.055033  0.998487
+0.0566054  0.998399
+0.0581778  0.998309
+0.0597502  0.998217
+0.0613225  0.998122
+0.0628949  0.998024
+0.0644673  0.997924
+0.0660396  0.997822
+0.067612  0.997717
+0.0691844  0.99761
+0.0707568  0.9975
+0.0723291  0.997388
+0.0739015  0.997273
+0.0754739  0.997156
+0.0770462  0.997036
+0.0786186  0.996914
+0.080191  0.99679
+0.0817634  0.996663
+0.0833357  0.996534
+0.0849081  0.996402
+0.0864805  0.996268
+0.0880529  0.996131
+0.0896252  0.995992
+0.0911976  0.99585
+0.09277  0.995706
+0.0943423  0.99556
+0.0959147  0.995411
+0.0974871  0.995259
+0.0990595  0.995106
+0.100632  0.994949
+0.102204  0.994791
+0.103777  0.99463
+0.105349  0.994466
+0.106921  0.9943
+0.108494  0.994132
+0.110066  0.993961
+0.111638  0.993788
+0.113211  0.993612
+0.114783  0.993434
+0.116356  0.993254
+0.117928  0.993071
+0.1195  0.992885
+0.121073  0.992697
+0.122645  0.992507
+0.124217  0.992315
+0.12579  0.99212
+0.127362  0.991922
+0.128935  0.991722
+0.130507  0.99152
+0.132079  0.991315
+0.133652  0.991108
+0.135224  0.990899
+0.136796  0.990687
+0.138369  0.990473
+0.139941  0.990256
+0.141514  0.990037
+0.143086  0.989815
+0.144658  0.989592
+0.146231  0.989365
+0.147803  0.989137
+0.149375  0.988906
+0.150948  0.988672
+0.15252  0.988436
+0.154092  0.988198
+0.155665  0.987957
+0.157237  0.987714
+0.15881  0.987469
+0.160382  0.987221
+0.161954  0.986971
+0.163527  0.986718
+0.165099  0.986464
+0.166671  0.986206
+0.168244  0.985947
+0.169816  0.985685
+0.171389  0.98542
+0.172961  0.985154
+0.174533  0.984884
+0.176106  0.984613
+0.177678  0.984339
+0.17925  0.984063
+0.180823  0.983784
+0.182395  0.983504
+0.183968  0.98322
+0.18554  0.982935
+0.187112  0.982647
+0.188685  0.982357
+0.190257  0.982064
+0.191829  0.981769
+0.193402  0.981472
+0.194974  0.981172
+0.196547  0.98087
+0.198119  0.980566
+0.199691  0.980259
+0.201264  0.97995
+0.202836  0.979639
+0.204408  0.979325
+0.205981  0.979009
+0.207553  0.978691
+0.209126  0.978371
+0.210698  0.978048
+0.21227  0.977723
+0.213843  0.977395
+0.215415  0.977065
+0.216987  0.976733
+0.21856  0.976399
+0.220132  0.976062
+0.221705  0.975723
+0.223277  0.975382
+0.224849  0.975038
+0.226422  0.974692
+0.227994  0.974344
+0.229566  0.973994
+0.231139  0.973641
+0.232711  0.973286
+0.234283  0.972929
+0.235856  0.972569
+0.237428  0.972207
+0.239001  0.971843
+0.240573  0.971477
+0.242145  0.971108
+0.243718  0.970738
+0.24529  0.970364
+0.246862  0.969989
+0.248435  0.969611
+0.250007  0.969231
+0.25158  0.968849
+0.253152  0.968465
+0.254724  0.968078
+0.256297  0.96769
+0.257869  0.967298
+0.259441  0.966905
+0.261014  0.96651
+0.262586  0.966112
+0.264159  0.965712
+0.265731  0.96531
+0.267303  0.964905
+0.268876  0.964498
+0.270448  0.96409
+0.27202  0.963678
+0.273593  0.963265
+0.275165  0.96285
+0.276738  0.962432
+0.27831  0.962012
+0.279882  0.96159
+0.281455  0.961166
+0.283027  0.960739
+0.284599  0.960311
+0.286172  0.95988
+0.287744  0.959447
+0.289317  0.959012
+0.290889  0.958574
+0.292461  0.958135
+0.294034  0.957693
+0.295606  0.957249
+0.297178  0.956803
+0.298751  0.956355
+0.300323  0.955905
+0.301895  0.955452
+0.303468  0.954998
+0.30504  0.954541
+0.306613  0.954082
+0.308185  0.953621
+0.309757  0.953158
+0.31133  0.952692
+0.312902  0.952225
+0.314474  0.951756
+0.316047  0.951284
+0.317619  0.95081
+0.319192  0.950334
+0.320764  0.949856
+0.322336  0.949376
+0.323909  0.948894
+0.325481  0.948409
+0.327053  0.947923
+0.328626  0.947435
+0.330198  0.946944
+0.331771  0.946451
+0.333343  0.945956
+0.334915  0.94546
+0.336488  0.944961
+0.33806  0.94446
+0.339632  0.943957
+0.341205  0.943451
+0.342777  0.942944
+0.34435  0.942435
+0.345922  0.941924
+0.347494  0.94141
+0.349067  0.940895
+0.350639  0.940378
+0.352211  0.939858
+0.353784  0.939337
+0.355356  0.938813
+0.356929  0.938287
+0.358501  0.93776
+0.360073  0.93723
+0.361646  0.936699
+0.363218  0.936165
+0.36479  0.935629
+0.366363  0.935092
+0.367935  0.934552
+0.369508  0.93401
+0.37108  0.933467
+0.372652  0.932921
+0.374225  0.932373
+0.375797  0.931824
+0.377369  0.931272
+0.378942  0.930718
+0.380514  0.930163
+0.382086  0.929605
+0.383659  0.929046
+0.385231  0.928485
+0.386804  0.927921
+0.388376  0.927356
+0.389948  0.926789
+0.391521  0.926219
+0.393093  0.925648
+0.394665  0.925075
+0.396238  0.9245
+0.39781  0.923923
+0.399383  0.923344
+0.400955  0.922763
+0.402527  0.922181
+0.4041  0.921596
+0.405672  0.92101
+0.407244  0.920421
+0.408817  0.919831
+0.410389  0.919239
+0.411962  0.918644
+0.413534  0.918048
+0.415106  0.917451
+0.416679  0.916851
+0.418251  0.916249
+0.419823  0.915646
+0.421396  0.91504
+0.422968  0.914433
+0.424541  0.913824
+0.426113  0.913213
+0.427685  0.9126
+0.429258  0.911986
+0.43083  0.911369
+0.432402  0.910751
+0.433975  0.910131
+0.435547  0.909509
+0.43712  0.908885
+0.438692  0.908259
+0.440264  0.907632
+0.441837  0.907003
+0.443409  0.906372
+0.444981  0.905739
+0.446554  0.905104
+0.448126  0.904468
+0.449698  0.90383
+0.451271  0.90319
+0.452843  0.902548
+0.454416  0.901904
+0.455988  0.901259
+0.45756  0.900612
+0.459133  0.899963
+0.460705  0.899313
+0.462277  0.89866
+0.46385  0.898006
+0.465422  0.89735
+0.466995  0.896693
+0.468567  0.896033
+0.470139  0.895372
+0.471712  0.89471
+0.473284  0.894045
+0.474856  0.893379
+0.476429  0.892711
+0.478001  0.892042
+0.479574  0.89137
+0.481146  0.890697
+0.482718  0.890023
+0.484291  0.889346
+0.485863  0.888668
+0.487435  0.887988
+0.489008  0.887307
+0.49058  0.886624
+0.492153  0.885939
+0.493725  0.885253
+0.495297  0.884565
+0.49687  0.883875
+0.498442  0.883184
+0.500014  0.882491
+0.501587  0.881796
+0.503159  0.8811
+0.504732  0.880402
+0.506304  0.879702
+0.507876  0.879001
+0.509449  0.878298
+0.511021  0.877594
+0.512593  0.876888
+0.514166  0.87618
+0.515738  0.875471
+0.517311  0.874761
+0.518883  0.874048
+0.520455  0.873334
+0.522028  0.872619
+0.5236  0.871902
+0.525172  0.871183
+0.526745  0.870463
+0.528317  0.869741
+0.529889  0.869018
+0.531462  0.868293
+0.533034  0.867567
+0.534607  0.866839
+0.536179  0.866109
+0.537751  0.865379
+0.539324  0.864646
+0.540896  0.863912
+0.542468  0.863177
+0.544041  0.86244
+0.545613  0.861701
+0.547186  0.860961
+0.548758  0.86022
+0.55033  0.859477
+0.551903  0.858732
+0.553475  0.857986
+0.555047  0.857239
+0.55662  0.85649
+0.558192  0.85574
+0.559765  0.854988
+0.561337  0.854234
+0.562909  0.85348
+0.564482  0.852724
+0.566054  0.851966
+0.567626  0.851207
+0.569199  0.850447
+0.570771  0.849685
+0.572344  0.848921
+0.573916  0.848157
+0.575488  0.847391
+0.577061  0.846623
+0.578633  0.845854
+0.580205  0.845084
+0.581778  0.844312
+0.58335  0.843539
+0.584923  0.842765
+0.586495  0.841989
+0.588067  0.841212
+0.58964  0.840433
+0.591212  0.839654
+0.592784  0.838872
+0.594357  0.83809
+0.595929  0.837306
+0.597502  0.836521
+0.599074  0.835734
+0.600646  0.834946
+0.602219  0.834157
+0.603791  0.833366
+0.605363  0.832575
+0.606936  0.831781
+0.608508  0.830987
+0.61008  0.830191
+0.611653  0.829394
+0.613225  0.828596
+0.614798  0.827796
+0.61637  0.826996
+0.617942  0.826193
+0.619515  0.82539
+0.621087  0.824585
+0.622659  0.823779
+0.624232  0.822972
+0.625804  0.822164
+0.627377  0.821354
+0.628949  0.820543
+0.630521  0.819731
+0.632094  0.818918
+0.633666  0.818104
+0.635238  0.817288
+0.636811  0.816471
+0.638383  0.815653
+0.639956  0.814833
+0.641528  0.814013
+0.6431  0.813191
+0.644673  0.812368
+0.646245  0.811544
+0.647817  0.810719
+0.64939  0.809893
+0.650962  0.809065
+0.652535  0.808236
+0.654107  0.807407
+0.655679  0.806576
+0.657252  0.805743
+0.658824  0.80491
+0.660396  0.804076
+0.661969  0.80324
+0.663541  0.802404
+0.665114  0.801566
+0.666686  0.800727
+0.668258  0.799887
+0.669831  0.799046
+0.671403  0.798204
+0.672975  0.797361
+0.674548  0.796517
+0.67612  0.795671
+0.677692  0.794825
+0.679265  0.793977
+0.680837  0.793129
+0.68241  0.792279
+0.683982  0.791429
+0.685554  0.790577
+0.687127  0.789724
+0.688699  0.78887
+0.690271  0.788016
+0.691844  0.78716
+0.693416  0.786303
+0.694989  0.785445
+0.696561  0.784586
+0.698133  0.783727
+0.699706  0.782866
+0.701278  0.782004
+0.70285  0.781141
+0.704423  0.780277
+0.705995  0.779413
+0.707568  0.778547
+0.70914  0.77768
+0.710712  0.776813
+0.712285  0.775944
+0.713857  0.775075
+0.715429  0.774204
+0.717002  0.773333
+0.718574  0.77246
+0.720147  0.771587
+0.721719  0.770713
+0.723291  0.769838
+0.724864  0.768962
+0.726436  0.768085
+0.728008  0.767207
+0.729581  0.766329
+0.731153  0.765449
+0.732726  0.764569
+0.734298  0.763687
+0.73587  0.762805
+0.737443  0.761922
+0.739015  0.761038
+0.740587  0.760154
+0.74216  0.759268
+0.743732  0.758381
+0.745305  0.757494
+0.746877  0.756606
+0.748449  0.755717
+0.750022  0.754827
+0.751594  0.753937
+0.753166  0.753045
+0.754739  0.752153
+0.756311  0.75126
+0.757883  0.750366
+0.759456  0.749472
+0.761028  0.748576
+0.762601  0.74768
+0.764173  0.746783
+0.765745  0.745886
+0.767318  0.744987
+0.76889  0.744088
+0.770462  0.743188
+0.772035  0.742287
+0.773607  0.741386
+0.77518  0.740484
+0.776752  0.739581
+0.778324  0.738677
+0.779897  0.737773
+0.781469  0.736868
+0.783041  0.735962
+0.784614  0.735055
+0.786186  0.734148
+0.787759  0.73324
+0.789331  0.732332
+0.790903  0.731422
+0.792476  0.730513
+0.794048  0.729602
+0.79562  0.728691
+0.797193  0.727779
+0.798765  0.726866
+0.800338  0.725953
+0.80191  0.725039
+0.803482  0.724125
+0.805055  0.723209
+0.806627  0.722294
+0.808199  0.721377
+0.809772  0.72046
+0.811344  0.719543
+0.812917  0.718624
+0.814489  0.717705
+0.816061  0.716786
+0.817634  0.715866
+0.819206  0.714945
+0.820778  0.714024
+0.822351  0.713102
+0.823923  0.71218
+0.825495  0.711257
+0.827068  0.710334
+0.82864  0.70941
+0.830213  0.708485
+0.831785  0.70756
+0.833357  0.706634
+0.83493  0.705708
+0.836502  0.704781
+0.838074  0.703854
+0.839647  0.702926
+0.841219  0.701998
+0.842792  0.701069
+0.844364  0.70014
+0.845936  0.69921
+0.847509  0.69828
+0.849081  0.697349
+0.850653  0.696418
+0.852226  0.695486
+0.853798  0.694554
+0.855371  0.693621
+0.856943  0.692688
+0.858515  0.691754
+0.860088  0.69082
+0.86166  0.689886
+0.863232  0.688951
+0.864805  0.688016
+0.866377  0.68708
+0.86795  0.686144
+0.869522  0.685207
+0.871094  0.68427
+0.872667  0.683333
+0.874239  0.682395
+0.875811  0.681457
+0.877384  0.680518
+0.878956  0.679579
+0.880529  0.678639
+0.882101  0.6777
+0.883673  0.67676
+0.885246  0.675819
+0.886818  0.674878
+0.88839  0.673937
+0.889963  0.672995
+0.891535  0.672053
+0.893108  0.671111
+0.89468  0.670169
+0.896252  0.669226
+0.897825  0.668282
+0.899397  0.667339
+0.900969  0.666395
+0.902542  0.665451
+0.904114  0.664506
+0.905686  0.663561
+0.907259  0.662616
+0.908831  0.661671
+0.910404  0.660725
+0.911976  0.659779
+0.913548  0.658833
+0.915121  0.657886
+0.916693  0.65694
+0.918265  0.655993
+0.919838  0.655045
+0.92141  0.654098
+0.922983  0.65315
+0.924555  0.652202
+0.926127  0.651254
+0.9277  0.650305
+0.929272  0.649357
+0.930844  0.648408
+0.932417  0.647459
+0.933989  0.646509
+0.935562  0.64556
+0.937134  0.64461
+0.938706  0.64366
+0.940279  0.64271
+0.941851  0.641759
+0.943423  0.640809
+0.944996  0.639858
+0.946568  0.638907
+0.948141  0.637956
+0.949713  0.637005
+0.951285  0.636054
+0.952858  0.635103
+0.95443  0.634151
+0.956002  0.633199
+0.957575  0.632247
+0.959147  0.631295
+0.96072  0.630343
+0.962292  0.629391
+0.963864  0.628438
+0.965437  0.627486
+0.967009  0.626533
+0.968581  0.625581
+0.970154  0.624628
+0.971726  0.623675
+0.973298  0.622722
+0.974871  0.621769
+0.976443  0.620816
+0.978016  0.619863
+0.979588  0.618909
+0.98116  0.617956
+0.982733  0.617003
+0.984305  0.616049
+0.985877  0.615096
+0.98745  0.614142
+0.989022  0.613189
+0.990595  0.612235
+0.992167  0.611282
+0.993739  0.610328
+0.995312  0.609374
+0.996884  0.608421
+0.998456  0.607467
+1.00003  0.606513
+1.0016  0.605559
+1.00317  0.604606
+1.00475  0.603652
+1.00632  0.602698
+1.00789  0.601745
+1.00946  0.600791
+1.01104  0.599838
+1.01261  0.598884
+1.01418  0.597931
+1.01575  0.596977
+1.01732  0.596024
+1.0189  0.59507
+1.02047  0.594117
+1.02204  0.593164
+1.02361  0.59221
+1.02519  0.591257
+1.02676  0.590304
+1.02833  0.589351
+1.0299  0.588398
+1.03148  0.587446
+1.03305  0.586493
+1.03462  0.58554
+1.03619  0.584588
+1.03777  0.583635
+1.03934  0.582683
+1.04091  0.581731
+1.04248  0.580779
+1.04406  0.579827
+1.04563  0.578875
+1.0472  0.577923
+1.04877  0.576972
+1.05034  0.57602
+1.05192  0.575069
+1.05349  0.574118
+1.05506  0.573167
+1.05663  0.572216
+1.05821  0.571266
+1.05978  0.570315
+1.06135  0.569365
+1.06292  0.568415
+1.0645  0.567465
+1.06607  0.566515
+1.06764  0.565566
+1.06921  0.564617
+1.07079  0.563667
+1.07236  0.562718
+1.07393  0.56177
+1.0755  0.560821
+1.07708  0.559873
+1.07865  0.558925
+1.08022  0.557977
+1.08179  0.557029
+1.08336  0.556082
+1.08494  0.555135
+1.08651  0.554188
+1.08808  0.553241
+1.08965  0.552295
+1.09123  0.551349
+1.0928  0.550403
+1.09437  0.549457
+1.09594  0.548512
+1.09752  0.547567
+1.09909  0.546622
+1.10066  0.545678
+1.10223  0.544733
+1.10381  0.543789
+1.10538  0.542846
+1.10695  0.541902
+1.10852  0.540959
+1.11009  0.540017
+1.11167  0.539074
+1.11324  0.538132
+1.11481  0.53719
+1.11638  0.536249
+1.11796  0.535308
+1.11953  0.534367
+1.1211  0.533426
+1.12267  0.532486
+1.12425  0.531546
+1.12582  0.530607
+1.12739  0.529668
+1.12896  0.528729
+1.13054  0.527791
+1.13211  0.526853
+1.13368  0.525915
+1.13525  0.524978
+1.13683  0.524041
+1.1384  0.523104
+1.13997  0.522168
+1.14154  0.521232
+1.14311  0.520297
+1.14469  0.519362
+1.14626  0.518427
+1.14783  0.517493
+1.1494  0.516559
+1.15098  0.515626
+1.15255  0.514693
+1.15412  0.513761
+1.15569  0.512828
+1.15727  0.511897
+1.15884  0.510965
+1.16041  0.510035
+1.16198  0.509104
+1.16356  0.508174
+1.16513  0.507245
+1.1667  0.506316
+1.16827  0.505387
+1.16985  0.504459
+1.17142  0.503531
+1.17299  0.502604
+1.17456  0.501677
+1.17613  0.500751
+1.17771  0.499825
+1.17928  0.4989
+1.18085  0.497975
+1.18242  0.497051
+1.184  0.496127
+1.18557  0.495203
+1.18714  0.494281
+1.18871  0.493358
+1.19029  0.492436
+1.19186  0.491515
+1.19343  0.490594
+1.195  0.489674
+1.19658  0.488754
+1.19815  0.487835
+1.19972  0.486916
+1.20129  0.485997
+1.20286  0.48508
+1.20444  0.484163
+1.20601  0.483246
+1.20758  0.48233
+1.20915  0.481414
+1.21073  0.480499
+1.2123  0.479585
+1.21387  0.478671
+1.21544  0.477758
+1.21702  0.476845
+1.21859  0.475933
+1.22016  0.475021
+1.22173  0.47411
+1.22331  0.473199
+1.22488  0.472289
+1.22645  0.47138
+1.22802  0.470471
+1.2296  0.469563
+1.23117  0.468656
+1.23274  0.467749
+1.23431  0.466842
+1.23588  0.465937
+1.23746  0.465032
+1.23903  0.464127
+1.2406  0.463223
+1.24217  0.46232
+1.24375  0.461417
+1.24532  0.460515
+1.24689  0.459614
+1.24846  0.458713
+1.25004  0.457813
+1.25161  0.456913
+1.25318  0.456014
+1.25475  0.455116
+1.25633  0.454219
+1.2579  0.453322
+1.25947  0.452425
+1.26104  0.45153
+1.26262  0.450635
+1.26419  0.44974
+1.26576  0.448847
+1.26733  0.447954
+1.2689  0.447061
+1.27048  0.44617
+1.27205  0.445279
+1.27362  0.444389
+1.27519  0.443499
+1.27677  0.44261
+1.27834  0.441722
+1.27991  0.440834
+1.28148  0.439947
+1.28306  0.439061
+1.28463  0.438176
+1.2862  0.437291
+1.28777  0.436407
+1.28935  0.435524
+1.29092  0.434641
+1.29249  0.433759
+1.29406  0.432878
+1.29563  0.431998
+1.29721  0.431118
+1.29878  0.430239
+1.30035  0.429361
+1.30192  0.428483
+1.3035  0.427607
+1.30507  0.42673
+1.30664  0.425855
+1.30821  0.424981
+1.30979  0.424107
+1.31136  0.423234
+1.31293  0.422361
+1.3145  0.42149
+1.31608  0.420619
+1.31765  0.419749
+1.31922  0.41888
+1.32079  0.418011
+1.32237  0.417144
+1.32394  0.416277
+1.32551  0.41541
+1.32708  0.414545
+1.32865  0.41368
+1.33023  0.412817
+1.3318  0.411953
+1.33337  0.411091
+1.33494  0.41023
+1.33652  0.409369
+1.33809  0.408509
+1.33966  0.40765
+1.34123  0.406792
+1.34281  0.405934
+1.34438  0.405078
+1.34595  0.404222
+1.34752  0.403367
+1.3491  0.402512
+1.35067  0.401659
+1.35224  0.400806
+1.35381  0.399955
+1.35538  0.399104
+1.35696  0.398253
+1.35853  0.397404
+1.3601  0.396556
+1.36167  0.395708
+1.36325  0.394861
+1.36482  0.394015
+1.36639  0.39317
+1.36796  0.392326
+1.36954  0.391482
+1.37111  0.39064
+1.37268  0.389798
+1.37425  0.388957
+1.37583  0.388117
+1.3774  0.387278
+1.37897  0.38644
+1.38054  0.385602
+1.38212  0.384765
+1.38369  0.38393
+1.38526  0.383095
+1.38683  0.382261
+1.3884  0.381428
+1.38998  0.380595
+1.39155  0.379764
+1.39312  0.378934
+1.39469  0.378104
+1.39627  0.377275
+1.39784  0.376447
+1.39941  0.37562
+1.40098  0.374794
+1.40256  0.373969
+1.40413  0.373145
+1.4057  0.372322
+1.40727  0.371499
+1.40885  0.370677
+1.41042  0.369857
+1.41199  0.369037
+1.41356  0.368218
+1.41514  0.3674
+1.41671  0.366583
+1.41828  0.365767
+1.41985  0.364952
+1.42142  0.364137
+1.423  0.363324
+1.42457  0.362512
+1.42614  0.3617
+1.42771  0.360889
+1.42929  0.36008
+1.43086  0.359271
+1.43243  0.358463
+1.434  0.357656
+1.43558  0.35685
+1.43715  0.356045
+1.43872  0.355241
+1.44029  0.354438
+1.44187  0.353636
+1.44344  0.352834
+1.44501  0.352034
+1.44658  0.351235
+1.44815  0.350436
+1.44973  0.349639
+1.4513  0.348842
+1.45287  0.348047
+1.45444  0.347252
+1.45602  0.346458
+1.45759  0.345666
+1.45916  0.344874
+1.46073  0.344083
+1.46231  0.343293
+1.46388  0.342505
+1.46545  0.341717
+1.46702  0.34093
+1.4686  0.340144
+1.47017  0.339359
+1.47174  0.338575
+1.47331  0.337792
+1.47489  0.33701
+1.47646  0.336229
+1.47803  0.335449
+1.4796  0.33467
+1.48117  0.333891
+1.48275  0.333114
+1.48432  0.332338
+1.48589  0.331563
+1.48746  0.330789
+1.48904  0.330016
+1.49061  0.329244
+1.49218  0.328472
+1.49375  0.327702
+1.49533  0.326933
+1.4969  0.326165
+1.49847  0.325398
+1.50004  0.324631
+1.50162  0.323866
+1.50319  0.323102
+1.50476  0.322339
+1.50633  0.321577
+1.50791  0.320816
+1.50948  0.320055
+1.51105  0.319296
+1.51262  0.318538
+1.51419  0.317781
+1.51577  0.317025
+1.51734  0.31627
+1.51891  0.315516
+1.52048  0.314763
+1.52206  0.314011
+1.52363  0.31326
+1.5252  0.31251
+1.52677  0.311761
+1.52835  0.311013
+1.52992  0.310266
+1.53149  0.30952
+1.53306  0.308775
+1.53464  0.308032
+1.53621  0.307289
+1.53778  0.306547
+1.53935  0.305806
+1.54092  0.305067
+1.5425  0.304328
+1.54407  0.30359
+1.54564  0.302854
+1.54721  0.302118
+1.54879  0.301384
+1.55036  0.300651
+1.55193  0.299918
+1.5535  0.299187
+1.55508  0.298456
+1.55665  0.297727
+1.55822  0.296999
+1.55979  0.296272
+1.56137  0.295546
+1.56294  0.294821
+1.56451  0.294097
+1.56608  0.293374
+1.56766  0.292652
+1.56923  0.291931
+1.5708  0.291211
Index: sansview/cyl_testdata.txt
===================================================================
--- sansview/cyl_testdata.txt	(revision d89f09b35713186021727a80260c3d5a38746821)
+++ sansview/cyl_testdata.txt	(revision d89f09b35713186021727a80260c3d5a38746821)
@@ -0,0 +1,47 @@
+0.007778 1.78E+14 13335629 
+
+0.023333 5.32E+13 7293888 
+0.031111 3.40E+13 5833464 
+0.038889 2.18E+13 4673821 
+0.046667 1.36E+13 3694509 
+0.054444 8.21E+12 2864896 
+0.062222 4.61E+12 2147159 
+0.07 2.35E+12 1533773 
+0.077778 1.05E+12 1023851 
+0.085556 3.92E+11 626398.4 
+0.093333 1.47E+11 383624.8 
+0.101111 1.19E+11 344493.8 
+
+0.124444 2.58E+11 507633.7 
+0.132222 2.44E+11 493743.9 
+0.14 2.12E+11 459920.6 
+0.147778 1.64E+11 404771.5 
+0.155556 1.22E+11 348706.2 
+0.163333 8.30E+10 288011.8 
+0.171111 5.79E+10 240564.5 
+0.178889 4.41E+10 209959 
+0.186667 4.02E+10 200480.7 
+
+0.202222 5.33E+10 230891.5 
+0.21 4.99E+10 223441.9 
+0.217778 4.67E+10 216061.1 
+0.225556 3.93E+10 198298 
+0.233333 2.86E+10 169135.2 
+0.241111 1.79E+10 133639.4 
+0.248889 1.43E+10 119445.4 
+0.256667 9.39E+09 96907.02 
+0.264444 1.03E+10 101270.9 
+0.272222 1.03E+10 101272.4 
+0.28 9.56E+09 97788.34 
+0.287778 1.12E+10 105765.8 
+0.295556 1.05E+10 102300 
+0.303333 7.95E+09 89146.17 
+
+0.334444 7.92E+09 89019.55 
+0.342222 9.75E+09 98739.25 
+0.35 7.84E+09 88553.99 
+0.357778 9.78E+09 98905.86 
+0.365556 1.66E+10 128748.6 
+0.373333 9.66E+09 98285.04 
+0.381111 6.74E+09 82088.98 
+0.388889 6.26E+09 79142.34 
Index: sansview/cyl_testdata1.txt
===================================================================
--- sansview/cyl_testdata1.txt	(revision d89f09b35713186021727a80260c3d5a38746821)
+++ sansview/cyl_testdata1.txt	(revision d89f09b35713186021727a80260c3d5a38746821)
@@ -0,0 +1,54 @@
+0.007778 1.78E+14 13335629 
+0.015556 8.79E+13 9373745 
+0.023333 5.32E+13 7293888 
+0.031111 3.40E+13 5833464 
+0.038889 2.18E+13 4673821 
+0.046667 1.36E+13 3694509 
+0.054444 8.21E+12 2864896 
+0.062222 4.61E+12 2147159 
+0.07 2.35E+12 1533773 
+0.077778 1.05E+12 1023851 
+0.085556 3.92E+11 626398.4 
+0.093333 1.47E+11 383624.8 
+0.101111 1.19E+11 344493.8 
+0.108889 1.65E+11 405782 
+0.116667 2.33E+11 483191.5 
+0.124444 2.58E+11 507633.7 
+0.132222 2.44E+11 493743.9 
+0.14 2.12E+11 459920.6 
+0.147778 1.64E+11 404771.5 
+0.155556 1.22E+11 348706.2 
+0.163333 8.30E+10 288011.8 
+0.171111 5.79E+10 240564.5 
+0.178889 4.41E+10 209959 
+0.186667 4.02E+10 200480.7 
+0.194444 4.33E+10 208129.5 
+0.202222 5.33E+10 230891.5 
+0.21 4.99E+10 223441.9 
+0.217778 4.67E+10 216061.1 
+0.225556 3.93E+10 198298 
+0.233333 2.86E+10 169135.2 
+0.241111 1.79E+10 133639.4 
+0.248889 1.43E+10 119445.4 
+0.256667 9.39E+09 96907.02 
+0.264444 1.03E+10 101270.9 
+0.272222 1.03E+10 101272.4 
+0.28 9.56E+09 97788.34 
+0.287778 1.12E+10 105765.8 
+0.295556 1.05E+10 102300 
+0.303333 7.95E+09 89146.17 
+0.311111 5.42E+09 73599.25 
+0.318889 5.14E+09 71675.17 
+0.326667 5.81E+09 76192.06 
+0.334444 7.92E+09 89019.55 
+0.342222 9.75E+09 98739.25 
+0.35 7.84E+09 88553.99 
+0.357778 9.78E+09 98905.86 
+0.365556 1.66E+10 128748.6 
+0.373333 9.66E+09 98285.04 
+0.381111 6.74E+09 82088.98 
+0.388889 6.26E+09 79142.34 
+0.396667 7.47E+09 86426.79 
+0.404444 7.92E+09 88987.75 
+0.412222 7.04E+09 83895.53 
+0.42 4.67E+09 68340.98 
Index: sansview/cyl_testdata2.txt
===================================================================
--- sansview/cyl_testdata2.txt	(revision d89f09b35713186021727a80260c3d5a38746821)
+++ sansview/cyl_testdata2.txt	(revision d89f09b35713186021727a80260c3d5a38746821)
@@ -0,0 +1,50 @@
+0.007778 1.78E+14 13335629 
+0.015556 8.79E+13 9373745 
+0.023333 5.32E+13 7293888 
+0.031111 3.40E+13 5833464 
+0.038889 2.18E+13 4673821 
+0.046667 1.36E+13 3694509 
+0.054444 8.21E+12 2864896 
+0.062222 4.61E+12 2147159 
+0.07 2.35E+12 1533773 
+0.077778 1.05E+12 1023851 
+0.085556 3.92E+11 626398.4 
+0.093333 1.47E+11 383624.8 
+0.101111 1.19E+11 344493.8 
+0.108889 1.65E+11 405782 
+0.116667 2.33E+11 483191.5 
+0.124444 2.58E+11 507633.7 
+0.132222 2.44E+11 493743.9 
+0.14 2.12E+11 459920.6 
+0.147778 1.64E+11 404771.5 
+0.155556 1.22E+11 348706.2 
+0.163333 8.30E+10 288011.8 
+0.171111 5.79E+10 240564.5 
+0.178889 4.41E+10 209959 
+0.186667 4.02E+10 200480.7 
+0.194444 4.33E+10 208129.5 
+0.202222 5.33E+10 230891.5 
+0.21 4.99E+10 223441.9 
+0.217778 4.67E+10 216061.1 
+0.225556 3.93E+10 198298 
+0.233333 2.86E+10 169135.2 
+0.241111 1.79E+10 133639.4 
+0.248889 1.43E+10 119445.4 
+0.256667 9.39E+09 96907.02 
+0.264444 1.03E+10 101270.9 
+0.272222 1.03E+10 101272.4 
+0.28 9.56E+09 97788.34 
+0.287778 1.12E+10 105765.8 
+0.295556 1.05E+10 102300 
+0.303333 7.95E+09 89146.17 
+0.311111 5.42E+09 73599.25 
+0.318889 5.14E+09 71675.17 
+0.326667 5.81E+09 76192.06 
+0.334444 7.92E+09 89019.55 
+0.342222 9.75E+09 98739.25 
+0.35 7.84E+09 88553.99 
+0.357778 9.78E+09 98905.86 
+0.365556 1.66E+10 128748.6 
+0.373333 9.66E+09 98285.04 
+0.381111 6.74E+09 82088.98 
+0.388889 6.26E+09 79142.34 
Index: sansview/docs/notes.txt
===================================================================
--- sansview/docs/notes.txt	(revision d89f09b35713186021727a80260c3d5a38746821)
+++ sansview/docs/notes.txt	(revision d89f09b35713186021727a80260c3d5a38746821)
@@ -0,0 +1,107 @@
+Organisation
+
+  fitting module
+  	+
+  	|                        + - - + sim_page (from fitpanel2 import AUIPanel)
+  	+                        |
+  Fit_panel +- - -+ Notebook +
+  ( from fitpanel2           |
+    import FitPanel2)        |
+                             + -- + page(from fitpanel import Fitpanel)
+  
+  
+ Dictionary page_finder keys= page value= FitProblem(list of data ,theory.name and models )
+ 
+            +---------------------------------------------------------------------------+             
+ +-------+  |   +--------+       +------------+       +---------------+
+ |page   |+----+|  data  |+-----+|theory name |+-----+|[Models,M_name]|  FitProblem     |
+ +-------+  |   +--------+       +------------+       +---------------+      
+ |          +---------------------------------------------------------------------------+
+ +-------+      +--------+       +------------+       +---------------+
+ |page   |+----+|  data  |+-----+|theory name |+-----+|[Models,M_name]|
+ +-------+      +--------+       +------------+       +---------------+   
+ 
+ 
+ Dictionary was replace by class   
+ 
+1- [Problem] Data loaded from files of 2 columns do not have group_id as field.
+   thus will always generates a theory unattached to data (2 columns) 
+   
+2- [Problem] not fit able to fit 2 data and one model  since unable to select
+	 two data at the same time.       
+	 
+3- [Problem ] when fitting two model of same nature   how will the user entered the proper expression
+    Need a txtcrl to specify a new name for a each type model
+    example lineModel = M1
+    		lineModel = M2   
+ [solve] but can be improve?
+    
+    		
+ 4- I create a page given an group_id  so the 2 columns data need group_id to be add twice 
+ since for them i create a page call fit but if a page called fit is already added it will not
+ added again if a 2 nd data of 2 columns is selected    
+[Question] if  a page is not created should i post a status event message?  
+
+
+5- [To Do]take care of data range with park
+
+6- [Problem]when the user close the fitting panel and load a data and what to do the fit again with the 
+the panel fit does not show up automatically
+[solve]
+
+7- [To do ]we need a way to close tab may be a close button for current tab
+	[solve] close button added
+
+8- [Problem ] when selecting all check buttons manually , the main check button does
+ not changed accordingly
+ [FIXED]
+ 
+9- [Problem] when the user select a model first and want to perform a fit , we should fine a 
+ way to give the data the same group_id as the model loaded.
+ [ANSWER] the user will perferm the fit only starting by loading data
+ [tentative of answer]  when selecting a model from the menu is the draw in the separate 
+ window from data. it is only when selecting data that a fit page is added
+ 
+ 10- [Problem] How to tackle the problem the other way around? when the user select a model 
+ from the menu bar , does a new place has to be create to? which name to give to this page?
+ since when loading a data a new page is created?
+ []SAME ANSWER AS 9]
+
+ 11-[TO DO] when enter value in parameter fields redraw model 
+ [DONE]
+ 
+ 12-[TO DO] comment code and refine
+ 
+ 13- [UNABLE TO USE] post event on status bar and use calthread
+ [solve] except calthread
+ 
+ 14- [TO DO] more error checking
+ 
+ 15-[suggestion ] keep only one button close and close the current page except simpage 
+ [suggestion accepted]only one close button to close the current page
+ 
+ 
+ 16-[Question]redraw with evt_kill_focus or evt_text_enter
+ 
+ 17-[QUESTION] does the model need to be redraw when change fitting data range?
+[tentative of answer] _ontextEnter : when xmin and xmax changed redraw model
+[fixed]
+
+
+18-[Problem] when fitting cylinder model with cylinder data some fitting results are swapped
+[fixed] sort() method not remove yet
+
+19-[problem] when closing a windows model fitted doesn't disappear fron simpage
+[fixed]
+
+19-[Problem] how to catch not converging fitting? both scipy and park?
+ exception: raise LinAlgError, 'SVD did not converge'
+LinAlgError: SVD did not converge
+
+20- fitness class in Models was helping to overwrite a theory plot since always 
+has the same name: so do I put back fitness class or always name theory with fitness?
+
+21- [question] should the data being replot when changing xmin and xmax???
+
+22-[Question ] how to best design sim_page functionalities?
+23- [Question] how to use one object result from scipy? park returning one result
Index: sansview/local_config.py
===================================================================
--- sansview/local_config.py	(revision d89f09b35713186021727a80260c3d5a38746821)
+++ sansview/local_config.py	(revision d89f09b35713186021727a80260c3d5a38746821)
@@ -0,0 +1,57 @@
+"""
+    Application settings
+"""
+import time
+
+# Version of the application
+#__appname__ = "PrView"
+__appname__ = "FitView"
+__version__ = '0.1.1'
+__download_page__ = 'http://danse.chem.utk.edu'
+
+
+# Debug message flag
+__EVT_DEBUG__ = True
+
+# Flag for automated testing
+__TEST__ = False
+
+# Debug message should be written to a file?
+__EVT_DEBUG_2_FILE__   = False
+__EVT_DEBUG_FILENAME__ = "debug.log"
+
+# About box info
+_do_aboutbox=True
+_acknowledgement =  \
+'''This software was developed by the University of Tennessee as part of the
+Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
+project funded by the US National Science Foundation. 
+
+'''
+_homepage = "http://danse.chem.utk.edu"
+_download = "http://danse.chem.utk.edu/sansview.html"
+_authors = []
+_paper = "http://danse.us/trac/sans/newticket"
+_license = "mailto:sansdanse@gmail.com"
+
+_nsf_logo = "images/nsf_logo.png"
+_danse_logo = "images/danse_logo.png"
+_inst_logo = "images/utlogo.gif"
+_nsf_url = "http://www.nsf.gov"
+_danse_url = "http://www.cacr.caltech.edu/projects/danse/release/index.html"
+_inst_url = "http://www.utk.edu"
+_corner_image = "images/angles_flat.png"
+_copyright = "(c) 2008, University of Tennessee"
+
+import wx.lib.newevent
+(StatusBarEvent, EVT_STATUS) = wx.lib.newevent.NewEvent()
+
+def printEVT(message):
+    if __EVT_DEBUG__:
+        print "%g:  %s" % (time.clock(), message)
+        
+        if __EVT_DEBUG_2_FILE__:
+            out = open(__EVT_DEBUG_FILENAME__, 'a')
+            out.write("%10g:  %s\n" % (time.clock(), message))
+            out.close()
+            
Index: sansview/perspectives/fitting/__init__.py
===================================================================
--- sansview/perspectives/fitting/__init__.py	(revision d89f09b35713186021727a80260c3d5a38746821)
+++ sansview/perspectives/fitting/__init__.py	(revision d89f09b35713186021727a80260c3d5a38746821)
@@ -0,0 +1,2 @@
+PLUGIN_ID = "Fitting plug-in 1.0"
+from fitting import *
Index: sansview/perspectives/fitting/fitpage.py
===================================================================
--- sansview/perspectives/fitting/fitpage.py	(revision d89f09b35713186021727a80260c3d5a38746821)
+++ sansview/perspectives/fitting/fitpage.py	(revision d89f09b35713186021727a80260c3d5a38746821)
@@ -0,0 +1,612 @@
+import sys
+import wx
+import wx.lib
+import numpy
+import copy
+
+from sans.guicomm.events import StatusEvent   
+(ModelEventbox, EVT_MODEL_BOX) = wx.lib.newevent.NewEvent()
+_BOX_WIDTH = 80
+
+def format_number(value, high=False):
+    """
+        Return a float in a standardized, human-readable formatted string 
+    """
+    try: 
+        value = float(value)
+    except:
+        print "returning 0"
+        return "0"
+    
+    if high:
+        return "%-6.4g" % value
+    else:
+        return "%-5.3g" % value
+
+    
+class FitPage(wx.Panel):
+    """
+        FitPanel class contains fields allowing to display results when
+        fitting  a model and one data
+        @note: For Fit to be performed the user should check at least one parameter
+        on fit Panel window.
+  
+    """
+    ## Internal name for the AUI manager
+    window_name = "Fit page"
+    ## Title to appear on top of the window
+    window_caption = "Fit Page"
+    
+    
+    def __init__(self, parent, *args, **kwargs):
+        wx.Panel.__init__(self, parent, *args, **kwargs)
+        """ 
+            Initialization of the Panel
+        """
+        self.manager = None
+        self.parent  = parent
+        self.event_owner=None
+        #panel interface
+        self.vbox  = wx.BoxSizer(wx.VERTICAL)
+        self.sizer4 = wx.GridBagSizer(5,5)
+        self.sizer3 = wx.GridBagSizer(5,5)
+        self.sizer2 = wx.GridBagSizer(5,5)
+        self.sizer1 = wx.GridBagSizer(5,5)
+        self.DataSource      = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20))
+        self.DataSource.SetToolTipString("name of data to fit")
+        self.modelbox = wx.ComboBox(self, -1)
+        id = wx.NewId()
+        self.btFit =wx.Button(self,id,'Fit')
+        self.btFit.Bind(wx.EVT_BUTTON, self.onFit,id=id)
+        self.btFit.SetToolTipString("Perform fit.")
+        self.vbox.Add(self.sizer3)
+        self.vbox.Add(self.sizer2)
+        self.vbox.Add(self.sizer4)
+        self.vbox.Add(self.sizer1)
+        
+        ix = 0
+        iy = 1
+        self.sizer3.Add(wx.StaticText(self, -1, 'Data Source'),(iy,ix),\
+                 (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        ix += 1
+        self.sizer3.Add(self.DataSource,(iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        ix += 1
+        self.sizer3.Add((20,20),(iy,ix),(1,1),wx.RIGHT|wx.EXPAND|wx.ADJUST_MINSIZE,0)
+        ix = 0
+        iy += 1
+        self.sizer3.Add(wx.StaticText(self,-1,'Model'),(iy,ix),(1,1)\
+                  , wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        ix += 1
+        self.sizer3.Add(self.modelbox,(iy,ix),(1,1),  wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        ix = 1
+        iy = 1
+        self.text4_1 = wx.StaticText(self, -1, 'Min')
+        self.sizer4.Add(self.text4_1,(iy, ix),(1,1),\
+                            wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        self.text4_1.Hide()
+        ix += 2
+        self.text4_2 = wx.StaticText(self, -1, 'Max')
+        self.sizer4.Add(self.text4_2,(iy, ix),(1,1),\
+                            wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        self.text4_2.Hide()
+        ix = 0
+        iy += 1
+        #set maximum range for x in linear scale
+        self.text4_3 = wx.StaticText(self, -1, 'Maximum Data\n Range (Linear)', style=wx.ALIGN_LEFT)
+        self.sizer4.Add(self.text4_3,(iy,ix),(1,1),\
+                   wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        self.text4_3.Hide()
+        ix += 1
+        self.xmin    = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20))
+        self.xmin.SetToolTipString("Minimun value of x in linear scale.")
+        self.sizer4.Add(self.xmin,(iy, ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        self.xmin.Bind(wx.EVT_KILL_FOCUS, self._onTextEnter)
+        self.xmin.Hide()
+        ix += 2
+        self.xmax    = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20))
+        self.xmax.SetToolTipString("Maximum value of x in linear scale.")
+        self.sizer4.Add(self.xmax,(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        self.xmax.Bind(wx.EVT_KILL_FOCUS, self._onTextEnter)
+        self.xmax.Hide()
+        #Set chisqr  result into TextCtrl
+        ix = 0
+        iy = 1
+        self.text1_1 = wx.StaticText(self, -1, 'Chi2/dof', style=wx.ALIGN_LEFT)
+        self.sizer1.Add(self.text1_1,(iy,ix),(1,1),\
+                   wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        ix += 1
+        self.tcChi    = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20))
+        self.tcChi.SetToolTipString("Chi^2 over degrees of freedom.")
+        self.sizer1.Add(self.tcChi,(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        ix +=2
+        self.sizer1.Add(self.btFit,(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        
+        # contains link between  model ,all its parameters, and panel organization
+        self.parameters=[]
+        #contains link between a model and selected parameters to fit 
+        self.param_toFit=[]
+        # model on which the fit would be performed
+        self.model=None
+        # preview selected model name
+        self.prevmodel_name=None
+        # flag to check if the user has selected a new model in the combox box
+        self.model_hasChanged=False
+        #flag to check if the user has selected a new data
+        self.data_hasChanged=False
+        #dictionary of model name and model class
+        self.model_list_box={}
+        # Data1D to make a deep comparison between 2 Data1D for checking data
+        #change
+        from sans.guitools.plottables import Data1D
+        self.prevData = Data1D(x=[], y=[],dx=None, dy=None)
+        self.prevData.name= None
+        
+        self.data=None
+        self.vbox.Layout()
+        self.vbox.Fit(self) 
+        self.SetSizer(self.vbox)
+        self.Centre()
+        
+        
+    def set_owner(self,owner):
+        """ 
+            set owner of fitpage
+            @param owner: the class responsible of plotting
+        """
+        self.event_owner=owner    
+   
+  
+    def set_manager(self, manager):
+        """
+             set panel manager
+             @param manager: instance of plugin fitting
+        """
+        self.manager = manager
+ 
+         
+    def _DataNameEnter(self):
+        """
+            reset the panel when a new data is selected
+        """
+        if len(self.parameters )>0:
+            for item in self.parameters:
+                item[0].SetValue(False)
+                wx.EVT_CHECKBOX(self, item[0].GetId(), self.select_param)
+                item[2].Hide()
+                item[3].Clear()
+                item[3].Hide()
+                self.xmax.Disable()
+                self.xmin.Disable()
+                self.text1_1.Hide()
+                self.tcChi.Clear()
+                self.vbox.Layout() 
+                self.GrandParent.GetSizer().Layout()
+                
+                
+    def copy_data(self,dataset):
+        """
+             copy a select data in the panel to compared with the previous selected data
+             @param dataset: the data selected
+             @note : everything a data is selected, the panel check is it is different 
+             from the previous selected data
+        """
+       
+        try:
+            if dataset !=None:
+                self.prevData.x= copy.deepcopy(dataset.x)
+                self.prevData.y= copy.deepcopy(dataset.y)
+                self.prevData.name=dataset.name
+                if dataset.dy==None:
+                    self.prevData.dy= copy.deepcopy(dataset.dy)
+        except:
+            raise ValueError, " copy_data: cannot copy data" 
+        
+        
+    def onFit(self,event):
+        """ signal for fitting"""
+         
+        flag=self.checkFitRange()
+        self.set_manager(self.manager)
+     
+        qmin=float(self.xmin.GetValue())
+        qmax =float( self.xmax.GetValue())
+        if len(self.param_toFit) >0 and flag==True:
+            #self.manager._on_single_fit(model=self.model,qmin=qmin,qmax=qmax)
+            self.manager._on_single_fit(qmin=qmin,qmax=qmax)
+        else:
+              wx.PostEvent(self.parent.GrandParent, StatusEvent(status=\
+                            "Select at least on parameter to fit "))
+    def populate_box(self, dict):
+        """
+            Populate each combox box of each page
+            @param page: the page to populate
+        """
+        id=0
+        self.model_list_box=dict
+        for item in self.model_list_box.itervalues():
+            if hasattr(item, "name"):
+                name = item.name
+            else:
+                name = item.__name__
+            
+            self.modelbox.Insert(name,int(id))
+            id+=1
+            
+            wx.EVT_COMBOBOX(self.modelbox,-1, self._on_select_model) 
+        return 0
+    
+    
+    def _on_select_model(self,event):
+        """
+            react when a model is selected from page's combo box
+            post an event to its owner to draw an appropriate theory
+        """
+        for item in self.model_list_box.itervalues():
+            model=item()
+            if hasattr(model, "name"):
+                name = model.name
+            else:
+                name = model.__class__.__name__
+            try:
+                if name ==event.GetString():
+                    evt = ModelEventbox(model=model,name=name)
+                    wx.PostEvent(self.event_owner, evt)
+            except:
+                raise #ValueError,"model.name is not equal to model class name"
+
+
+    
+    def _onTextEnter(self,event):
+        """
+            set a flag to determine if the fitting range entered by the user is valid
+        """
+        try:
+            flag=self.checkFitRange()
+            if flag==True and self.model!=None:
+                 self.manager.redraw_model(float(self.xmin.GetValue())\
+                                               ,float(self.xmax.GetValue()))
+        except:
+            wx.PostEvent(self.parent.GrandParent, StatusEvent(status=\
+                            "Drawing  Error:wrong value entered %s"% sys.exc_value))
+        
+    def checkFitRange(self):
+        """
+            Check the validity of fitting range
+            @note: xmin should always be less than xmax or else each control box
+            background is colored in pink.
+        """
+       
+        flag = True
+        valueMin = self.xmin.GetValue()
+        valueMax = self.xmax.GetValue()
+        # Check for possible values entered
+        
+        try:
+            if (float(valueMax)> float(valueMin)):
+                self.xmax.SetBackgroundColour(wx.WHITE)
+                self.xmin.SetBackgroundColour(wx.WHITE)
+            else:
+                flag = False
+                self.xmin.SetBackgroundColour("pink")
+                self.xmax.SetBackgroundColour("pink")      
+        except:
+            flag = False
+            self.xmin.SetBackgroundColour("pink")
+            self.xmax.SetBackgroundColour("pink")
+            
+        self.xmin.Refresh()
+        self.xmax.Refresh()
+        return flag
+    
+    def check_data_change(self,dataset):
+        """
+             check if data selected has changed and set flag self.data_hasChanged
+             has true is changed or false is unchanged
+             @param dataset: data selected
+        """
+        self.data_hasChanged=False
+        if self.prevData.__class__ !=dataset.__class__:
+            self.data_hasChanged=True
+            
+        elif self.prevData.name != dataset.name:
+            self.data_hasChanged=True
+            
+        elif len(self.prevData.x) != len(self.prevData.y):
+            self.data_hasChanged=True
+            
+        else:
+            for i in range(len(dataset.x)):
+                if self.prevData.x[i] !=dataset.x[i]:
+                    self.data_hasChanged=True
+                    break
+                
+                if self.prevData.y[i] !=dataset.y[i]:
+                    self.data_hasChanged=True
+                    break
+                
+                if dataset.dy !=None:
+                    if self.prevData.dy[i] !=dataset.dy[i]:
+                        self.data_hasChanged=True
+                        break
+                    
+                    
+    def set_data_name(self,dataset):
+        """ 
+            set data's name.if data has changed reset the panel and xmin and xmax
+            @param name: data 's name
+            @attention:  still  haven't find a better way to display Q name and unit
+            for xmin and xmax range sizer
+        """
+        self.check_data_change(dataset)
+        if self.data_hasChanged==True:
+            self._DataNameEnter()
+        self.data=dataset
+        self.copy_data(dataset)
+        #Displaying Data information
+        self.DataSource.SetValue(str(dataset.name))
+        self._xaxis,self._xunit=dataset.get_xaxis()
+        self.text4_3.SetLabel(self._xaxis+"["+self._xunit+"]")
+        self.text4_1.Show()
+        self.text4_2.Show()
+        self.text4_3.Show()
+        
+        self.xmin.SetValue(format_number(min(dataset.x)))
+        self.xmin.Show()
+
+        self.xmax.SetValue(format_number(max(dataset.x)))
+        self.xmax.Show()
+        
+        if ((len(self.param_toFit ) >0) and self.DataSource.GetValue()and \
+            self.modelbox.GetValue() and (self.model_hasChanged ==False)):
+            self.xmin.Enable()
+            self.xmax.Enable()
+        else:
+            self.xmin.Disable()
+            self.xmax.Disable()
+            
+        self.vbox.Layout()
+        self.GrandParent.GetSizer().Layout()
+        
+        
+    def set_model_name(self,name):
+        """ 
+            set model name. set also self.model_hasChanged to true is the model 
+            type has changed or false if it didn't
+            @param name: model 's name
+        """
+        self.model_hasChanged=False
+        if (name != self.prevmodel_name):
+            self.model_hasChanged=True
+        self.tcChi.Clear()
+        #self.modelbox.SetValue(str(name))
+        self.prevmodel_name=self.modelbox.GetValue()
+       
+            
+    def get_model_box(self): 
+        """ return reference to combox box self.model"""
+        return self.modelbox
+
+    
+    def get_param_list(self):
+        """
+            @return self.param_toFit: list containing  references to TextCtrl
+            checked.Theses TextCtrl will allow reference to parameters to fit.
+            @raise: if return an empty list of parameter fit will nnote work 
+            properly so raise ValueError,"missing parameter to fit"
+        """
+        if self.param_toFit !=[]:
+            return self.param_toFit
+        else:
+            raise ValueError,"missing parameter to fit"
+        
+        
+    def set_panel(self,model):
+        """
+            Build the panel from the model content
+            @param model: the model selected in combo box for fitting purpose
+        """
+    
+        self.sizer2.Clear(True)
+        self.parameters = []
+        self.param_toFit=[]
+        self.model = model
+        keys = self.model.getParamList()
+        keys.sort()
+        iy = 1
+        ix = 0
+        self.cb1 = wx.CheckBox(self, -1,'Parameters', (10, 10))
+        wx.EVT_CHECKBOX(self, self.cb1.GetId(), self.select_all_param)
+        self.sizer2.Add(self.cb1,(iy, ix),(1,1),\
+                          wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        ix +=1
+        self.text2_2 = wx.StaticText(self, -1, 'Values')
+        self.sizer2.Add(self.text2_2,(iy, ix),(1,1),\
+                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
+        ix +=2
+        self.text2_3 = wx.StaticText(self, -1, 'Errors')
+        self.sizer2.Add(self.text2_3,(iy, ix),(1,1),\
+                            wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        self.text2_3.Hide() 
+        ix +=1
+        self.text2_4 = wx.StaticText(self, -1, 'Units')
+        self.sizer2.Add(self.text2_4,(iy, ix),(1,1),\
+                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
+        self.text2_4.Hide()
+        for item in keys:
+            iy += 1
+            ix = 0
+
+            cb = wx.CheckBox(self, -1, item, (10, 10))
+            cb.SetValue(False)
+            self.sizer2.Add( cb,( iy, ix),(1,1),  wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+            wx.EVT_CHECKBOX(self, cb.GetId(), self.select_param)
+            
+            ix += 1
+            value= self.model.getParam(item)
+            ctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), style=wx.TE_PROCESS_ENTER)
+            ctl1.SetValue(str (format_number(value)))
+            ctl1.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter)
+            self.sizer2.Add(ctl1, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+            ix += 1
+            text2=wx.StaticText(self, -1, '+/-')
+            self.sizer2.Add(text2,(iy, ix),(1,1),\
+                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
+            text2.Hide()  
+            ix += 1
+            ctl2 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), style=wx.TE_PROCESS_ENTER)
+            self.sizer2.Add(ctl2, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+            ctl2.Hide()
+            ix +=1
+            # Units
+            try:
+                units = wx.StaticText(self, -1, self.model.details[item][0], style=wx.ALIGN_LEFT)
+            except:
+                units = wx.StaticText(self, -1, "", style=wx.ALIGN_LEFT)
+             
+            self.sizer2.Add(units, (iy,ix),(1,1),  wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+            #save data
+            self.parameters.append([cb,ctl1,text2,ctl2])
+        #Display units text on panel
+        for item in keys:   
+            if self.model.details[item][0]!='':
+                self.text2_4.Show()
+                break
+            else:
+                self.text2_4.Hide()
+        #Disable or enable fit button
+        if (self.modelbox.GetValue() and self.DataSource.GetValue()):
+            if not (len(self.param_toFit ) >0):
+                self.xmin.Disable()
+                self.xmax.Disable()
+            else:
+                self.xmin.Enable()
+                self.xmax.Enable()
+        else:
+            self.xmin.Disable()
+            self.xmax.Disable()
+      
+        self.vbox.Layout()
+        self.GrandParent.GetSizer().Layout()
+        
+    
+        
+    def _onparamEnter(self,event):
+        """ 
+            when enter value on panel redraw model according to changed
+        """
+        if len(self.parameters) !=0 and self.model !=None:
+            for item in self.parameters:
+                try:
+                     name=str(item[0].GetLabelText())
+                     value= float(item[1].GetValue())
+                     
+                     self.model.setParam(name,value)
+                     self.manager.redraw_model(float(self.xmin.GetValue())\
+                                               ,float(self.xmax.GetValue()))
+                except:
+                     wx.PostEvent(self.parent.GrandParent, StatusEvent(status=\
+                            "Drawing  Error:wrong value entered : %s"% sys.exc_value))
+        
+       
+    def select_all_param(self,event): 
+        """
+             set to true or false all checkBox given the main checkbox value cb1
+        """
+        self.param_toFit=[]
+        if  self.parameters !=[]:
+            if  self.cb1.GetValue()==True:
+                for item in self.parameters:
+                   
+                    item[0].SetValue(True)
+                    list= [item[0],item[1],item[2],item[3]]
+                    self.param_toFit.append(list )
+                if (self.modelbox.GetValue() and self.DataSource.GetValue()):
+                    if not (len(self.param_toFit ) >0):
+                        self.xmin.Disable()
+                        self.xmax.Disable()
+                    else:
+                        self.xmin.Enable()
+                        self.xmax.Enable()
+            else:
+                for item in self.parameters:
+                    item[0].SetValue(False)
+                self.param_toFit=[]
+              
+                self.xmin.Disable()
+                self.xmax.Disable()
+                
+                
+    def select_param(self,event):
+        """ 
+            Select TextCtrl  checked for fitting purpose and stores them
+            in  self.param_toFit=[] list
+        """
+        self.param_toFit=[]
+        for item in self.parameters:
+            if item[0].GetValue()==True:
+                list= [item[0],item[1],item[2],item[3]]
+                self.param_toFit.append(list )  
+            else:
+                if item in self.param_toFit:
+                    self.param_toFit.remove(item)
+        if len(self.parameters)==len(self.param_toFit):
+            self.cb1.SetValue(True)
+        else:
+            self.cb1.SetValue(False)
+        if (self.modelbox.GetValue() and self.DataSource.GetValue()):
+            if not (len(self.param_toFit ) >0):
+                self.xmin.Disable()
+                self.xmax.Disable()
+            else:
+                self.xmin.Enable()
+                self.xmax.Enable()
+        else:
+            self.xmin.Disable()
+            self.xmax.Disable()
+   
+       
+  
+    def onsetValues(self,chisqr, out,cov):
+        """
+            Build the panel from the fit result
+            @param chisqr:Value of the goodness of fit metric
+            @param out:list of parameter with the best value found during fitting
+            @param cov:Covariance matrix
+       
+        """
+        #print "fitting : onsetvalues out",out
+        self.tcChi.Clear()
+        self.tcChi.SetValue(format_number(chisqr))
+        params = {}
+        is_modified = False
+        has_error = False
+        if out.__class__==numpy.float64:
+            self.param_toFit[0][1].SetValue(format_number(out))
+            self.param_toFit[0][1].Refresh()
+            if cov !=None :
+                self.text2_3.Show()
+                self.param_toFit[0][2].Show()
+                self.param_toFit[0][3].Clear()
+                self.param_toFit[0][3].SetValue(format_number(cov[0]))
+                self.param_toFit[0][3].Show()
+        #out is a list : set parameters and errors in TextCtrl
+        else:
+            i=0
+            #print "fitpage: list param  model",list
+            #for item in self.param_toFit:
+            #    print "fitpage: list display",item[0].GetLabelText()
+            for item in self.param_toFit:
+                if( out != None ) and len(out)<=len(self.param_toFit)and i < len(out):
+                    item[1].SetValue(format_number(out[i]))
+                    item[1].Refresh() 
+                if (cov !=None)and len(cov)<=len(self.param_toFit)and i < len(cov):
+                    self.text2_3.Show() 
+                    item[2].Show()
+                    item[3].Clear()
+                    item[3].SetValue(format_number(cov[i]))
+                    item[3].Show()   
+                i+=1
+        
+        self.vbox.Layout()
+        self.GrandParent.GetSizer().Layout()
+    
Index: sansview/perspectives/fitting/fitpanel.py
===================================================================
--- sansview/perspectives/fitting/fitpanel.py	(revision d89f09b35713186021727a80260c3d5a38746821)
+++ sansview/perspectives/fitting/fitpanel.py	(revision d89f09b35713186021727a80260c3d5a38746821)
@@ -0,0 +1,151 @@
+import wx
+import wx.lib
+import numpy
+import string ,re
+#import models
+_BOX_WIDTH = 80
+
+
+    
+class FitPanel(wx.Panel):
+    """
+        FitPanel class contains fields allowing to fit  models and  data
+        @note: For Fit to be performed the user should check at least one parameter
+        on fit Panel window.
+       
+    """
+    ## Internal name for the AUI manager
+    window_name = "Fit panel"
+    ## Title to appear on top of the window
+    window_caption = "Fit Panel "
+   
+    
+    def __init__(self, parent, *args, **kwargs):
+        wx.Panel.__init__(self, parent, *args, **kwargs)
+        self.manager=None
+        self.parent=parent
+        self.event_owner=None
+        #self.menu_mng = models.ModelManager()
+        self.nb = wx.Notebook(self)
+        self.sizer = wx.BoxSizer(wx.VERTICAL)
+        self.sizer.Add(self.nb, 0, wx.EXPAND)
+        #Creating an initial page for simultaneous fitting
+        from simfitpage import SimultaneousFitPage
+        self.sim_page = SimultaneousFitPage(self.nb, -1)
+        
+        #self.fit_panel.add_page(self.sim_page,"Simultaneous Fit")
+        self.nb.AddPage(self.sim_page,"Simultaneous Fit")
+        
+        id = wx.NewId()
+        self.btClose =wx.Button(self,id,'Close')
+        self.btClose.Bind(wx.EVT_BUTTON, self.onClose,id=id)
+        self.btClose.SetToolTipString("Close page.")
+    
+        sizer_button = wx.BoxSizer(wx.HORIZONTAL)
+        sizer_button.Add((20, 20), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        sizer_button.Add(self.btClose, 0, wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10)
+        self.sizer.Add(sizer_button,1, wx.EXPAND)
+        #dictionary of miodel {model class name, model class}
+        self.model_list_box={}
+        # save the title of the last page tab added
+        self.name=None
+        self.nb.Update()
+        self.SetSizer(self.sizer)
+        self.sizer.Fit(self)
+        self.Center()
+        
+        
+    def set_manager(self, manager):
+        """
+             set panel manager
+             @param manager: instance of plugin fitting
+        """
+        self.manager = manager
+        self.sim_page.set_manager(manager)
+        
+    def set_owner(self,owner):
+        """ 
+            set and owner for fitpanel
+            @param owner: the class responsible of plotting
+        """
+        self.event_owner=owner
+      
+        
+    def add_page( self,page_title ):
+        """ 
+            Add a fitting page on the notebook contained by fitpanel
+            @param panel: contains in the page to add
+            @param name: title of the page tab
+            @return panel : page just added for futher used. is used by fitting module
+        """     
+        if self.name != page_title:
+            from fitpage import FitPage
+            panel = FitPage(self.nb, -1)
+            panel.set_manager(self.manager)
+            panel.set_owner(self.event_owner)
+            self.nb.AddPage(page=panel,text=page_title,select=True)
+            panel.populate_box( self.model_list_box)
+            self.name = page_title
+            return panel
+  
+    def get_notebook(self):
+        """
+            @return self.nb: return its own notebook mostly used by fitting module 
+        """
+        return self.nb
+    
+    def get_page(self, n):
+        """
+            @return page at position n
+            @param n: page number
+        """
+        return self.nb.GetPage(n)
+    
+    
+    def get_page_count(self):
+        """ @return  number total of pages contained in notebook"""
+        return self.nb.GetPageCount()
+        
+        
+    def get_current_page(self):
+        """
+            @return the current page selected
+        """
+        return self.nb.GetCurrentPage()
+    
+    
+    def get_selected_page(self):
+        """ @return the page just selected by the user """
+        return self.nb.GetPage(self.nb.GetSelection())
+    
+    def onClose(self,event):
+        """
+             close the current page except the simpage. remove each check box link to the model
+             selected on that page. remove its reference into page_finder (fitting module)
+        """
+        sim_page = self.nb.GetPage(0)
+        selected_page = self.nb.GetPage(self.nb.GetSelection())
+        
+        if sim_page != selected_page:
+            # remove the check box link to the model name of this page (selected_page)
+            sim_page.remove_model(selected_page)
+            #remove that page from page_finder of fitting module
+            page_finder=self.manager.get_page_finder() 
+            for page, value in page_finder.iteritems():
+                if page==selected_page:
+                    del page_finder[page]
+                    break
+            #delete the page from notebook
+            selected_page.Destroy()
+            self.nb.RemovePage(self.nb.GetSelection())
+            self.name=None
+            
+            
+    def set_model_list(self,dict):
+         """ 
+             copy a dictionary of model into its own dictionary
+             @param dict: dictionnary made of model name as key and model class
+             as value
+         """
+         self.model_list_box = dict
+  
Index: sansview/perspectives/fitting/fitproblem.py
===================================================================
--- sansview/perspectives/fitting/fitproblem.py	(revision d89f09b35713186021727a80260c3d5a38746821)
+++ sansview/perspectives/fitting/fitproblem.py	(revision d89f09b35713186021727a80260c3d5a38746821)
@@ -0,0 +1,79 @@
+from sans.fit.AbstractFitEngine import Model
+
+class FitProblem:
+    """  
+        FitProblem class allows to link a model with the new name created in _on_model,
+        a name theory created with that model  and the data fitted with the model.
+        FitProblem is mostly used  as value of the dictionary by fitting module.
+    """
+    
+    def __init__(self):
+        
+        """
+            @ self.data :is the data selected to perform the fit
+            @ self.theory_name: the name of the theory created with self.model
+            @ self.model_list:  is a list containing a model as first element 
+            and its name assign example [lineModel, M0]
+        """
+        self.data=None
+        self.theory_name=None
+        self.model_list=[]
+        
+    def set_model(self,model,name):
+        """ 
+             associates each model with its new created name
+             @param model: model selected
+             @param name: name created for model
+        """
+        self.model_list=[model,name]
+
+  
+    def add_data(self,data):
+        """ 
+            save a copy of the data select to fit
+            @param data: data selected
+        """
+        self.data = data
+            
+    def get_model(self):
+        """ @return: saved model """
+        return self.model_list
+     
+    def get_data(self):
+        """ @return:  list of data dList"""
+        return self.data
+      
+      
+    def get_theory(self):
+        """ @return the name of theory for plotting purpose"""
+        return self.theory_name
+    
+    
+    def set_theory(self,name):
+        """
+            Set theory name
+            @param name: name of the theory
+        """
+        self.theory_name = name
+
+        
+    def set_model_param(self,name,value):
+        """ 
+            set the value of a given parameter of this model
+            @param name: name of the given parameter
+            @param value: value of that parameter
+        """
+        
+        self.model_list[0].model.setParam(name,value)
+        new_model=Model(self.model_list[0].model)
+        self.model_list[0]=new_model
+        
+    def reset_model(self,model):
+        """ 
+            reset a model when parameter has changed
+            @param value: new model
+        """
+        print "fitproblem : reset model"
+        self.model_list[0]=model
+        
+        
Index: sansview/perspectives/fitting/fitting.py
===================================================================
--- sansview/perspectives/fitting/fitting.py	(revision d89f09b35713186021727a80260c3d5a38746821)
+++ sansview/perspectives/fitting/fitting.py	(revision d89f09b35713186021727a80260c3d5a38746821)
@@ -0,0 +1,570 @@
+import os,os.path, re
+import sys, wx, logging
+import string, numpy, pylab, math
+
+from sans.guitools.plottables import Data1D, Theory1D
+from sans.guitools.PlotPanel import PlotPanel
+from sans.guicomm.events import NewPlotEvent, StatusEvent  
+from copy import deepcopy 
+from sans.fit.AbstractFitEngine import Model
+from sans.fit.AbstractFitEngine import Data
+from fitproblem import FitProblem
+from fitpanel import FitPanel
+
+import models
+import fitpage
+class PlottableData(Data,Data1D):
+    """ class plottable data"""
+    def __init__(self,data,data1d):
+        self.x = data1d.x
+        self.y = data1d.y
+        self.dx= data1d.dx
+        self.dy= data1d.dy
+       
+        self.group_id= data1d.group_id
+        x_name, x_units = data1d.get_xaxis() 
+        y_name, y_units = data1d.get_yaxis() 
+        self.xaxis( x_name, x_units)
+        self.yaxis( y_name, y_units )
+        self.qmin=data.qmin
+        self.qmax=data.qmax
+class Plugin:
+    """
+    """
+    
+    def __init__(self):
+        ## Plug-in name
+        self.sub_menu = "Fitting"
+        
+        ## Reference to the parent window
+        self.parent = None
+        self.menu_mng = models.ModelManager()
+        ## List of panels for the simulation perspective (names)
+        self.perspective = []
+        # Start with a good default
+        self.elapsed = 0.022
+        self.fitter  = None
+       
+        #Flag to let the plug-in know that it is running standalone
+        self.standalone=True
+        ## Fit engine
+        self._fit_engine = 'park'
+        # Log startup
+        logging.info("Fitting plug-in started")   
+
+    def populate_menu(self, id, owner):
+        """
+            Create a menu for the Fitting plug-in
+            @param id: id to create a menu
+            @param owner: owner of menu
+            @ return : list of information to populate the main menu
+        """
+        #Menu for fitting
+        self.menu1 = wx.Menu()
+        id1 = wx.NewId()
+        self.menu1.Append(id1, '&Show fit panel')
+        wx.EVT_MENU(owner, id1, self.on_perspective)
+        
+        #menu for model
+        menu2 = wx.Menu()
+        self.menu_mng.populate_menu(menu2, owner)
+        id2 = wx.NewId()
+        owner.Bind(models.EVT_MODEL,self._on_model_menu)
+        self.fit_panel.set_owner(owner)
+        self.fit_panel.set_model_list(self.menu_mng.get_model_list())
+        owner.Bind(fitpage.EVT_MODEL_BOX,self._on_model_panel)
+      
+        return [(id, self.menu1, "Fitting"),(id2, menu2, "Model")]
+    
+    
+    def help(self, evt):
+        """
+            Show a general help dialog. 
+            TODO: replace the text with a nice image
+        """
+        pass
+    
+    def get_context_menu(self, graph=None):
+        """
+            Get the context menu items available for P(r)
+            @param graph: the Graph object to which we attach the context menu
+            @return: a list of menu items with call-back function
+        """
+        
+        self.graph=graph
+        for item in graph.plottables:
+            if item.name==graph.selected_plottable and item.__class__.__name__ is not "Theory1D":
+                return [["Select Data", "Dialog with fitting parameters ", self._onSelect]] 
+        return []   
+
+
+    def get_panels(self, parent):
+        """
+            Create and return a list of panel objects
+        """
+        self.parent = parent
+        # Creation of the fit panel
+        self.fit_panel = FitPanel(self.parent, -1)
+        #Set the manager forthe main panel
+        self.fit_panel.set_manager(self)
+        # List of windows used for the perspective
+        self.perspective = []
+        self.perspective.append(self.fit_panel.window_name)
+        # take care of saving  data, model and page associated with each other
+        self.page_finder={}
+        self.index_model=0
+        return [self.fit_panel]
+   
+      
+    def get_perspective(self):
+        """
+            Get the list of panel names for this perspective
+        """
+        return self.perspective
+    
+    
+    def on_perspective(self, event):
+        """
+            Call back function for the perspective menu item.
+            We notify the parent window that the perspective
+            has changed.
+        """
+        self.parent.set_perspective(self.perspective)
+    
+    
+    def post_init(self):
+        """
+            Post initialization call back to close the loose ends
+            [Somehow openGL needs this call]
+        """
+        self.parent.set_perspective(self.perspective)
+        
+        
+    def _onSelect(self,event):
+        """ 
+            when Select data to fit a new page is created .Its reference is 
+            added to self.page_finder
+        """
+        self.panel = event.GetEventObject()
+        for item in self.panel.graph.plottables:
+            if item.name == self.panel.graph.selected_plottable:
+                try:
+                    name = item.group_id # item in Data1D
+                except:
+                    name = 'Fit'
+                try:
+                    page = self.fit_panel.add_page(name)
+                    page.set_data_name(item)
+                    self.page_finder[page]= FitProblem()
+                    #creating Data type
+                    data1= Data(sans_data=item)
+                    datas=PlottableData(data=data1,data1d=item)
+                    self.page_finder[page].add_data(datas)
+                except:
+                    raise 
+                    wx.PostEvent(self.parent, StatusEvent(status="Fitting error: \
+                    data already Selected "))
+                    
+                    
+    def get_page_finder(self):
+        """ @return self.page_finder used also by simfitpage.py"""  
+        return self.page_finder 
+    
+    
+    def set_page_finder(self,modelname,param,values):
+        """
+             Used by simfitpage.py to reset a parameter given the string constrainst.
+             @param modelname: the name ot the model for with the parameter has to reset
+             @param value: can be a string in this case.
+             @note: expecting park used for fit.
+        """  
+        sim_page=self.fit_panel.get_page(0)
+        for page, value in self.page_finder.iteritems():
+            if page != sim_page:
+                list=value.get_model()
+                model=list[0]
+                if model.name== modelname:
+                    value.set_model_param(param,values)
+                    break
+
+   
+                            
+    def split_string(self,item): 
+        """
+            recieve a word containing ""
+        """
+        #print "fitting: split :went here" 
+        
+        if string.find(item,".")!=-1:
+            param_names= re.split("\.",item)
+            model_name=param_names[0]
+            param_name=param_names[1]  
+            return model_name,param_name
+        
+        
+    def _single_fit_completed(self,result,pars,current_pg,qmin,qmax):
+        """
+          
+        """
+       
+        try:
+            for page, value in self.page_finder.iteritems():
+                if page== current_pg:
+                    data = value.get_data()
+                    list = value.get_model()
+                    model= list[0]
+                    break
+            #print "fitting : result",result,result.pvec,result.cov,result.fitness
+            i = 0
+            for name in pars:
+                if result.pvec.__class__==numpy.float64:
+                    model.model.setParam(name,result.pvec)
+                else:
+                    model.model.setParam(name,result.pvec[i])
+                    #print "fitting: i name out[i]", i,name,float(result.pvec[i])
+                    i += 1
+            new_cov=[]
+            if result.cov !=None:
+                 for j in range(len(result.cov)):
+                     new_cov.append(result.cov[j][j])  
+            else:
+                new_cov=None
+            current_pg.onsetValues(result.fitness, result.pvec,new_cov)
+            self.plot_helper(currpage=current_pg,qmin=qmin,qmax=qmax)
+        except:
+             wx.PostEvent(self.parent, StatusEvent(status="Fitting error: %s" % sys.exc_value))
+            
+       
+    def _simul_fit_completed(self,result,qmin,qmax):
+        """
+            Parameter estimation completed, 
+            display the results to the user
+            @param alpha: estimated best alpha
+            @param elapsed: computation time
+        """
+        try:
+            for page, value in self.page_finder.iteritems():
+                data = value.get_data()
+                list = value.get_model()
+                model= list[0]
+               
+                small_out = []
+                small_cov = []
+                i = 0
+                for p in result.parameters:
+                    print "fitting: fit in park fitting", p.name, p.value,p.stderr
+                    model_name,param_name = self.split_string(p.name)  
+                    print "fitting: simultfit",model.model.name,model_name,param_name ,p.name,param_name,p.value
+                    if model.model.name == model_name:
+                        print "fitting: hello",p.name,param_name,p.value
+                        small_out.append(p.value )
+                        small_cov.append(p.stderr)
+                        model.model.setParam(param_name,p.value)   
+                #print "fitting: out of each page",page,small_out,small_cov,data.group_id
+                page.onsetValues(result.fitness, small_out,small_cov)
+                self.plot_helper(currpage= page,qmin= qmin,qmax= qmax) 
+        except:
+             wx.PostEvent(self.parent, StatusEvent(status="Fitting error: %s" % sys.exc_value))
+            
+     
+    def _completed(self,result,pars,current_pg, elapsed):
+        """
+            Method called with the results when the inversion
+            is done
+            
+            @param out: output coefficient for the base functions
+            @param cov: covariance matrix
+            @param pr: Invertor instance
+            @param elapsed: time spent computing
+        """
+       
+        # Save useful info
+        self.elapsed = elapsed
+        # Keep a copy of the last result
+        self._last_out = result.pvec
+        self._last_cov = result.cov
+        self._last_chisqr=result.fitness
+        #print "fitting: initial parameter ",pars
+        #result=self.fitter.fit(qmin,qmax)
+        
+        #print "fitting : result",result,result.pvec,result.cov,result.fitness
+        i = 0
+        for name in pars:
+            if result.pvec.__class__==numpy.float64:
+                model.model.setParam(name,result.pvec)
+            else:
+                model.model.setParam(name,result.pvec[i])
+                #print "fitting: i name out[i]", i,name,float(result.pvec[i])
+                i += 1
+        new_cov=[]
+        if result.cov !=None:
+             for j in range(len(result.cov)):
+                 new_cov.append(result.cov[j][j])  
+        else:
+            new_cov=None
+        current_pg.onsetValues(result.fitness, result.pvec,new_cov)
+        self.plot_helper(currpage=current_pg,qmin=qmin,qmax=qmax)
+ 
+        
+    def _on_single_fit(self,id=None,qmin=None,qmax=None):
+        """ 
+            perform fit for the  current page  and return chisqr,out and cov
+            @param engineName: type of fit to be performed
+            @param id: unique id corresponding to a fit problem(model, set of data)
+            @param model: model to fit
+            
+        """
+        #set an engine to perform fit
+        from sans.fit.Fitting import Fit
+        self.fitter= Fit(self._fit_engine)
+        #Setting an id to store model and data
+        if id==None:
+            id=0
+        self.id=id
+        current_pg=self.fit_panel.get_current_page() 
+        for page, value in self.page_finder.iteritems():
+            if page ==current_pg :
+                #print "fitting: self.page_finder",self.page_finder
+                data = value.get_data()
+                list=value.get_model()
+                model=list[0]
+                
+                #Create dictionary of parameters for fitting used
+                pars=[]
+                templist=[]
+                try:
+                    templist=current_pg.get_param_list()
+                except:
+                    raise
+                    wx.PostEvent(self.parent, StatusEvent(status="Fitting error: %s" % sys.exc_value))
+                    return
+                #for element in templist:
+                #    print "fitting: templist",str(element[0].GetLabelText())
+                #print "fitting: model list",model.getParamList()
+                for element in templist:
+                    try:
+                       pars.append(str(element[0].GetLabelText()))
+                    except:
+                        raise
+                        wx.PostEvent(self.parent, StatusEvent(status="Fitting error: %s" % sys.exc_value))
+                        return
+                #print "fitting: pars",pars
+                pars.sort()
+                
+                self.fitter.set_model(model,model.name, self.id, pars) 
+                self.fitter.set_data(data,self.id,qmin,qmax)
+                #Do the fit SCIPY
+                try:
+                    result=self.fitter.fit()
+                    self._single_fit_completed(result,pars,current_pg,qmin,qmax)
+                   
+                except:
+                    wx.PostEvent(self.parent, StatusEvent(status="Single Fit error: %s" % sys.exc_value))
+                    return
+         
+    def _on_simul_fit(self, id=None,qmin=None,qmax=None):
+        """ 
+            perform fit for all the pages selected on simpage and return chisqr,out and cov
+            @param engineName: type of fit to be performed
+            @param id: unique id corresponding to a fit problem(model, set of data)
+             in park_integration
+            @param model: model to fit
+            
+        """
+        #print "fitting: probabily breaking on fit call"
+        #set an engine to perform fit
+        from sans.fit.Fitting import Fit
+        self.fitter= Fit(self._fit_engine)
+        #Setting an id to store model and data
+        if id==None:
+             id = 0
+        self.id = id
+        for page, value in self.page_finder.iteritems():
+            try:
+                #print "fitting: self.page_finder",value
+                data = value.get_data()
+                #print "fitting: data",data
+                list = value.get_model()
+                model= list[0]
+                if data != None :
+                    #Create dictionary of parameters for fitting used
+                    pars = []
+                    templist = []
+                    try:
+                        templist = page.get_param_list()
+                    except:
+                        wx.PostEvent(self.parent, StatusEvent(status="Fitting error: %s" % sys.exc_value))
+                        return
+                    
+                    for element in templist:
+                        try:
+                            name = str(element[0].GetLabelText())
+                            pars.append(name)
+                        except:
+                            wx.PostEvent(self.parent, StatusEvent(status="Fitting error: %s" % sys.exc_value))
+                            return
+                
+                    print "fitting: pars",pars,model.name
+                    #print "fitter",self.fitter
+                    #print "fitting: model name",model.name
+                    self.fitter.set_model(model,model.model.name, self.id, pars) 
+                    self.fitter.set_data(data,self.id,qmin,qmax)
+                else:
+                    raise ValueError," Fitting: cannot set model with empty parameter"
+                self.id += 1 
+            except:
+                    raise
+                    wx.PostEvent(self.parent, StatusEvent(status="Fitting error: %s" % sys.exc_value))
+                    return 
+        #Do the fit SCIPY
+        try:
+            result=self.fitter.fit()
+            self._simul_fit_completed(result,qmin,qmax)
+        except:
+            raise
+            wx.PostEvent(self.parent, StatusEvent(status="Simultaneous Fitting error: %s" % sys.exc_value))
+            return
+   
+    def _on_change_engine(self, engine='park'):
+        """
+            Allow to select the type of engine to perform fit 
+            @param engine: the key work of the engine
+        """
+        self._fit_engine = engine
+   
+   
+    def _on_model_panel(self, evt):
+        """
+            react to model selection on any combo box or model menu.plot the model  
+        """
+        model = evt.model
+        name = evt.name
+        sim_page=self.fit_panel.get_page(0)
+        current_pg = self.fit_panel.get_current_page() 
+        if current_pg != sim_page:
+            current_pg.set_model_name(name)
+            current_pg.set_panel(model)
+            try:
+                data=self.page_finder[current_pg].get_data()
+                M_name="M"+str(self.index_model)+"= "+name+"("+data.group_id+")"
+            except:
+                raise 
+                M_name="M"+str(self.index_model)+"= "+name
+            model.name="M"+str(self.index_model)
+            self.index_model += 1  
+            self.page_finder[current_pg].set_theory("Fitness")
+            #print "on model",model.name
+            self.page_finder[current_pg].set_model(Model(model),M_name)
+            self.plot_helper(currpage= current_pg,qmin= None,qmax= None)
+            sim_page.add_model(self.page_finder)
+        
+            
+    def redraw_model(self,qmin= None,qmax= None):
+        """
+            Draw a theory according to model changes or data range.
+            @param qmin: the minimum value plotted for theory
+            @param qmax: the maximum value plotted for theory
+        """
+        current_pg=self.fit_panel.get_current_page()
+        for page, value in self.page_finder.iteritems():
+            if page ==current_pg :
+                break 
+        self.plot_helper(currpage=page,qmin= qmin,qmax= qmax)
+        
+    def plot_helper(self,currpage,qmin=None,qmax=None):
+        """
+            Plot a theory given a model and data
+            @param model: the model from where the theory is derived
+            @param currpage: page in a dictionary referring to some data
+        """
+        #print "fitting: plot helper"
+        if self.fit_panel.get_page_count() >1:
+            for page in self.page_finder.iterkeys():
+                if  page==currpage :  
+                    break 
+           
+            data=self.page_finder[page].get_data()
+            list=self.page_finder[page].get_model()
+            model=list[0]
+            if data!=None:
+                theory = Theory1D(x=[], y=[])
+                theory.name = self.page_finder[page].get_theory()
+                theory.group_id = data.group_id
+              
+                x_name, x_units = data.get_xaxis() 
+                y_name, y_units = data.get_yaxis() 
+                theory.xaxis(x_name, x_units)
+                theory.yaxis(y_name, y_units)
+              
+                if qmin == None :
+                   qmin = min(data.x)
+                if qmax == None :
+                    qmax = max(data.x)
+                try:
+                    tempx = qmin
+                    tempy = model.eval(qmin)
+                    theory.x.append(tempx)
+                    theory.y.append(tempy)
+                except :
+                        wx.PostEvent(self.parent, StatusEvent(status="fitting \
+                        skipping point x %g %s" %(qmin, sys.exc_value)))
+                           
+                for i in range(len(data.x)):
+                    try:
+                        if data.x[i]> qmin and data.x[i]< qmax:
+                            tempx = data.x[i]
+                            tempy = model.eval(tempx)
+                            
+                            theory.x.append(tempx) 
+                            theory.y.append(tempy)
+                    except:
+                        wx.PostEvent(self.parent, StatusEvent(status="fitting \
+                        skipping point x %g %s" %(data.x[i], sys.exc_value)))   
+                try:
+                    tempx = qmax
+                    tempy = model.eval(qmax)
+                    theory.x.append(tempx)
+                    theory.y.append(tempy)
+                except:
+                        wx.PostEvent(self.parent, StatusEvent(status="fitting \
+                        skipping point x %g %s" %(qmax, sys.exc_value)))
+                try:
+                    from sans.guicomm.events import NewPlotEvent
+                    #print"fitting: theory",theory
+                    wx.PostEvent(self.parent, NewPlotEvent(plot=theory, title="Analytical model"))
+                except:
+                    raise
+                    print "SimView.complete1D: could not import sans.guicomm.events"
+            
+            
+    def _on_model_menu(self, evt):
+        """
+            Plot a theory from a model selected from the menu
+        """
+        x = pylab.arange(0.001, 0.1, 0.001)
+        xlen = len(x)
+        dy = numpy.zeros(xlen)
+        y = numpy.zeros(xlen)
+        
+        for i in range(xlen):
+            y[i] = evt.model.run(x[i])
+            dy[i] = math.sqrt(math.fabs(y[i]))
+        try:
+           
+            new_plot = Theory1D(x, y)
+            #new_plot.name = evt.model.__class__.__name__
+            new_plot.name ="Fitness"
+            new_plot.xaxis("\\rm{Q}", 'A^{-1}')
+            new_plot.yaxis("\\rm{Intensity} ","cm^{-1}")
+         
+            wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, title="Analytical model"))
+        except:
+            print "SimView.complete1D: could not import sans.guicomm.events"
+
+
+if __name__ == "__main__":
+    i = Plugin()
+    
+    
+    
+    
Index: sansview/perspectives/fitting/models.py
===================================================================
--- sansview/perspectives/fitting/models.py	(revision d89f09b35713186021727a80260c3d5a38746821)
+++ sansview/perspectives/fitting/models.py	(revision d89f09b35713186021727a80260c3d5a38746821)
@@ -0,0 +1,87 @@
+import wx
+import os
+import os.path
+
+(ModelEvent, EVT_MODEL) = wx.lib.newevent.NewEvent()
+
+
+class ModelManager:
+    
+    ## Dictionary of models
+    model_list = {}
+    model_list_box = {}
+    ## Event owner
+    event_owner = None
+    
+    def _getModelList(self):
+        """
+            List of models we want to make available by default
+            for this application
+            
+            @param id: first event ID to register the menu events with
+            @return: the next free event ID following the new menu events
+        """
+        self.model_list = {}
+        self.model_list_box = {}
+        from sans.models.CylinderModel import CylinderModel
+        self.model_list[str(wx.NewId())] = CylinderModel 
+      
+        from sans.models.SphereModel import SphereModel
+        self.model_list[str(wx.NewId())] = SphereModel
+   
+        from sans.guitools.LineModel import LineModel
+        self.model_list[str(wx.NewId())]  = LineModel
+      
+        return 0
+
+    
+    def populate_menu(self, modelmenu, event_owner):
+        """
+            Populate a menu with our models
+            
+            @param id: first menu event ID to use when binding the menu events
+            @param modelmenu: wx.Menu object to populate
+            @param event_owner: wx object to bind the menu events to
+            @return: the next free event ID following the new menu events
+        """
+        
+        self._getModelList()
+        self.event_owner = event_owner
+
+        for id_str,value in self.model_list.iteritems():
+            item = self.model_list[id_str]
+            
+            name = item.__name__
+            if hasattr(item, "name"):
+                name = item.name
+                
+            self.model_list_box[name] =value
+            
+            modelmenu.Append(int(id_str), name, name)
+            wx.EVT_MENU(event_owner, int(id_str), self._on_model)       
+    
+        return 0
+    
+    def _on_model(self, evt):
+        """
+            React to a model menu event
+            @param event: wx menu event
+        """
+        if str(evt.GetId()) in self.model_list.keys():
+            # Notify the application manager that a new model has been set
+            #self.app_manager.set_model(self.model_list[str(evt.GetId())]())
+            
+            #TODO: post a model event to update all panels that need
+            #evt = ModelEvent(model=self.model_list[str(evt.GetId())]())
+           
+            model = self.model_list[str(evt.GetId())]()
+            evt = ModelEvent(model=model)
+            wx.PostEvent(self.event_owner, evt)
+        
+    def get_model_list(self):    
+        """ @ return dictionary of models for fitpanel use """
+        return self.model_list_box
+    
+    
+    
+ 
Index: sansview/perspectives/fitting/simfitpage.py
===================================================================
--- sansview/perspectives/fitting/simfitpage.py	(revision d89f09b35713186021727a80260c3d5a38746821)
+++ sansview/perspectives/fitting/simfitpage.py	(revision d89f09b35713186021727a80260c3d5a38746821)
@@ -0,0 +1,253 @@
+
+
+import sys,re,string, wx   
+from sans.guicomm.events import StatusEvent    
+
+class SimultaneousFitPage(wx.Panel):
+    """
+        Simultaneous fitting panel
+        All that needs to be defined are the
+        two data members window_name and window_caption
+    """
+      ## Internal name for the AUI manager
+    window_name = "simultaneous Fit page"
+    ## Title to appear on top of the window
+    window_caption = "Simultaneous Fit Page"
+    
+    
+    def __init__(self, parent, *args, **kwargs):
+        wx.Panel.__init__(self, parent, *args, **kwargs)
+        """
+             Simultaneous page display
+        """
+        self.parent = parent
+        self.sizer3 = wx.GridBagSizer(5,5)
+        self.sizer1 = wx.GridBagSizer(5,5)
+        self.sizer2 = wx.GridBagSizer(5,5)
+        self.vbox  = wx.BoxSizer(wx.VERTICAL)
+        self.vbox.Add(self.sizer3)
+        self.vbox.Add(self.sizer1)
+        self.vbox.Add(self.sizer2)
+        id = wx.NewId()
+        self.btFit =wx.Button(self,id,'Constraint Fit')
+        self.btFit.Bind(wx.EVT_BUTTON, self.onFit,id=id)
+        self.btFit.SetToolTipString("Perform fit.")
+        ix = 0
+        iy = 1 
+        self.cb1 = wx.CheckBox(self, -1,'Models', (10, 10))
+        self.sizer3.Add(self.cb1,(iy, ix),(1,1),\
+                        wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        wx.EVT_CHECKBOX(self, self.cb1.GetId(), self.select_all_model_name)
+        wx.EVT_CHECKBOX(self, self.cb1.GetId(), self.select_all_model_name)
+        ix  = 0
+        iy  = 1
+        text=wx.StaticText(self, -1, 'Constraint')
+        self.sizer2.Add(text,(iy, ix),(1,1),\
+                        wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        ix  = 0
+        iy  += 1
+        self.ctl2 = wx.TextCtrl(self, -1, style=wx.TE_MULTILINE)
+        self.ctl2.Bind(wx.EVT_KILL_FOCUS, self._onTextEnter)
+        self.sizer2.Add(self.ctl2, (iy, ix),(1,1),wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        ix +=2
+        self.sizer2.Add(self.btFit,(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        self.params=[]
+        self.model_list=[]
+        self.model_toFit=[]
+        iy +=1
+        self.sizer2.Add((20,20),(iy, ix))
+        self.vbox.Layout()
+        self.vbox.Fit(self) 
+        self.SetSizer(self.vbox)
+        self.Centre()
+        
+        
+    def onFit(self,event):
+         """ signal for fitting"""
+         if len(self.model_toFit) >0 :
+             self.set_model()
+             self.manager._on_simul_fit()
+         else:
+             wx.PostEvent(self.parent.GrandParent, StatusEvent(status=\
+                            "Select at least on model to fit "))
+    def set_manager(self, manager):
+        """
+            set panel manager
+            @param manager: instance of plugin fitting
+        """
+        self.manager = manager
+        
+        
+    def select_all_model_name(self,event):
+        """
+            check all models names
+        """
+        self.model_toFit=[] 
+        if self.cb1.GetValue()==True:
+            for item in self.model_list:
+                item[0].SetValue(True)
+                self.model_toFit.append(item)
+        else:
+            for item in self.model_list:
+                item[0].SetValue(False) 
+            self.model_toFit=[]
+       
+            
+    def add_model(self,page_finder):
+        """
+            Receive a dictionary containing information to display model name
+            @param page_finder: the dictionary containing models information
+        """
+        self.model_list=[]
+        self.model_toFit=[]
+        self.sizer1.Clear(True)
+        ix = 0
+        iy = 1 
+        list=[]
+        for page, value in page_finder.iteritems():
+            try:
+                list=value.get_model()
+                model=list[0]
+                modelname=list[1]
+                cb = wx.CheckBox(self, -1, modelname, (10, 10))
+                cb.SetValue(False)
+                self.sizer1.Add( cb,( iy,ix),(1,1),  wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+                ix = 0
+                iy += 1 
+                wx.EVT_CHECKBOX(self, cb.GetId(), self.select_model_name)
+                self.model_list.append([cb,value,page,modelname])
+            except:
+                #wx.PostEvent(self.parent.GrandParent, StatusEvent(status="Simultaneous fit: %s doesn't have a model selected yet %s" % \
+                #(value.get_data().group_id,sys.exc_value)))
+                pass
+        self.sizer1.Layout()        
+        self.vbox.Layout()
+        
+    def remove_model(self,delpage):
+        """
+             Remove  a checkbox and the name realted to a model selected on page delpage
+             @param delpage: the page removed
+        """
+        self.sizer1.Clear(True)
+        ix = 0
+        iy = 1 
+        for item in self.model_list:
+            try:
+                if not delpage in item:
+                    #print "simfitpage:  redraw modelname",item[3]
+                    cb = wx.CheckBox(self, -1, item[3], (10, 10))
+                    cb.SetValue(False)
+                    self.sizer1.Add( cb,( iy,ix),(1,1),  wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+                    ix = 0
+                    iy += 1 
+                    wx.EVT_CHECKBOX(self, cb.GetId(), self.select_model_name)
+                else:
+                    self.model_list.remove(item)
+            except:
+                raise
+        self.sizer1.Layout()        
+        self.vbox.Layout()
+            
+        
+    def select_model_name(self,event):
+        """
+            Save interformation related to checkbox and their states
+        """
+        self.model_toFit=[]
+        for item in self.model_list:
+            if item[0].GetValue()==True:
+                self.model_toFit.append(item)
+            else:
+                if item in self.model_toFit:
+                    self.model_toFit.remove(item)
+                    self.cb1.SetValue(False)
+        if len(self.model_list)==len(self.model_toFit):
+            self.cb1.SetValue(True)
+        else:
+            self.cb1.SetValue(False)
+  
+   
+    def set_model(self):
+        """
+            set_model take values in self.params which are the values enters by the user
+            and try to assign them into the model concerned in self.manager. page.finder
+        """
+        if len(self.params) >0:
+            for item in self.model_toFit:
+                #print"simfitpage: self.model_toFit",item[1]
+                list=item[1].get_model()
+                #print "simfitpage: list fitpanel2",list,list[0]
+                model=list[0]
+                param_list=model.model.getParamList()
+                #print "simfitpage: on set_model ",self.params
+                if self.params !=[]:
+                    for element in self.params:
+                        if model.model.name == str(element[0]):
+                            for item in param_list:
+                                if item==str(element[1]):
+                                    #print "simfitpage: on set_model page 1",param_list
+                                    #print "simfitpage: model name",element[0], model.name
+                                    #print "simfitpage: param name ,param value",element[1],element[2]
+                                    self.manager.set_page_finder(model.model.name,element[1],\
+                                                                 str(element[2]))
+                            #print "simfitpage:on set_model page 2",model.params['A'],self.params[2]
+                
+                
+    def _onTextEnter(self,event):
+        """
+            get values from the constrainst textcrtl ,parses them into model name
+            parameter name and parameters values.
+            store them in a list self.params .when when params is not empty set_model uses it
+            to reset the appropriate model and its appropriates parameters
+        """
+        value= self.ctl2.GetValue()
+        self.params=[]
+        #print "simfitpage: value",value
+        try:
+            expression='[\s,;]'
+            if re.search(expression,value) !=None:
+                word=re.split(expression,value)
+                #print "simfitpage: when herre",word
+                for item in word:
+                    try:
+                        self.params.append(self.parser_helper(item))
+                    except:
+                        wx.PostEvent(self.parent.GrandParent, StatusEvent(status="Loading Error: %s" % sys.exc_value))
+            else:
+                try:
+                    self.params.append(self.parser_helper(value))
+                except:
+                     wx.PostEvent(self.parent.GrandParent, StatusEvent(status="Loading Error: %s" % sys.exc_value))
+        except:
+            raise
+        #print "simfitpage: self.params",self.params
+        
+        
+        
+    def parser_helper(self,value):
+        """
+             @return  param:a list containing the name of a model ,its parameters 
+             value and name extracted from the constrainst controlbox
+        """
+        #print "simfitpage: value",value
+        if string.find(value, "=") !=-1:
+            model_param= re.split("=",value)
+            param_name=model_param[0]
+            param_value=model_param[1]
+            #print"simfitpage: ", param_name
+            #print "simfitpage: ",param_value
+            if string.find(param_name,".")!=-1:
+                param_names= re.split("\.",param_name)
+                model_name=param_names[0]
+                param_name=param_names[1]
+                param=[str(model_name),str(param_name),str(param_value)]
+                #print "simfitpage: param",param
+                return param
+            else:
+                raise ValueError,"cannot evaluate this expression"
+                return
+        else:
+            raise ValueError,"Missing '=' in expression"
+        
+   
+    
Index: sansview/sansview.py
===================================================================
--- sansview/sansview.py	(revision d89f09b35713186021727a80260c3d5a38746821)
+++ sansview/sansview.py	(revision d89f09b35713186021727a80260c3d5a38746821)
@@ -0,0 +1,33 @@
+import wx
+#import gui_manager
+from sans.guiframe import gui_manager
+
+# For py2exe, import config here
+import local_config
+
+
+class SansView():
+    
+    def __init__(self):
+        """
+        
+        """
+        #from gui_manager import ViewApp
+        self.gui = gui_manager.ViewApp(0) 
+        
+        # Add perspectives to the basic application
+        # Additional perspectives can still be loaded
+        # dynamically
+            
+        # Build the GUI
+        self.gui.build_gui()
+        
+        # Set the application manager for the GUI
+        self.gui.set_manager(self)
+        
+        # Start the main loop
+        self.gui.MainLoop()  
+        
+
+if __name__ == "__main__": 
+    sansview = SansView()
Index: sansview/testdata_line.txt
===================================================================
--- sansview/testdata_line.txt	(revision d89f09b35713186021727a80260c3d5a38746821)
+++ sansview/testdata_line.txt	(revision d89f09b35713186021727a80260c3d5a38746821)
@@ -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
Index: sansview/testdata_line3.txt
===================================================================
--- sansview/testdata_line3.txt	(revision d89f09b35713186021727a80260c3d5a38746821)
+++ sansview/testdata_line3.txt	(revision d89f09b35713186021727a80260c3d5a38746821)
@@ -0,0 +1,53 @@
+#y=A*x+B
+#A=2.5
+#B=4
+0  2.83954  0.6
+1  3.44938  0.676531
+0.408163  5.82026  0.753061
+0.612245  5.27591  0.829592
+45  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
+3  9.22407  1.36531
+2.2449  7.95013  1.44184
+2.44898  10.0289  1.51837
+0 11.0736  1.5949
+2.85714  12.2957  1.67143
+3.06122  12.3108  1.74796
+3.26531  12.6916  1.82449
+4  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
+-1  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
+4  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
+0.2  24.2611  3.89082
+8.97959  29.8796  3.96735
+9.18367  24.6149  4.04388
+0.1  35.7664  4.12041
+0.3  32.145  4.19694
+9.79592  24.8085  4.27347
+10  31.3767  4.35
