Index: sanscalculator/src/sans/calculator/docs/sans_calculator_pylint.txt
===================================================================
--- sanscalculator/src/sans/calculator/docs/sans_calculator_pylint.txt	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
+++ sanscalculator/src/sans/calculator/docs/sans_calculator_pylint.txt	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
@@ -0,0 +1,121 @@
+Microsoft Windows XP [Version 5.1.2600]
+(C) Copyright 1985-2001 Microsoft Corp.
+
+C:\Documents and Settings\galina\workspace>pylint sans.calculator
+No config file found, using default configuration
+************* Module sans.calculator
+C:  1: Missing docstring
+************* Module sans.calculator.slit_length_calculator
+C: 75: Line too long (87/80)
+C: 91: Line too long (83/80)
+C: 16:SlitlengthCalculator.__init__: Invalid name "y" (should match [a-z_][a-z0-
+9_]{2,30}$)
+C: 14:SlitlengthCalculator.__init__: Invalid name "x" (should match [a-z_][a-z0-
+9_]{2,30}$)
+C: 25:SlitlengthCalculator.set_data: Invalid name "x" (should match [a-z_][a-z0-
+9_]{2,30}$)
+C: 25:SlitlengthCalculator.set_data: Invalid name "y" (should match [a-z_][a-z0-
+9_]{2,30}$)
+C: 25:SlitlengthCalculator.set_data: Invalid name "x" (should match [a-z_][a-z0-
+9_]{2,30}$)
+C: 25:SlitlengthCalculator.set_data: Invalid name "y" (should match [a-z_][a-z0-
+9_]{2,30}$)
+C: 46:SlitlengthCalculator.calculate_slit_length: Invalid name "y" (should match
+ [a-z_][a-z0-9_]{2,30}$)
+C: 47:SlitlengthCalculator.calculate_slit_length: Invalid name "x" (should match
+ [a-z_][a-z0-9_]{2,30}$)
+C: 62:SlitlengthCalculator.calculate_slit_length: More than one statement on a s
+ingle line
+
+
+Report
+======
+45 statements analysed.
+
+Statistics by type
+------------------
+
++---------+-------+-----------+-----------+------------+---------+
+|type     |number |old number |difference |%documented |%badname |
++=========+=======+===========+===========+============+=========+
+|module   |2      |2          |=          |50.00       |0.00     |
++---------+-------+-----------+-----------+------------+---------+
+|class    |1      |1          |=          |100.00      |0.00     |
++---------+-------+-----------+-----------+------------+---------+
+|method   |4      |4          |=          |100.00      |0.00     |
++---------+-------+-----------+-----------+------------+---------+
+|function |0      |0          |=          |0           |0        |
++---------+-------+-----------+-----------+------------+---------+
+
+
+
+Raw metrics
+-----------
+
++----------+-------+------+---------+-----------+
+|type      |number |%     |previous |difference |
++==========+=======+======+=========+===========+
+|code      |46     |50.55 |45       |+1.00      |
++----------+-------+------+---------+-----------+
+|docstring |23     |25.27 |23       |=          |
++----------+-------+------+---------+-----------+
+|comment   |15     |16.48 |14       |+1.00      |
++----------+-------+------+---------+-----------+
+|empty     |7      |7.69  |6        |+1.00      |
++----------+-------+------+---------+-----------+
+
+
+
+Duplication
+-----------
+
++-------------------------+------+---------+-----------+
+|                         |now   |previous |difference |
++=========================+======+=========+===========+
+|nb duplicated lines      |0     |0        |=          |
++-------------------------+------+---------+-----------+
+|percent duplicated lines |0.000 |0.000    |=          |
++-------------------------+------+---------+-----------+
+
+
+
+Messages by category
+--------------------
+
++-----------+-------+---------+-----------+
+|type       |number |previous |difference |
++===========+=======+=========+===========+
+|convention |12     |14       |-2.00      |
++-----------+-------+---------+-----------+
+|refactor   |0      |0        |=          |
++-----------+-------+---------+-----------+
+|warning    |0      |494      |-494.00    |
++-----------+-------+---------+-----------+
+|error      |0      |0        |=          |
++-----------+-------+---------+-----------+
+
+
+
+Messages
+--------
+
++-----------+------------+
+|message id |occurrences |
++===========+============+
+|C0103      |8           |
++-----------+------------+
+|C0301      |2           |
++-----------+------------+
+|C0321      |1           |
++-----------+------------+
+|C0111      |1           |
++-----------+------------+
+
+
+
+Global evaluation
+-----------------
+Your code has been rated at 7.33/10 (previous run: -100.43/10)
+
+
+C:\Documents and Settings\galina\workspace>
Index: sanscalculator/src/sans/calculator/docs/sphinx/Makefile
===================================================================
--- sanscalculator/src/sans/calculator/docs/sphinx/Makefile	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
+++ sanscalculator/src/sans/calculator/docs/sphinx/Makefile	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
@@ -0,0 +1,130 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS    =
+SPHINXBUILD   = sphinx-build
+PAPER         =
+BUILDDIR      = _build
+
+# Internal variables.
+PAPEROPT_a4     = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
+
+help:
+	@echo "Please use \`make <target>' where <target> is one of"
+	@echo "  html       to make standalone HTML files"
+	@echo "  dirhtml    to make HTML files named index.html in directories"
+	@echo "  singlehtml to make a single large HTML file"
+	@echo "  pickle     to make pickle files"
+	@echo "  json       to make JSON files"
+	@echo "  htmlhelp   to make HTML files and a HTML help project"
+	@echo "  qthelp     to make HTML files and a qthelp project"
+	@echo "  devhelp    to make HTML files and a Devhelp project"
+	@echo "  epub       to make an epub"
+	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
+	@echo "  text       to make text files"
+	@echo "  man        to make manual pages"
+	@echo "  changes    to make an overview of all changed/added/deprecated items"
+	@echo "  linkcheck  to check all external links for integrity"
+	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+	-rm -rf $(BUILDDIR)/*
+
+html:
+	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+singlehtml:
+	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+	@echo
+	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+pickle:
+	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+	@echo
+	@echo "Build finished; now you can process the pickle files."
+
+json:
+	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+	@echo
+	@echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+	@echo
+	@echo "Build finished; now you can run HTML Help Workshop with the" \
+	      ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+	@echo
+	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
+	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/calculator.qhcp"
+	@echo "To view the help file:"
+	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/calculator.qhc"
+
+devhelp:
+	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+	@echo
+	@echo "Build finished."
+	@echo "To view the help file:"
+	@echo "# mkdir -p $$HOME/.local/share/devhelp/calculator"
+	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/calculator"
+	@echo "# devhelp"
+
+epub:
+	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+	@echo
+	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+latex:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo
+	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+	@echo "Run \`make' in that directory to run these through (pdf)latex" \
+	      "(use \`make latexpdf' here to do that automatically)."
+
+latexpdf: latex
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo "Running LaTeX files through pdflatex..."
+	make -C $(BUILDDIR)/latex all-pdf
+	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+text:
+	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+	@echo
+	@echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+man:
+	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+	@echo
+	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+changes:
+	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+	@echo
+	@echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+	@echo
+	@echo "Link check complete; look for any errors in the above output " \
+	      "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+	@echo "Testing of doctests in the sources finished, look at the " \
+	      "results in $(BUILDDIR)/doctest/output.txt."
Index: sanscalculator/src/sans/calculator/docs/sphinx/_extensions/only_directives.py
===================================================================
--- sanscalculator/src/sans/calculator/docs/sphinx/_extensions/only_directives.py	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
+++ sanscalculator/src/sans/calculator/docs/sphinx/_extensions/only_directives.py	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
@@ -0,0 +1,63 @@
+#
+# A pair of directives for inserting content that will only appear in
+# either html or latex.
+#
+
+from docutils.nodes import Body, Element
+from docutils.parsers.rst import directives
+
+class only_base(Body, Element):
+    def dont_traverse(self, *args, **kwargs):
+        return []
+
+class html_only(only_base):
+    pass
+
+class latex_only(only_base):
+    pass
+
+def run(content, node_class, state, content_offset):
+    text = '\n'.join(content)
+    node = node_class(text)
+    state.nested_parse(content, content_offset, node)
+    return [node]
+
+def html_only_directive(name, arguments, options, content, lineno,
+                        content_offset, block_text, state, state_machine):
+    return run(content, html_only, state, content_offset)
+
+def latex_only_directive(name, arguments, options, content, lineno,
+                         content_offset, block_text, state, state_machine):
+    return run(content, latex_only, state, content_offset)
+
+def builder_inited(app):
+    if app.builder.name == 'html':
+        latex_only.traverse = only_base.dont_traverse
+    else:
+        html_only.traverse = only_base.dont_traverse
+
+def setup(app):
+    app.add_directive('htmlonly', html_only_directive, True, (0, 0, 0))
+    app.add_directive('latexonly', latex_only_directive, True, (0, 0, 0))
+    app.add_node(html_only)
+    app.add_node(latex_only)
+
+    # This will *really* never see the light of day As it turns out,
+    # this results in "broken" image nodes since they never get
+    # processed, so best not to do this.
+    # app.connect('builder-inited', builder_inited)
+
+    # Add visit/depart methods to HTML-Translator:
+    def visit_perform(self, node):
+        pass
+    def depart_perform(self, node):
+        pass
+    def visit_ignore(self, node):
+        node.children = []
+    def depart_ignore(self, node):
+        node.children = []
+
+    app.add_node(html_only, html=(visit_perform, depart_perform))
+    app.add_node(html_only, latex=(visit_ignore, depart_ignore))
+    app.add_node(latex_only, latex=(visit_perform, depart_perform))
+    app.add_node(latex_only, html=(visit_ignore, depart_ignore))
Index: sanscalculator/src/sans/calculator/docs/sphinx/api/index.rst
===================================================================
--- sanscalculator/src/sans/calculator/docs/sphinx/api/index.rst	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
+++ sanscalculator/src/sans/calculator/docs/sphinx/api/index.rst	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
@@ -0,0 +1,17 @@
+.. Autogenerated by genmods.py
+
+.. _api-index:
+
+##############################################################################
+   Reference
+##############################################################################
+
+.. only:: html
+
+   :Release: |version|
+   :Date: |today|
+
+.. toctree::
+
+   sld_calculator.rst
+   slit_length_calculator.rst
Index: sanscalculator/src/sans/calculator/docs/sphinx/api/sld_calculator.rst
===================================================================
--- sanscalculator/src/sans/calculator/docs/sphinx/api/sld_calculator.rst	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
+++ sanscalculator/src/sans/calculator/docs/sphinx/api/sld_calculator.rst	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
@@ -0,0 +1,15 @@
+.. Autogenerated by genmods.py
+
+******************************************************************************
+Sld Calculator
+******************************************************************************
+
+:mod:`sans.calculator.sld_calculator`
+==============================================================================
+
+.. automodule:: sans.calculator.sld_calculator
+   :members:
+   :undoc-members:
+   :inherited-members:
+   :show-inheritance:
+
Index: sanscalculator/src/sans/calculator/docs/sphinx/api/slit_length_calculator.rst
===================================================================
--- sanscalculator/src/sans/calculator/docs/sphinx/api/slit_length_calculator.rst	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
+++ sanscalculator/src/sans/calculator/docs/sphinx/api/slit_length_calculator.rst	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
@@ -0,0 +1,15 @@
+.. Autogenerated by genmods.py
+
+******************************************************************************
+Slit Length Calculator
+******************************************************************************
+
+:mod:`sans.calculator.slit_length_calculator`
+==============================================================================
+
+.. automodule:: sans.calculator.slit_length_calculator
+   :members:
+   :undoc-members:
+   :inherited-members:
+   :show-inheritance:
+
Index: sanscalculator/src/sans/calculator/docs/sphinx/conf.py
===================================================================
--- sanscalculator/src/sans/calculator/docs/sphinx/conf.py	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
+++ sanscalculator/src/sans/calculator/docs/sphinx/conf.py	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
@@ -0,0 +1,227 @@
+# -*- coding: utf-8 -*-
+#
+# calculator documentation build configuration file, created by
+# sphinx-quickstart on Thu May 27 09:12:00 2010.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+
+sys.path.append(os.path.abspath(os.path.dirname('../../calculator')))
+sys.path.append(os.path.abspath('_extensions'))
+# -- General configuration -----------------------------------------------------
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest',
+              'sphinx.ext.coverage', 'sphinx.ext.pngmath',
+              'only_directives',             
+             ]
+# -- General configuration -----------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+#extensions = []
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'calculator'
+copyright = u'2010, Gervaise Alina'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = '0.1'
+# The full version, including alpha/beta/rc tags.
+release = '0.1.0'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = ['_build']
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+
+# -- Options for HTML output ---------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages.  Major themes that come with
+# Sphinx are currently 'default' and 'sphinxdoc'.
+html_theme = 'default'
+#html_theme = 'dansestyle'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further.  For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+#html_theme_options = {"headtextcolor": "OrangeRed"}
+# Add any paths that contain custom themes here, relative to this directory.
+html_theme_path = ["."]
+
+
+# The name for this set of Sphinx documents.  If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar.  Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_domain_indices = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+#html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it.  The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = ''
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'calculatordoc'
+
+
+# -- Options for LaTeX output --------------------------------------------------
+
+# The paper size ('letter' or 'a4').
+#latex_paper_size = 'letter'
+
+# The font size ('10pt', '11pt' or '12pt').
+#latex_font_size = '10pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, documentclass [howto/manual]).
+latex_documents = [
+  ('index', 'calculator.tex', u'calculator Documentation',
+   u'Gervaise Alina', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# If true, show page references after internal links.
+#latex_show_pagerefs = False
+
+# If true, show URL addresses after external links.
+#latex_show_urls = False
+
+# Additional stuff for the LaTeX preamble.
+#latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_domain_indices = True
+
+
+# -- Options for manual page output --------------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+    ('index', 'calculator', u'calculator Documentation',
+     [u'Gervaise Alina'], 1)
+]
Index: sanscalculator/src/sans/calculator/docs/sphinx/dansestyle/static/dansestyle.css
===================================================================
--- sanscalculator/src/sans/calculator/docs/sphinx/dansestyle/static/dansestyle.css	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
+++ sanscalculator/src/sans/calculator/docs/sphinx/dansestyle/static/dansestyle.css	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
@@ -0,0 +1,244 @@
+/* DANSE style sheet */
+/* Version 1.0       */
+
+
+body { 
+	font-family:Arial, Helvetica, sans-serif;
+	font-size: 14px;
+ 	font-style: normal;
+        width:800px;
+	/* margin: top right bottom left */
+        margin: 10px auto 10px auto; 
+	border-left: 1px solid gray;
+	border-right: 1px solid gray;
+	border-top: 1px solid gray;
+	border-bottom: 1px solid gray;
+	}
+
+/* Variable width support --- overrides fixed width above */
+body {
+	width:auto;
+	margin: 10px 10px 10px 10px; 
+        }
+
+
+a:visited, a:link, a:active { 
+	text-decoration: none; 
+	color: blue;
+	}
+
+h2 {
+	margin-top: 30px;
+}
+
+h3 {
+	margin-top: 30px;
+}
+
+a:hover {
+	text-decoration: none;
+	color: gray;
+	}
+
+
+pre {
+	/*
+	#font-size: 20px;
+	#font-style: fixed;
+	display: block;
+	*/
+	margin-left: 2em;
+	margin-top: 1.5ex;
+	margin-bottom: 1.5ex;
+}
+
+
+
+#textContainer {
+	padding-left:10px;
+	padding-right:10px;
+}
+
+#textContainer ul {
+	top: 0px; 
+	right: 0px;
+	list-style: list-style-type;
+	list-style-type: square;
+}
+
+#textContainer li {
+	line-height: 2.0ex; 
+	padding-top: 0px; 
+	margin-bottom: 5px;
+}
+
+
+#textContainer dl {
+	top: 0px; 
+	right: 0px;
+	list-style: list-style-type;
+	list-style-type: none;
+	margin-left:0em;
+	margin:0em;
+}
+
+#textContainer dt {
+	font-size: 1.17em;
+	font-weight: bold;
+	margin-top: 30px;
+	margin-left: 0px;
+	padding-left: 25px;
+	margin-bottom: 0px;
+	margin: 0px;
+}
+
+#textContainer dd {
+	line-height: 2.0ex; 
+	padding-top: 0px; 
+	margin-left: 0px;
+	padding-left: 25px;
+	margin-bottom: 20px;
+}
+
+
+#menuItem {
+	/* background: transparent url(line.png) no-repeat top left; */ 
+	border-top: 2px solid gray; 
+	border-bottom: 2px solid gray; 
+	background : #e4e7e9;
+	font-size:16px; 
+	font-weight:bold; 
+	margin-bottom: 50px;
+	padding-left:7px;
+}
+
+#menuItem a:link, #menuItem a:visited{
+	line-height: 3.0ex; 
+	margin-right: 6px;
+	padding-right: 7px;
+	border-right: 1px solid blue;
+}
+
+#linkList {
+	top: 0px; 
+	right: 0px;
+	}
+
+#linkList ul {
+	list-style: list-style-type;
+	list-style-type: square;
+}
+
+#linkList li {
+	line-height: 2.0ex; 
+	padding-top: 0px; 
+	margin-bottom: 5px;
+}
+
+#linkList h3 {
+}
+
+#floater { 
+	margin-top: 20px; 
+	margin-bottom: 10px; 
+	margin-left:40px;
+	/* margin-right:10px;*/
+	float: right;
+	}
+	
+
+#floater img {
+	border:0;
+	align:top;
+}	
+	
+#quote {
+	margin-left:25px;
+	font-style:italic;
+
+}
+
+
+#pageHeader { 
+	height: 78px;
+	padding-left:0px;
+	font: normal 10pt/22pt Arial; 
+	padding-top:4px;
+	/*background: transparent url(ripple.jpg) top left; */
+}
+
+#pageHeader img {
+	border:0;
+	float: left;
+	margin-left: 10px;
+	margin-right: 1em;
+	margin-top: 7px;
+}
+
+
+#mainTitle { 
+	font: bold 10pt/22pt Arial; 
+	font-size:20px; 
+	font-weight:bold
+	margin-top: 10px; 
+	margin-bottom: -6px;
+	padding-top: 10px; 
+	}
+
+#subTitle { 
+	font-size:13px; 
+	font-weight:normal
+	margin-top: 0px; 	
+	}
+
+#summary {
+	margin-bottom: 10px;
+}
+
+#footer {
+	color : #75818a;
+	/*background : #e4e7e9;*/
+	/* background: #EEFFFF; */
+	font-size : 11px;
+	/*text-align : center;*/
+	clear : both;
+	height : 60px;
+	margin : 0;
+	/* border-top : 3px solid #c8cdd0; */
+	border-top: 1px solid gray; 
+}
+
+#footerImages {
+	padding-right:1em;
+	/* width:150px; */
+	/* padding-left:650px; */
+}
+
+#footerImages img {
+	float: right;
+	margin:0;
+	margin-top:5px;
+	margin-left:5px;
+	border:0;
+	align:top;
+	height:50px;
+	width:50px;
+}
+
+#footerText {
+        margin-left: 1em;
+	margin-right:10px;
+	margin-bottom: 0.ex;
+        margin-top: 30px;
+	text-align: left;
+}
+
+
+#contact {
+	padding-left:25px;
+	margin-bottom:40px;
+}
+
+#contact h3 {
+	margin-bottom:0px;
+}
Index: sanscalculator/src/sans/calculator/docs/sphinx/dansestyle/theme.conf
===================================================================
--- sanscalculator/src/sans/calculator/docs/sphinx/dansestyle/theme.conf	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
+++ sanscalculator/src/sans/calculator/docs/sphinx/dansestyle/theme.conf	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
@@ -0,0 +1,4 @@
+[theme]
+inherit = basic
+stylesheet = dansestyle.css
+
Index: sanscalculator/src/sans/calculator/docs/sphinx/genmods.py
===================================================================
--- sanscalculator/src/sans/calculator/docs/sphinx/genmods.py	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
+++ sanscalculator/src/sans/calculator/docs/sphinx/genmods.py	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
@@ -0,0 +1,64 @@
+from __future__ import with_statement
+import os.path
+
+MODULE_TEMPLATE=""".. Autogenerated by genmods.py
+
+******************************************************************************
+%(name)s
+******************************************************************************
+
+:mod:`%(package)s.%(module)s`
+==============================================================================
+
+.. automodule:: %(package)s.%(module)s
+   :members:
+   :undoc-members:
+   :inherited-members:
+   :show-inheritance:
+
+"""
+
+INDEX_TEMPLATE=""".. Autogenerated by genmods.py
+
+.. _api-index:
+
+##############################################################################
+   %(package_name)s
+##############################################################################
+
+.. only:: html
+
+   :Release: |version|
+   :Date: |today|
+
+.. toctree::
+
+   %(rsts)s
+"""
+
+
+def genfiles(package, package_name, modules, dir='api'):
+
+    if not os.path.exists(dir):
+        os.makedirs(dir)
+
+    for module,name in modules:
+        with open(os.path.join(dir,module+'.rst'), 'w') as f:
+            f.write(MODULE_TEMPLATE%locals())
+
+    rsts = "\n   ".join(module+'.rst' for module,name in modules)
+    with open(os.path.join(dir,'index.rst'),'w') as f:
+        f.write(INDEX_TEMPLATE%locals())
+
+
+modules=[
+    ('sld_calculator', 'Sld Calculator'),
+    ('slit_length_calculator', 'Slit Length Calculator'),
+]
+package='sans.calculator'
+package_name='Reference'
+genfiles(package, package_name, modules)
+
+if __name__ == "__main__":
+    genfiles(package, package_name, modules, dir='api')
+    print "Sphinx: generate .rst files complete..."
Index: sanscalculator/src/sans/calculator/docs/sphinx/index.rst
===================================================================
--- sanscalculator/src/sans/calculator/docs/sphinx/index.rst	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
+++ sanscalculator/src/sans/calculator/docs/sphinx/index.rst	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
@@ -0,0 +1,31 @@
+.. calculator documentation master file, created by
+   sphinx-quickstart on Thu May 27 09:12:00 2010.
+   You can adapt this file completely to your liking, but it should at least
+   contain the root `toctree` directive.
+
+Calculator
+======================================
+Calculator is a package that contains other sub-modules necessary for small computations. These sub-modules
+may be independant of each other, but there are used as ``tools`` for sansview application. The calculator package
+currently contains the following sub-modules:
+
+* :ref:`sans.invariant.invariant.index`
+
+.. htmlonly::
+
+   :Release: |version|
+   :Date:    |today|
+
+   
+.. toctree::
+   :maxdepth: 2
+
+   api/index.rst
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+
Index: sanscalculator/src/sans/calculator/docs/sphinx/make.bat
===================================================================
--- sanscalculator/src/sans/calculator/docs/sphinx/make.bat	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
+++ sanscalculator/src/sans/calculator/docs/sphinx/make.bat	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
@@ -0,0 +1,155 @@
+@ECHO OFF
+
+REM Command file for Sphinx documentation
+
+if "%SPHINXBUILD%" == "" (
+	set SPHINXBUILD=sphinx-build
+)
+set BUILDDIR=_build
+set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
+if NOT "%PAPER%" == "" (
+	set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
+)
+
+if "%1" == "" goto help
+
+if "%1" == "help" (
+	:help
+	echo.Please use `make ^<target^>` where ^<target^> is one of
+	echo.  html       to make standalone HTML files
+	echo.  dirhtml    to make HTML files named index.html in directories
+	echo.  singlehtml to make a single large HTML file
+	echo.  pickle     to make pickle files
+	echo.  json       to make JSON files
+	echo.  htmlhelp   to make HTML files and a HTML help project
+	echo.  qthelp     to make HTML files and a qthelp project
+	echo.  devhelp    to make HTML files and a Devhelp project
+	echo.  epub       to make an epub
+	echo.  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter
+	echo.  text       to make text files
+	echo.  man        to make manual pages
+	echo.  changes    to make an overview over all changed/added/deprecated items
+	echo.  linkcheck  to check all external links for integrity
+	echo.  doctest    to run all doctests embedded in the documentation if enabled
+	goto end
+)
+
+if "%1" == "clean" (
+	for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
+	del /q /s %BUILDDIR%\*
+	goto end
+)
+
+if "%1" == "html" (
+	%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/html.
+	goto end
+)
+
+if "%1" == "dirhtml" (
+	%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
+	goto end
+)
+
+if "%1" == "singlehtml" (
+	%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
+	goto end
+)
+
+if "%1" == "pickle" (
+	%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
+	echo.
+	echo.Build finished; now you can process the pickle files.
+	goto end
+)
+
+if "%1" == "json" (
+	%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
+	echo.
+	echo.Build finished; now you can process the JSON files.
+	goto end
+)
+
+if "%1" == "htmlhelp" (
+	%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
+	echo.
+	echo.Build finished; now you can run HTML Help Workshop with the ^
+.hhp project file in %BUILDDIR%/htmlhelp.
+	goto end
+)
+
+if "%1" == "qthelp" (
+	%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
+	echo.
+	echo.Build finished; now you can run "qcollectiongenerator" with the ^
+.qhcp project file in %BUILDDIR%/qthelp, like this:
+	echo.^> qcollectiongenerator %BUILDDIR%\qthelp\calculator.qhcp
+	echo.To view the help file:
+	echo.^> assistant -collectionFile %BUILDDIR%\qthelp\calculator.ghc
+	goto end
+)
+
+if "%1" == "devhelp" (
+	%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
+	echo.
+	echo.Build finished.
+	goto end
+)
+
+if "%1" == "epub" (
+	%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
+	echo.
+	echo.Build finished. The epub file is in %BUILDDIR%/epub.
+	goto end
+)
+
+if "%1" == "latex" (
+	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+	echo.
+	echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
+	goto end
+)
+
+if "%1" == "text" (
+	%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
+	echo.
+	echo.Build finished. The text files are in %BUILDDIR%/text.
+	goto end
+)
+
+if "%1" == "man" (
+	%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
+	echo.
+	echo.Build finished. The manual pages are in %BUILDDIR%/man.
+	goto end
+)
+
+if "%1" == "changes" (
+	%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
+	echo.
+	echo.The overview file is in %BUILDDIR%/changes.
+	goto end
+)
+
+if "%1" == "linkcheck" (
+	%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
+	echo.
+	echo.Link check complete; look for any errors in the above output ^
+or in %BUILDDIR%/linkcheck/output.txt.
+	goto end
+)
+
+if "%1" == "doctest" (
+	%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
+	echo.
+	echo.Testing of doctests in the sources finished, look at the ^
+results in %BUILDDIR%/doctest/output.txt.
+	goto end
+)
+
+:end
Index: sanscalculator/src/sans/calculator/instrument.py
===================================================================
--- sanscalculator/src/sans/calculator/instrument.py	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
+++ sanscalculator/src/sans/calculator/instrument.py	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
@@ -0,0 +1,392 @@
+"""
+This module is a small tool to allow user to 
+control instrumental parameters 
+"""
+import numpy
+
+# defaults in cgs unit
+_SAMPLE_A_SIZE = [1.27]
+_SOURCE_A_SIZE = [3.81] 
+_SAMPLE_DISTANCE = [1627, 0] 
+_SAMPLE_OFFSET = [0, 0] 
+_SAMPLE_SIZE = [2.54] 
+_SAMPLE_THICKNESS = 0.2  
+_D_DISTANCE = [1000, 0] 
+_D_SIZE = [128, 128]
+_D_PIX_SIZE = [0.5, 0.5]  
+
+_MIN = 0.0
+_MAX = 50.0
+_INTENSITY = 368428
+_WAVE_LENGTH = 6.0
+_WAVE_SPREAD = 0.125
+_MASS = 1.67492729E-24 #[gr]
+_LAMBDA_ARRAY = [[0, 1e+16],[_INTENSITY, _INTENSITY]]
+
+class Aperture(object):
+    """
+    An object class that defines the aperture variables
+    """
+    def __init__(self):
+        
+        # assumes that all aligned at the centers
+        # aperture_size [diameter] for pinhole, [dx, dy] for rectangular
+        self.sample_size = _SAMPLE_A_SIZE
+        self.source_size = _SOURCE_A_SIZE
+        self.sample_distance = _SAMPLE_DISTANCE
+        
+    def set_source_size(self, size =[]):
+        """
+        Set the source aperture size
+        """
+        if len(size) == 0:
+            self.source_size = 0.0 
+        else:
+            self.source_size = size
+            validate(size[0])
+    def set_sample_size(self, size =[]):
+        """
+        Set the sample aperture size
+        """
+        if len(size) == 0:
+            self.sample_size = 0.0 
+        else:
+            self.sample_size = size
+            validate(size[0])
+            
+    def set_sample_distance(self, distance = []):
+        """
+        Set the sample aperture distance
+        """
+        if len(distance) == 0:
+            self.sample_distance = 0.0 
+        else:
+            self.sample_distance = distance
+            validate(distance[0])
+        
+   
+class Sample(object):
+    """
+    An object class that defines the sample variables
+    """
+    def __init__(self):
+        
+        # assumes that all aligned at the centers
+        # source2sample or sample2detector distance
+        self.distance = _SAMPLE_OFFSET
+        self.size = _SAMPLE_SIZE
+        self.thickness = _SAMPLE_THICKNESS
+
+    
+    def set_size(self, size =[]):
+        """
+        Set the sample size
+        """
+        if len(size) == 0:
+            self.sample_size = 0.0 
+        else:
+            self.sample_size = size
+            validate(size[0])
+            
+    def set_thickness(self, thickness = 0.0):
+        """
+        Set the sample thickness
+        """
+        self.thickness = thickness
+        validate(thickness)
+    
+    def set_distance(self, distance = []):
+        """
+        Set the sample distance
+        """
+        if len(distance) == 0:
+            self.distance = 0.0 
+        else:
+            self.distance = distance
+            if distance[0] != 0.0:
+                validate(distance[0])
+        
+ 
+class Detector(object):
+    """
+    An object class that defines the detector variables
+    """
+    def __init__(self):
+        
+        # assumes that all aligned at the centers
+        # source2sample or sample2detector distance
+        self.distance = _D_DISTANCE
+        self.size = _D_SIZE
+        self.pix_size = _D_PIX_SIZE
+
+    
+        
+    def set_size(self, size =[]):
+        """
+        Set the detector  size
+        """
+        if len(size) == 0:
+            self.size = 0
+        else:
+            self.size = size
+            validate(size[0])
+            
+    def set_pix_size(self, size = []):
+        """
+        Set the detector pix_size
+        """
+        if len(size) == 0:
+            self.pix_size = 0 
+        else:
+            self.pix_size = size
+            validate(size[0])
+    
+    def set_distance(self, distance = []):
+        """
+        Set the detector distance
+        """
+        if len(distance) == 0:
+            self.distance = 0
+        else:
+            self.distance = distance
+            validate(distance[0])
+
+            
+class Neutron(object):
+    """
+    An object that defines the wavelength variables
+    """
+    def __init__(self):
+        
+        # neutron mass in cgs unit
+        self.mass = _MASS
+
+        # wavelength
+        self.wavelength = _WAVE_LENGTH
+        # wavelength spread (FWHM)
+        self.wavelength_spread = _WAVE_SPREAD
+        # wavelength spectrum 
+        self.spectrum = self.get_default_spectrum()        
+        # intensity in counts/sec
+        self.intensity = numpy.interp(self.wavelength, 
+                                      self.spectrum[0],
+                                      self.spectrum[1],
+                                      0.0,
+                                      0.0)
+        # min max range of the spectrum
+        self.min = min(self.spectrum[0])
+        self.max = max(self.spectrum[0])
+        # wavelength band
+        self.band = [self.min, self.max]
+
+        # default unit of the thickness
+        self.wavelength_unit = 'A'
+    
+    def set_full_band(self):
+        """
+        set band to default value
+        """
+        self.band = self.spectrum
+    def set_spectrum(self, spectrum):  
+        """
+        Set spectrum
+        
+        :param spectrum: numpy array
+        """
+        self.spectrum = spectrum 
+        self.setup_spectrum()
+         
+    def setup_spectrum(self):
+        """
+        To set the wavelength spectrum, and intensity, assumes 
+        wavelength is already within the spectrum
+        """
+        spectrum = self.spectrum
+        intensity = numpy.interp(self.wavelength, 
+                                      spectrum[0],
+                                      spectrum[1],
+                                      0.0,
+                                      0.0)
+        self.set_intensity(intensity)
+        # min max range of the spectrum
+        self.min = min(self.spectrum[0])
+        self.max = max(self.spectrum[0])
+        # set default band
+        self.set_band([self.min,self.max])
+        
+    def set_band(self, band=[]):
+        """
+        To set the wavelength band
+        
+        :param band: array of [min, max]
+        """
+        # check if the wavelength is in range
+        if min(band) < self.min or\
+                max(band) > self.max:
+            raise 
+        self.band = band
+
+         
+    def set_intensity(self, intensity = 368428):
+        """
+        Sets the intensity in counts/sec
+        """
+        self.intensity = intensity  
+        validate(intensity) 
+            
+    def set_wavelength(self, wavelength = _WAVE_LENGTH):
+        """
+        Sets the wavelength
+        """
+        # check if the wavelength is in range
+        if wavelength < min(self.band) or\
+                wavelength > max(self.band):
+            raise 
+        self.wavelength = wavelength
+        validate(wavelength)
+        self.intensity = numpy.interp(self.wavelength, 
+                                  self.spectrum[0],
+                                  self.spectrum[1],
+                                  0.0,
+                                  0.0)
+
+
+    def set_mass(self, mass = _MASS):
+        """
+        Sets the wavelength
+        """
+        self.mass = mass
+        validate(mass)
+        
+    def set_wavelength_spread(self, spread = _WAVE_SPREAD):
+        """
+        Sets the wavelength spread
+        """
+        self.wavelength_spread = spread
+        if spread != 0.0:
+            validate(spread)
+        
+    def get_intensity(self):
+        """
+        To get the value of intensity
+        """
+        return self.intensity
+        
+    def get_wavelength(self):
+        """
+        To get the value of wavelength
+        """
+        return self.wavelength
+
+    def get_mass(self):
+        """
+        To get the neutron mass
+        """
+        return self.mass
+    
+    def get_wavelength_spread(self):
+        """
+        To get the value of wavelength spread
+        """
+        return self.wavelength_spread
+    
+    def get_ramdom_value(self):
+        """
+        To get the value of wave length
+        """
+        return self.wavelength
+            
+    def get_spectrum(self):
+        """
+        To get the wavelength spectrum
+        """
+        return self.spectrum
+    def get_default_spectrum(self):
+        """
+        get default spectrum
+        """
+        return numpy.array(_LAMBDA_ARRAY)
+    def get_band(self):
+        """
+        To get the wavelength band
+        """
+        return self.band 
+    
+    def plot_spectrum(self):
+        """
+        To plot the wavelength spactrum
+        : requirment: matplotlib.pyplot
+        """
+        try:
+            import matplotlib.pyplot as plt
+            plt.plot(self.spectrum[0], self.spectrum[1], linewidth = 2, color = 'r')
+            plt.legend(['Spectrum'], loc = 'best')
+            plt.show()
+        except:
+            raise RuntimeError, "Can't import matplotlib required to plot..."
+        
+    
+class TOF(Neutron):
+    """
+    TOF: make list of wavelength and wave length spreads
+    """
+    def __init__(self):
+        """
+        Init
+        """
+        Neutron.__init__(self)
+        #self.switch = switch
+        self.wavelength_list = [self.wavelength]
+        self.wavelength_spread_list = [self.wavelength_spread]
+        self.intensity_list = self.get_intensity_list()
+    
+    def get_intensity_list(self):
+        """
+        get list of the intensity wrt wavelength_list
+        """
+        out = numpy.interp(self.wavelength_list, 
+                                      self.spectrum[0],
+                                      self.spectrum[1],
+                                      0.0,
+                                      0.0)
+        return out
+    
+    def get_wave_list(self):
+        """
+        Get wavelength and wavelength_spread list
+        """
+        return self.wavelength_list, self.wavelengthspread_list
+    
+    def set_wave_list(self, wavelength=[]):
+        """
+        Set wavelength list
+        
+        :param wavelength: list of wavelengths
+        """
+        self.wavelength_list = wavelength
+        
+    def set_wave_spread_list(self, wavelength_spread=[]):
+        """
+        Set wavelength_spread list
+        
+        :param wavelength_spread: list of wavelength spreads
+        """
+        self.wavelengthspread_list = wavelength_spread
+        
+        
+def validate(value = None):
+    """
+    Check if the value is folat > 0.0
+    
+    :return value: True / False
+    """
+    try:
+        val = float(value)
+        if val >= 0:
+            val = True
+        else:
+            val = False
+    except:
+        val = False
+    #if not val:
+    #    raise ValueError, "Got improper value..."
Index: sanscalculator/src/sans/calculator/kiessig_calculator.py
===================================================================
--- sanscalculator/src/sans/calculator/kiessig_calculator.py	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
+++ sanscalculator/src/sans/calculator/kiessig_calculator.py	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
@@ -0,0 +1,64 @@
+"""
+This module is a small tool to allow user to quickly
+determine the size value in real space  from the 
+fringe width in q space.
+"""
+from math import pi, fabs
+_DQ_DEFAULT = 0.05
+class KiessigThicknessCalculator(object):
+    """
+    compute thickness from the fringe width of data
+    """
+    def __init__(self):
+        
+        # dq value
+        self.deltaq = _DQ_DEFAULT 
+        # thickenss value
+        self.thickness = None
+        # unit of the thickness
+        self.thickness_unit = 'A'
+        
+    def set_deltaq(self, dq=None):
+        """
+        Receive deltaQ value
+        
+        :param dq: q fringe width in 1/A unit
+        """
+        # set dq
+        self.deltaq  = dq
+        
+    def get_deltaq(self):
+        """
+        return deltaQ value in 1/A unit
+        """
+        # return dq
+        return self.deltaq 
+
+    def compute_thickness(self):
+        """
+        Calculate thickness.
+        
+        :return: the thickness.
+        """
+        # check if it is float
+        try:
+            dq = float(self.deltaq)
+        except:
+            return None
+        # check if delta_q is zero
+        if dq == 0.0 or dq == None:
+            return None
+        else:
+            # calculate thickness
+            thickness = 2*pi/fabs(dq) 
+            # return thickness value      
+            return thickness
+  
+    def get_thickness_unit(self): 
+        """
+        :return: the thickness unit.
+        """
+        # unit of thickness
+        return self.thickness_unit
+
+
Index: sanscalculator/src/sans/calculator/resolution_calculator.py
===================================================================
--- sanscalculator/src/sans/calculator/resolution_calculator.py	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
+++ sanscalculator/src/sans/calculator/resolution_calculator.py	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
@@ -0,0 +1,1168 @@
+"""
+This object is a small tool to allow user to quickly
+determine the variance in q  from the 
+instrumental parameters.
+"""
+from instrument import Sample
+from instrument import Detector
+from instrument import TOF as Neutron
+from instrument import Aperture
+# import math stuffs
+from math import pi
+from math import sqrt
+import math 
+import scipy
+import numpy
+
+#Plank's constant in cgs unit
+_PLANK_H = 6.62606896E-27
+#Gravitational acc. in cgs unit
+_GRAVITY = 981.0
+
+class ResolutionCalculator(object):
+    """
+    compute resolution in 2D
+    """
+    def __init__(self):
+        
+        # wavelength
+        self.wave = Neutron()
+        # sample
+        self.sample = Sample()
+        # aperture
+        self.aperture = Aperture()
+        # detector
+        self.detector = Detector()
+        # 2d image of the resolution
+        self.image = []
+        self.image_lam = []
+        # resolutions
+        # lamda in r-direction
+        self.sigma_lamda = 0
+        # x-dir (no lamda)
+        self.sigma_1 = 0
+        #y-dir (no lamda)
+        self.sigma_2 = 0
+        # 1D total
+        self.sigma_1d = 0
+        # q min and max
+        self.qx_min = -0.3
+        self.qx_max = 0.3
+        self.qy_min = -0.3
+        self.qy_max = 0.3
+        # q min and max of the detector
+        self.detector_qx_min = -0.3
+        self.detector_qx_max = 0.3
+        self.detector_qy_min = -0.3
+        self.detector_qy_max = 0.3
+        # possible max qrange
+        self.qxmin_limit = 0
+        self.qxmax_limit = 0
+        self.qymin_limit = 0
+        self.qymax_limit = 0
+        # set sigmas
+        self.sigma_1 = 0
+        self.sigma_lamd = 0
+        self.sigma_2 = 0
+        self.sigma_1d = 0
+        # plots
+        self.plot = None
+        # instrumental params defaults
+        self.mass = 0
+        self.intensity = 0
+        self.wavelength = 0
+        self.wavelength_spread = 0
+        self.source_aperture_size = []
+        self.source2sample_distance = []
+        self.sample2sample_distance = []
+        self.sample_aperture_size = []
+        self.sample2detector_distance = []
+        self.detector_pix_size = []
+        self.detector_size = []
+        # get all the values of the instrumental parameters
+        #self.intensity = self.get_intensity()
+        #self.wavelength = self.get_wavelength()
+        #self.wavelength_spread = self.get_wavelength_spread()
+        self.get_all_instrument_params()
+        # max q range for all lambdas
+        self.qxrange = []
+        self.qyrange = []
+        
+    def compute_and_plot(self, qx_value, qy_value, qx_min, qx_max, 
+                          qy_min, qy_max, coord = 'cartesian'):
+        """
+        Compute the resolution
+        : qx_value: x component of q
+        : qy_value: y component of q
+        """
+        # make sure to update all the variables need.
+        # except lambda, dlambda, and intensity
+        self.get_all_instrument_params()
+        # wavelength etc.
+        lamda_list, dlamb_list = self.get_wave_list()
+        intens_list = []#self.get_intensity_list()
+
+        sig1_list = []
+        sig2_list = []
+        sigr_list = []
+        sigma1d_list = []
+        num_lamda = len(lamda_list)
+        for num in range(num_lamda):
+            lam = lamda_list[num]
+            # wavelength spread
+            dlam = dlamb_list[num]
+            intens = self.setup_tof(lam, dlam)
+            intens_list.append(intens)
+            # save q min max
+            #qx_min = 0
+            #qx_max = 0
+            #qy_min = 0
+            #qy_max = 0
+            # compute 2d resolution
+            _, _, sigma_1, sigma_2, sigma_r, sigma1d = \
+                            self.compute(lam, dlam, qx_value, qy_value, coord)
+            # make image
+            image = self.get_image(qx_value, qy_value, sigma_1, sigma_2, 
+                            sigma_r, qx_min, qx_max, qy_min, qy_max,
+                            coord, False)
+            
+            # Non tof mode to be speed up 
+            #if num_lamda < 2:
+            #    return self.plot_image(image)
+            
+            if qx_min > self.qx_min:
+                qx_min = self.qx_min
+            if qx_max < self.qx_max:
+                qx_max = self.qx_max
+            if qy_min > self.qy_min:
+                qy_min = self.qy_min
+            if qy_max < self.qy_max:
+                qy_max = self.qy_max
+                
+            # set max qranges
+            self.qxrange = [qx_min, qx_max]
+            self.qyrange = [qy_min, qy_max]
+            
+            sig1_list.append(sigma_1)
+            sig2_list.append(sigma_2)
+            sigr_list.append(sigma_r)
+            sigma1d_list.append(sigma1d)
+        # redraw image in global 2d q-space.   
+        self.image_lam = []
+        total_intensity = 0
+        sigma_1 = 0
+        sigma_r = 0
+        sigma_2 = 0
+        sigma1d = 0
+        for ind in range(num_lamda):
+            lam = lamda_list[ind]
+            dlam = dlamb_list[ind]
+            intens = self.setup_tof(lam, dlam)
+            out = self.get_image(qx_value, qy_value, sig1_list[ind], 
+                                   sig2_list[ind], sigr_list[ind], 
+                                   qx_min, qx_max, qy_min, qy_max, coord)
+            # this is the case of q being outside the detector
+            #if numpy.all(out==0.0):
+            #    continue
+            image = out
+            # set sigmas
+            sigma_1 += sig1_list[ind] * self.intensity
+            sigma_r += sigr_list[ind] * self.intensity
+            sigma_2 += sig2_list[ind] * self.intensity
+            sigma1d += sigma1d_list[ind] * self.intensity
+            total_intensity += self.intensity
+        if total_intensity != 0:
+            image_out = image / total_intensity
+            sigma_1 = sigma_1 / total_intensity
+            sigma_r = sigma_r / total_intensity
+            sigma_2 = sigma_2 / total_intensity
+            sigma1d = sigma1d / total_intensity
+            # set sigmas
+            self.sigma_1 = sigma_1
+            self.sigma_lamd = sigma_r
+            self.sigma_2 = sigma_2
+            self.sigma_1d = sigma1d
+            # rescale 
+            max_im_val = 1 #image_out.max()
+            if max_im_val > 0:
+                image_out /= max_im_val
+        else:
+            image_out = image * 0.0
+            # Don't calculate sigmas nor set self.sigmas!
+            sigma_1 = 0
+            sigma_r = 0
+            sigma_2 = 0
+            sigma1d = 0
+        if len(self.image) > 0:
+            self.image += image_out
+        else:
+            self.image = image_out
+        
+        # plot image
+        return self.plot_image(self.image) 
+    
+    def setup_tof(self, wavelength, wavelength_spread):
+        """
+        Setup all parameters in instrument
+        
+        : param ind: index of lambda, etc
+        """
+
+        # set wave.wavelength
+        self.set_wavelength(wavelength)
+        self.set_wavelength_spread(wavelength_spread)
+        self.intensity = self.wave.get_intensity()
+        
+        if wavelength == 0:
+            msg = "Can't compute the resolution: the wavelength is zero..." 
+            raise RuntimeError, msg
+        return self.intensity
+        
+    def compute(self, wavelength, wavelength_spread, qx_value, qy_value, 
+                coord = 'cartesian'):
+        """
+        Compute the Q resoltuion in || and + direction of 2D
+        : qx_value: x component of q
+        : qy_value: y component of q
+        """
+        coord = 'cartesian'
+        lamb = wavelength
+        lamb_spread = wavelength_spread
+        
+        # Find polar values
+        qr_value, phi = self._get_polar_value(qx_value, qy_value)
+        # vacuum wave transfer
+        knot = 2*pi/lamb
+        # scattering angle theta; always true for plane detector
+        # aligned vertically to the ko direction
+        if qr_value > knot:
+            theta = pi/2
+        else:
+            theta = math.asin(qr_value/knot)
+        # source aperture size
+        rone = self.source_aperture_size
+        # sample aperture size
+        rtwo = self.sample_aperture_size
+        # detector pixel size
+        rthree = self.detector_pix_size
+        # source to sample(aperture) distance
+        l_ssa = self.source2sample_distance[0]
+        # sample(aperture) to detector distance
+        l_sad = self.sample2detector_distance[0]
+        # sample (aperture) to sample distance
+        l_sas = self.sample2sample_distance[0]
+        # source to sample distance
+        l_one = l_ssa + l_sas
+        # sample to detector distance
+        l_two = l_sad - l_sas
+        
+        # Sample offset correction for l_one and Lp on variance calculation
+        l1_cor = (l_ssa * l_two) / (l_sas + l_two)
+        lp_cor = (l_ssa * l_two) / (l_one + l_two)
+        # the radial distance to the pixel from the center of the detector
+        radius = math.tan(theta) * l_two
+        #Lp = l_one*l_two/(l_one+l_two)
+        # default polar coordinate
+        comp1 = 'radial'
+        comp2 = 'phi'
+        # in the case of the cartesian coordinate
+        if coord == 'cartesian':
+            comp1 = 'x'
+            comp2 = 'y'
+
+        # sigma in the radial/x direction
+        # for source aperture
+        sigma_1  = self.get_variance(rone, l1_cor, phi, comp1)
+        # for sample apperture
+        sigma_1 += self.get_variance(rtwo, lp_cor, phi, comp1)
+        # for detector pix
+        sigma_1 += self.get_variance(rthree, l_two, phi, comp1)
+        # for gravity term
+        sigma_1 +=  self.get_variance_gravity(l_ssa, l_sad, lamb, lamb_spread, 
+                             phi, comp1, 'on')  
+        # for wavelength spread
+        # reserve for 1d calculation
+        sigma_wave_1 = self.get_variance_wave(radius, l_two, lamb_spread, 
+                                          phi, 'radial', 'on')
+        # for 1d
+        variance_1d_1 = sigma_1/2 + sigma_wave_1
+        # normalize
+        variance_1d_1 = knot * knot * variance_1d_1 / 12
+        
+        # for 2d
+        #sigma_1 += sigma_wave_1
+        # normalize
+        sigma_1 = knot*sqrt(sigma_1 / 12)
+        sigma_r = knot*sqrt(sigma_wave_1 / 12)
+        # sigma in the phi/y direction
+        # for source apperture
+        sigma_2  = self.get_variance(rone, l1_cor, phi, comp2)
+
+        # for sample apperture
+        sigma_2 += self.get_variance(rtwo, lp_cor, phi, comp2)
+
+        # for detector pix
+        sigma_2 += self.get_variance(rthree, l_two, phi, comp2)
+
+        # for gravity term
+        sigma_2 +=  self.get_variance_gravity(l_ssa, l_sad, lamb, lamb_spread, 
+                             phi, comp2, 'on')
+
+        
+        # for wavelength spread
+        # reserve for 1d calculation
+        sigma_wave_2 = self.get_variance_wave(radius, l_two, lamb_spread, 
+                                          phi, 'phi', 'on') 
+        # for 1d
+        variance_1d_2 = sigma_2/2 +sigma_wave_2
+        # normalize
+        variance_1d_2 = knot*knot*variance_1d_2 / 12
+        
+        # for 2d
+        #sigma_2 =  knot*sqrt(sigma_2/12)
+        #sigma_2 += sigma_wave_2
+        # normalize
+        sigma_2 =  knot * sqrt(sigma_2 / 12)
+        sigma1d = sqrt(variance_1d_1 + variance_1d_2)
+        # set sigmas
+        self.sigma_1 = sigma_1
+        self.sigma_lamd = sigma_r
+        self.sigma_2 = sigma_2
+        self.sigma_1d = sigma1d
+        return qr_value, phi, sigma_1, sigma_2, sigma_r, sigma1d
+    
+    def _within_detector_range(self,qx_value, qy_value):
+        """
+        check if qvalues are within detector range
+        """
+        # detector range
+        detector_qx_min = self.detector_qx_min
+        detector_qx_max = self.detector_qx_max
+        detector_qy_min = self.detector_qy_min
+        detector_qy_max = self.detector_qy_max
+        if self.qxmin_limit > detector_qx_min:
+            self.qxmin_limit = detector_qx_min
+        if self.qxmax_limit < detector_qx_max:
+            self.qxmax_limit = detector_qx_max
+        if self.qymin_limit > detector_qy_min:
+            self.qymin_limit = detector_qy_min
+        if self.qymax_limit < detector_qy_max:
+            self.qymax_limit = detector_qy_max
+        if qx_value < detector_qx_min or qx_value > detector_qx_max:
+            return False
+        if qy_value < detector_qy_min or qy_value > detector_qy_max:
+            return False
+        return True
+    
+    def get_image(self, qx_value, qy_value, sigma_1, sigma_2, sigma_r,
+                  qx_min, qx_max, qy_min, qy_max, 
+                  coord = 'cartesian', full_cal=True): 
+        """
+        Get the resolution in polar coordinate ready to plot
+        : qx_value: qx_value value
+        : qy_value: qy_value value
+        : sigma_1: variance in r direction
+        : sigma_2: variance in phi direction
+        : coord: coordinate system of image, 'polar' or 'cartesian'
+        """
+        # Get  qx_max and qy_max...
+        output = self._get_detector_qxqy_pixels()
+       
+        qr_value, phi = self._get_polar_value(qx_value, qy_value)
+
+        # Check whether the q value is within the detector range
+        msg = "Invalid input: Q value out of the detector range..."
+        if qx_min < self.qx_min:
+            self.qx_min = qx_min
+            #raise ValueError, msg
+        if qx_max > self.qx_max:
+            self.qx_max = qx_max
+            #raise ValueError, msg
+        if qy_min < self.qy_min:
+            self.qy_min = qy_min
+            #raise ValueError, msg
+        if qy_max > self.qy_max:
+            self.qy_max = qy_max
+            #raise ValueError, msg
+        if not full_cal:
+            return None
+ 
+        # Make an empty graph in the detector scale
+        dx_size = (self.qx_max - self.qx_min) / (1000 - 1)
+        dy_size = (self.qy_max - self.qy_min) / (1000 - 1)
+        x_val = numpy.arange(self.qx_min, self.qx_max, dx_size)
+        y_val = numpy.arange(self.qy_max, self.qy_min, -dy_size)
+        q_1, q_2 = numpy.meshgrid(x_val, y_val)
+        #q_phi = numpy.arctan(q_1,q_2)
+        # check whether polar or cartesian
+        if coord == 'polar':
+            # Find polar values
+            qr_value, phi = self._get_polar_value(qx_value, qy_value)
+            q_1, q_2 = self._rotate_z(q_1, q_2, phi)
+            qc_1 = qr_value
+            qc_2 = 0.0
+            # Calculate the 2D Gaussian distribution image
+            image = self._gaussian2d_polar(q_1, q_2, qc_1, qc_2, 
+                                 sigma_1, sigma_2, sigma_r)
+        else:
+            # catesian coordinate
+            # qx_center
+            qc_1 = qx_value
+            # qy_center
+            qc_2 = qy_value
+            
+            # Calculate the 2D Gaussian distribution image
+            image = self._gaussian2d(q_1, q_2, qc_1, qc_2, 
+                                     sigma_1, sigma_2, sigma_r)
+        # out side of detector
+        if not self._within_detector_range(qx_value, qy_value):
+            image *= 0.0
+            self.intensity = 0.0
+            #return self.image
+
+        # Add it if there are more than one inputs.
+        if len(self.image_lam) > 0:
+            self.image_lam += image * self.intensity
+        else:
+            self.image_lam = image * self.intensity
+        
+        return self.image_lam
+    
+    def plot_image(self, image):
+        """
+        Plot image using pyplot
+        : image: 2d resolution image 
+        
+        : return plt: pylab object
+        """
+        import matplotlib.pyplot as plt
+
+        self.plot = plt
+        plt.xlabel('$\\rm{Q}_{x} [A^{-1}]$')
+        plt.ylabel('$\\rm{Q}_{y} [A^{-1}]$')
+        # Max value of the image
+        max = numpy.max(image)
+        qx_min, qx_max, qy_min, qy_max = self.get_detector_qrange()
+
+        # Image
+        im = plt.imshow(image, 
+                extent = [qx_min, qx_max, qy_min, qy_max])
+
+        # bilinear interpolation to make it smoother
+        im.set_interpolation('bilinear')
+
+        return plt
+    
+    def reset_image(self):
+        """
+        Reset image to default (=[])
+        """
+        self.image = []
+        
+    def get_variance(self, size = [], distance = 0, phi = 0, comp = 'radial'):
+        """
+        Get the variance when the slit/pinhole size is given
+        : size: list that can be one(diameter for circular) 
+                or two components(lengths for rectangular)
+        : distance: [z, x] where z along the incident beam, x // qx_value
+        : comp: direction of the sigma; can be 'phi', 'y', 'x', and 'radial'
+        
+        : return variance: sigma^2
+        """   
+        # check the length of size (list)
+        len_size = len(size)
+        
+        # define sigma component direction
+        if comp == 'radial':
+            phi_x = math.cos(phi)
+            phi_y = math.sin(phi)
+        elif comp == 'phi':
+            phi_x = math.sin(phi)
+            phi_y = math.cos(phi)
+        elif comp == 'x':
+            phi_x = 1
+            phi_y = 0
+        elif comp == 'y':
+            phi_x = 0
+            phi_y = 1
+        else:
+            phi_x = 0
+            phi_y = 0
+        # calculate each component
+        # for pinhole w/ radius = size[0]/2
+        if len_size == 1:
+            x_comp = (0.5 * size[0]) * sqrt(3)
+            y_comp = 0
+        # for rectangular slit
+        elif len_size == 2:
+            x_comp = size[0] * phi_x 
+            y_comp = size[1] * phi_y
+        # otherwise
+        else:
+            raise ValueError, " Improper input..."
+        # get them squared  
+        sigma  = x_comp * x_comp 
+        sigma += y_comp * y_comp
+        # normalize by distance
+        sigma /= (distance * distance)
+
+        return sigma
+
+    def get_variance_wave(self, radius, distance, spread, phi, 
+                          comp = 'radial', switch = 'on'):
+        """
+        Get the variance when the wavelength spread is given
+        
+        : radius: the radial distance from the beam center to the pix of q
+        : distance: sample to detector distance
+        : spread: wavelength spread (ratio)
+        : comp: direction of the sigma; can be 'phi', 'y', 'x', and 'radial'
+        
+        : return variance: sigma^2
+        """
+        if switch.lower() == 'off':
+            return 0
+        # check the singular point
+        if distance == 0 or comp == 'phi':
+            return 0
+        else:
+            # calculate sigma^2
+            sigma = 2 * math.pow(radius/distance*spread, 2)
+            if comp == 'x':
+                sigma *= (math.cos(phi)*math.cos(phi))
+            elif comp == 'y':
+                sigma *= (math.sin(phi)*math.sin(phi))
+            else:
+                sigma *= 1          
+                
+            return sigma
+
+    def get_variance_gravity(self, s_distance, d_distance, wavelength, spread, 
+                             phi, comp = 'radial', switch = 'on'):
+        """
+        Get the variance from gravity when the wavelength spread is given
+        
+        : s_distance: source to sample distance
+        : d_distance: sample to detector distance
+        : wavelength: wavelength
+        : spread: wavelength spread (ratio)
+        : comp: direction of the sigma; can be 'phi', 'y', 'x', and 'radial'
+        
+        : return variance: sigma^2
+        """
+        if switch.lower() == 'off':
+            return 0
+        if self.mass == 0.0:
+            return 0
+        # check the singular point
+        if d_distance == 0 or comp == 'x':
+            return 0
+        else:
+            # neutron mass in cgs unit
+            self.mass = self.get_neutron_mass()
+            # plank constant in cgs unit
+            h_constant = _PLANK_H
+            # gravity in cgs unit
+            gravy = _GRAVITY
+            # m/h
+            m_over_h = self.mass /h_constant
+            # A value
+            a_value = d_distance * (s_distance + d_distance)
+            a_value *= math.pow(m_over_h / 2, 2)
+            a_value *= gravy
+            # unit correction (1/cm to 1/A) for A and d_distance below
+            a_value *= 1.0E-16
+            
+            # calculate sigma^2
+            sigma = math.pow(a_value / d_distance, 2)
+            sigma *= math.pow(wavelength, 4)
+            sigma *= math.pow(spread, 2)
+            sigma *= 8
+            
+            # only for the polar coordinate
+            #if comp == 'radial':
+            #    sigma *= (math.sin(phi) * math.sin(phi))
+            #elif comp == 'phi':
+            #    sigma *= (math.cos(phi) * math.cos(phi))
+            
+            return sigma
+        
+    def get_intensity(self):
+        """
+        Get intensity
+        """
+        return self.wave.intensity
+
+    def get_wavelength(self):
+        """
+        Get wavelength
+        """
+        return self.wave.wavelength
+    
+    def get_spectrum(self):
+        """
+        Get spectrum
+        """
+        return self.wave.spectrum   
+    
+    def get_default_spectrum(self):
+        """
+        Get default_spectrum
+        """
+        return self.wave.get_default_spectrum()    
+    
+    def get_spectrum(self):
+        """
+        Get _spectrum
+        """
+        return self.wave.get_spectrum() 
+         
+    def get_wavelength_spread(self):
+        """
+        Get wavelength spread
+        """
+        return self.wave.wavelength_spread
+    
+    def get_neutron_mass(self):
+        """
+        Get Neutron mass
+        """
+        return self.wave.mass
+    
+    def get_source_aperture_size(self):
+        """
+        Get source aperture size
+        """
+        return self.aperture.source_size
+    
+    def get_sample_aperture_size(self):
+        """
+        Get sample aperture size
+        """
+        return self.aperture.sample_size
+    
+    def get_detector_pix_size(self):
+        """
+        Get detector pixel size
+        """
+        return self.detector.pix_size
+       
+    def get_detector_size(self):
+        """
+        Get detector size
+        """
+        return self.detector.size   
+     
+    def get_source2sample_distance(self):
+        """
+        Get detector source2sample_distance
+        """
+        return self.aperture.sample_distance
+    
+    def get_sample2sample_distance(self):
+        """
+        Get detector sampleslitsample_distance
+        """
+        return self.sample.distance
+    
+    def get_sample2detector_distance(self):
+        """
+        Get detector sample2detector_distance
+        """
+        return self.detector.distance
+    
+    def set_intensity(self, intensity):
+        """
+        Set intensity
+        """
+        self.wave.set_intensity(intensity)
+        
+    def set_wave(self, wavelength):
+        """
+        Set wavelength list or wavelength
+        """
+        if wavelength.__class__.__name__ == 'list':
+            self.wave.set_wave_list(wavelength)
+        elif wavelength.__class__.__name__ == 'float':
+            self.wave.set_wave_list([wavelength])
+            #self.set_wavelength(wavelength)
+        else:
+            raise
+    
+    def set_wave_spread(self, wavelength_spread):
+        """
+        Set wavelength spread  or wavelength spread
+        """
+        if wavelength_spread.__class__.__name__ == 'list':
+            self.wave.set_wave_spread_list(wavelength_spread)
+        elif wavelength_spread.__class__.__name__ == 'float':
+            self.wave.set_wave_spread_list([wavelength_spread])
+            #self.set_wavelength_spread(wavelength_spread)
+        else:
+            raise
+        
+    def set_wavelength(self, wavelength):
+        """
+        Set wavelength
+        """
+        self.wavelength = wavelength
+        self.wave.set_wavelength(wavelength)
+        
+    def set_spectrum(self, spectrum):
+        """
+        Set spectrum
+        """
+        self.spectrum = spectrum
+        self.wave.set_spectrum(spectrum)  
+          
+    def set_wavelength_spread(self, wavelength_spread):
+        """
+        Set wavelength spread
+        """
+        self.wavelength_spread = wavelength_spread
+        self.wave.set_wavelength_spread(wavelength_spread)
+        
+    def set_wave_list(self, wavelength_list, wavelengthspread_list):
+        """
+        Set wavelength and its spread list
+        """
+        self.wave.set_wave_list(wavelength_list, wavelengthspread_list)
+    
+    def get_wave_list(self):
+        """
+        Set wavelength spread
+        """
+        return self.wave.get_wave_list()
+    
+    def get_intensity_list(self):
+        """
+        Set wavelength spread
+        """
+        return self.wave.get_intensity_list()
+           
+    def set_source_aperture_size(self, size):
+        """
+        Set source aperture size
+        
+        : param size: [dia_value] or [x_value, y_value]
+        """        
+        if len(size) < 1 or len(size) > 2:
+            raise RuntimeError, "The length of the size must be one or two."
+        self.aperture.set_source_size(size)
+        
+    def set_neutron_mass(self, mass):
+        """
+        Set Neutron mass
+        """
+        self.wave.set_mass(mass)
+        self.mass = mass
+        
+    def set_sample_aperture_size(self, size):
+        """
+        Set sample aperture size
+        
+        : param size: [dia_value] or [xheight_value, yheight_value]
+        """
+        if len(size) < 1 or len(size) > 2:
+            raise RuntimeError, "The length of the size must be one or two."
+        self.aperture.set_sample_size(size)
+    
+    def set_detector_pix_size(self, size):
+        """
+        Set detector pixel size
+        """
+        self.detector.set_pix_size(size)
+        
+    def set_detector_size(self, size):
+        """
+        Set detector size in number of pixels
+        : param size: [pixel_nums] or [x_pix_num, yx_pix_num]
+        """
+        self.detector.set_size(size)
+        
+    def set_source2sample_distance(self, distance):
+        """
+        Set detector source2sample_distance
+        
+        : param distance: [distance, x_offset]
+        """
+        if len(distance) < 1 or len(distance) > 2:
+            raise RuntimeError, "The length of the size must be one or two."
+        self.aperture.set_sample_distance(distance)
+
+    def set_sample2sample_distance(self, distance):
+        """
+        Set detector sample_slit2sample_distance
+        
+        : param distance: [distance, x_offset]
+        """
+        if len(distance) < 1 or len(distance) > 2:
+            raise RuntimeError, "The length of the size must be one or two."
+        self.sample.set_distance(distance)
+   
+    def set_sample2detector_distance(self, distance):
+        """
+        Set detector sample2detector_distance
+        
+        : param distance: [distance, x_offset]
+        """
+        if len(distance) < 1 or len(distance) > 2:
+            raise RuntimeError, "The length of the size must be one or two."
+        self.detector.set_distance(distance)
+        
+    def get_all_instrument_params(self):
+        """
+        Get all instrumental parameters
+        """
+        #self.intensity = self.get_intensity()
+        #self.wavelength = self.get_wavelength()
+        #self.wavelength_spread = self.get_wavelength_spread()
+        self.mass = self.get_neutron_mass()
+        self.spectrum = self.get_spectrum()
+        self.source_aperture_size = self.get_source_aperture_size()
+        self.sample_aperture_size = self.get_sample_aperture_size()
+        self.detector_pix_size = self.get_detector_pix_size()
+        self.detector_size = self.get_detector_size()
+        self.source2sample_distance = self.get_source2sample_distance()
+        self.sample2sample_distance = self.get_sample2sample_distance()
+        self.sample2detector_distance = self.get_sample2detector_distance()
+    
+    def get_detector_qrange(self):
+        """
+        get max detector q ranges
+        
+        : return: qx_min, qx_max, qy_min, qy_max tuple
+        """
+        if len(self.qxrange) != 2 or len(self.qyrange) != 2:
+            return None
+        qx_min = self.qxrange[0]
+        qx_max = self.qxrange[1]
+        qy_min = self.qyrange[0]
+        qy_max = self.qyrange[1]
+        
+        return qx_min, qx_max, qy_min, qy_max
+    
+    def _rotate_z(self, x_value, y_value, theta= 0.0):
+        """
+        Rotate x-y cordinate around z-axis by theta
+        : x_value: numpy array of x values
+        : y_value: numpy array of y values
+        : theta: angle to rotate by in rad
+        
+        :return: x_prime, y-prime
+        """        
+        # rotate by theta
+        x_prime = x_value * math.cos(theta) + y_value * math.sin(theta)
+        y_prime =  -x_value * math.sin(theta) + y_value * math.cos(theta)
+    
+        return x_prime, y_prime
+    
+    def _gaussian2d(self, x_val, y_val, x0_val, y0_val, 
+                    sigma_x, sigma_y, sigma_r):
+        """
+        Calculate 2D Gaussian distribution
+        : x_val: x value
+        : y_val: y value
+        : x0_val: mean value in x-axis
+        : y0_val: mean value in y-axis
+        : sigma_x: variance in x-direction
+        : sigma_y: variance in y-direction
+        
+        : return: gaussian (value)
+        """
+        # phi values at each points (not at the center)
+        x_value = x_val - x0_val
+        y_value = y_val - y0_val
+        phi_i = numpy.arctan2(y_val, x_val)
+
+        sin_phi = numpy.sin(phi_i)
+        cos_phi = numpy.cos(phi_i)
+        
+        x_p = x_value * cos_phi + y_value * sin_phi
+        y_p = -x_value * sin_phi + y_value * cos_phi
+        
+        new_sig_x = sqrt(sigma_r * sigma_r / (sigma_x * sigma_x ) + 1)
+        new_sig_y = sqrt(sigma_r * sigma_r / (sigma_y * sigma_y ) + 1)
+        new_x = x_p * cos_phi / new_sig_x - y_p * sin_phi
+        new_x /= sigma_x
+        new_y = x_p * sin_phi / new_sig_y + y_p * cos_phi
+        new_y /= sigma_y
+
+        nu_value = -0.5 *(new_x * new_x + new_y * new_y)
+
+        gaussian = numpy.exp(nu_value)
+        # normalizing factor correction
+        gaussian /= gaussian.sum()
+
+        return gaussian
+
+    def _gaussian2d_polar(self, x_val, y_val, x0_val, y0_val, 
+                        sigma_x, sigma_y, sigma_r):
+        """
+        Calculate 2D Gaussian distribution for polar coodinate 
+        : x_val: x value
+        : y_val: y value
+        : x0_val: mean value in x-axis
+        : y0_val: mean value in y-axis
+        : sigma_x: variance in r-direction
+        : sigma_y: variance in phi-direction
+        : sigma_r: wavelength variance in r-direction
+        
+        : return: gaussian (value)
+        """
+        sigma_x = sqrt(sigma_x * sigma_x + sigma_r * sigma_r)
+        # call gaussian1d 
+        gaussian  = self._gaussian1d(x_val, x0_val, sigma_x)
+        gaussian *= self._gaussian1d(y_val, y0_val, sigma_y)
+ 
+        # normalizing factor correction
+        if sigma_x != 0 and sigma_y != 0:
+            gaussian *= sqrt(2 * pi)
+        return gaussian
+    
+    def _gaussian1d(self, value, mean, sigma):
+        """
+        Calculate 1D Gaussian distribution
+        : value: value
+        : mean: mean value
+        : sigma: variance 
+        
+        : return: gaussian (value)
+        """
+        # default
+        gaussian = 1.0
+        if sigma != 0:
+            # get exponent
+            nu_value = (value - mean) / sigma
+            nu_value *= nu_value
+            nu_value *= -0.5
+            gaussian *= numpy.exp(nu_value)
+            gaussian /= sigma
+            # normalize
+            gaussian /= sqrt(2 * pi)
+            
+        return gaussian
+    
+    def _atan_phi(self, qy_value, qx_value):
+        """
+        Find the angle phi of q on the detector plane for qx_value, qy_value given
+        : qx_value: x component of q
+        : qy_value: y component of q
+        
+        : return phi: the azimuthal angle of q on x-y plane
+        """
+        phi = math.atan2(qy_value, qx_value)
+        return phi
+        # default
+        phi = 0
+        # ToDo: This is misterious - sign???
+        #qy_value = -qy_value
+        # Take care of the singular point
+        if qx_value == 0:
+            if qy_value > 0:
+                phi = pi / 2
+            elif qy_value < 0:
+                phi = -pi / 2
+            else:
+                phi = 0
+        else:
+            # the angle
+            phi = math.atan2(qy_value, qx_value)
+
+        return phi
+
+    def _get_detector_qxqy_pixels(self):
+        """
+        Get the pixel positions of the detector in the qx_value-qy_value space
+        """
+        
+        # update all param values
+        self.get_all_instrument_params()
+        
+        # wavelength
+        wavelength = self.wave.wavelength
+        # Gavity correction
+        delta_y = self._get_beamcenter_drop() # in cm
+        
+        # detector_pix size
+        detector_pix_size = self.detector_pix_size
+        # Square or circular pixel
+        if len(detector_pix_size) == 1:
+            pix_x_size = detector_pix_size[0]
+            pix_y_size = detector_pix_size[0]
+        # rectangular pixel pixel
+        elif len(detector_pix_size) == 2:
+            pix_x_size = detector_pix_size[0]
+            pix_y_size = detector_pix_size[1]
+        else:
+            raise ValueError, " Input value format error..."
+        # Sample to detector distance = sample slit to detector 
+        # minus sample offset
+        sample2detector_distance = self.sample2detector_distance[0] - \
+                                    self.sample2sample_distance[0]
+        # detector offset in x-direction
+        detector_offset = 0
+        try:
+            detector_offset = self.sample2detector_distance[1]
+        except:
+            pass
+        
+        # detector size in [no of pix_x,no of pix_y]
+        detector_pix_nums_x = self.detector_size[0]
+        
+        # get pix_y if it exists, otherwse take it from [0]
+        try:
+            detector_pix_nums_y = self.detector_size[1]
+        except:
+            detector_pix_nums_y = self.detector_size[0]
+        
+        # detector offset in pix number
+        offset_x = detector_offset / pix_x_size
+        offset_y = delta_y / pix_y_size
+        
+        # beam center position in pix number (start from 0)
+        center_x, center_y = self._get_beamcenter_position(detector_pix_nums_x,
+                                    detector_pix_nums_y, offset_x, offset_y)
+        # distance [cm] from the beam center on detector plane
+        detector_ind_x = numpy.arange(detector_pix_nums_x)
+        detector_ind_y = numpy.arange(detector_pix_nums_y)
+
+        # shif 0.5 pixel so that pix position is at the center of the pixel
+        detector_ind_x = detector_ind_x + 0.5
+        detector_ind_y = detector_ind_y + 0.5
+
+        # the relative postion from the beam center
+        detector_ind_x = detector_ind_x - center_x
+        detector_ind_y = detector_ind_y - center_y
+        
+        # unit correction in cm
+        detector_ind_x = detector_ind_x * pix_x_size
+        detector_ind_y = detector_ind_y * pix_y_size
+        
+        qx_value = numpy.zeros(len(detector_ind_x))
+        qy_value = numpy.zeros(len(detector_ind_y))
+        i = 0
+
+        for indx in detector_ind_x:
+            qx_value[i] = self._get_qx(indx, sample2detector_distance, wavelength)
+            i += 1
+        i = 0
+        for indy in detector_ind_y:
+            qy_value[i] = self._get_qx(indy, sample2detector_distance, wavelength)
+            i += 1
+            
+        # qx_value and qy_value values in array
+        qx_value = qx_value.repeat(detector_pix_nums_y) 
+        qx_value = qx_value.reshape(detector_pix_nums_x, detector_pix_nums_y)
+        qy_value = qy_value.repeat(detector_pix_nums_x)  
+        qy_value = qy_value.reshape(detector_pix_nums_y, detector_pix_nums_x)
+        qy_value = qy_value.transpose()
+
+        # p min and max values among the center of pixels
+        self.qx_min = numpy.min(qx_value)
+        self.qx_max = numpy.max(qx_value)
+        self.qy_min = numpy.min(qy_value)
+        self.qy_max = numpy.max(qy_value)
+                
+        # Appr. min and max values of the detector display limits 
+        # i.e., edges of the last pixels.
+        self.qy_min += self._get_qx(-0.5 * pix_y_size, 
+                                sample2detector_distance, wavelength)
+        self.qy_max += self._get_qx(0.5 * pix_y_size, 
+                                sample2detector_distance, wavelength)
+        #if self.qx_min == self.qx_max:
+        self.qx_min += self._get_qx(-0.5 * pix_x_size, 
+                                sample2detector_distance, wavelength)
+        self.qx_max += self._get_qx(0.5 * pix_x_size, 
+                                    sample2detector_distance, wavelength)
+        
+        # min and max values of detecter
+        self.detector_qx_min = self.qx_min
+        self.detector_qx_max = self.qx_max
+        self.detector_qy_min = self.qy_min
+        self.detector_qy_max = self.qy_max
+        
+        
+
+        # try to set it as a Data2D otherwise pass (not required for now)
+        try:
+            from DataLoader.data_info import Data2D
+            output = Data2D()
+            inten = numpy.zeros_like(qx_value)
+            output.data     = inten
+            output.qx_data  = qx_value
+            output.qy_data  = qy_value            
+        except:
+            pass
+        
+        return output#qx_value,qy_value
+        
+    def _get_qx(self, dx_size, det_dist, wavelength):
+        """
+        :param dx_size: x-distance from beam center [cm]
+        :param det_dist: sample to detector distance [cm]
+        
+        :return: q-value at the given position
+        """
+        # Distance from beam center in the plane of detector
+        plane_dist = dx_size
+        # full scattering angle on the x-axis
+        theta  = math.atan(plane_dist / det_dist)
+        qx_value     = (2.0 * pi / wavelength) * math.sin(theta)
+        return qx_value  
+    
+    def _get_polar_value(self, qx_value, qy_value):
+        """
+        Find qr_value and phi from qx_value and qy_value values
+        
+        : return qr_value, phi
+        """
+        # find |q| on detector plane
+        qr_value = sqrt(qx_value*qx_value + qy_value*qy_value)
+        # find angle phi
+        phi = self._atan_phi(qy_value, qx_value)
+        
+        return qr_value, phi
+    
+    def _get_beamcenter_position(self, num_x, num_y, offset_x, offset_y):
+        """
+        :param num_x: number of pixel in x-direction
+        :param num_y: number of pixel in y-direction
+        :param offset: detector offset in x-direction in pix number
+        
+        :return: pix number; pos_x, pos_y in pix index
+        """
+        # beam center position
+        pos_x = num_x / 2
+        pos_y = num_y / 2
+
+        # correction for offset
+        pos_x += offset_x
+        # correction for gravity that is always negative
+        pos_y -= offset_y
+
+        return pos_x, pos_y     
+
+    def _get_beamcenter_drop(self):
+        """
+        Get the beam center drop (delta y) in y diection due to gravity
+        
+        :return delta y: the beam center drop in cm
+        """
+        # Check if mass == 0 (X-ray). 
+        if self.mass == 0:
+            return 0
+        # Covert unit from A to cm
+        unit_cm = 1e-08
+        # Velocity of neutron in horizontal direction (~ actual velocity)
+        velocity = _PLANK_H / (self.mass * self.wave.wavelength * unit_cm)
+        # Compute delta y
+        delta_y = 0.5
+        delta_y *= _GRAVITY
+        delta_y *= self.sample2detector_distance[0] 
+        delta_y *= (self.source2sample_distance[0] + self.sample2detector_distance[0])
+        delta_y /= (velocity * velocity)
+
+        return delta_y     
+
+    
Index: sanscalculator/src/sans/calculator/setup.py
===================================================================
--- sanscalculator/src/sans/calculator/setup.py	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
+++ sanscalculator/src/sans/calculator/setup.py	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
@@ -0,0 +1,17 @@
+"""
+    Setup for Calculator plug-in
+"""
+
+from distutils.core import setup
+
+setup(
+    name="sans.calculator",
+    version = "0.9.1",
+    description = "Python module for sld  calculation",
+    author = "University of Tennessee",
+    url = "http://danse.chem.utk.edu",
+
+    # Use the pure python modules
+    package_dir = {"sans.calculator":"."},
+    packages = ["sans","sans.calculator"],
+    )
Index: sanscalculator/src/sans/calculator/slit_length_calculator.py
===================================================================
--- sanscalculator/src/sans/calculator/slit_length_calculator.py	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
+++ sanscalculator/src/sans/calculator/slit_length_calculator.py	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
@@ -0,0 +1,107 @@
+"""
+This module is a small tool to allow user to quickly
+determine the slit length value of data.
+"""
+
+class SlitlengthCalculator(object):
+    """
+    compute slit length from SAXSess beam profile (1st col. Q , 2nd col. I ,
+    and 3rd col. dI.: don't need the 3rd)
+    """
+    def __init__(self):
+        
+        # x data
+        self.x = None
+        # y data
+        self.y = None
+        #default slit length
+        self.slit_length = 0.0
+        
+        # The unit is unknown from SAXSess profile: 
+        # It seems 1/nm but it could be not fixed, 
+        # so users should be notified to determine the unit by themselves.
+        self.slit_length_unit = "unknown"
+    
+    def set_data(self, x=None, y=None):
+        """
+         Receive two vector x, y and prepare the slit calculator for 
+         computation.
+        
+        :param x: array
+        :param y: array
+        """
+        self.x = x
+        self.y = y
+        
+    def calculate_slit_length(self):
+        """
+        Calculate slit length.
+        
+        :return: the slit length calculated value.
+        """
+        # None data do nothing
+        if self.y == None or self.x == None:
+            return
+        # set local variable
+        y = self.y
+        x = self.x
+
+        # find max y
+        max_y = y.max()
+        
+        # initial values 
+        y_sum = 0.0
+        y_max = 0.0
+        ind = 0.0
+        
+        # sum 10 or more y values until getting max_y, 
+        while (True):
+            if ind >= 10 and y_max == max_y:
+                break
+            y_sum = y_sum + y[ind]
+            if y[ind] > y_max: 
+                y_max = y[ind]
+            ind += 1
+     
+        # find the average value/2 of the top values  
+        y_half = y_sum/(2.0*ind)
+        
+        # defaults
+        y_half_d = 0.0
+        ind = 0.0
+        # find indices where it crosses y = y_half.
+        while (True):
+            # no need to check when ind == 0
+            ind += 1     
+            # y value and ind just after passed the spot of the half height            
+            y_half_d = y[ind]       
+            if y[ind] < y_half: 
+                break
+        
+        # y value and ind just before passed the spot of the half height
+        y_half_u = y[ind-1]        
+        
+        # get corresponding x values
+        x_half_d = x[ind]
+        x_half_u = x[ind-1] 
+        
+        # calculate x at y = y_half using linear interpolation
+        if y_half_u == y_half_d:
+            x_half = (x_half_d + x_half_u)/2.0
+        else:
+            x_half = (x_half_u * (y_half - y_half_d)  \
+                       + x_half_d*(y_half_u-y_half)) \
+                        /(y_half_u - y_half_d)
+        
+        # Our slit length is half width, so just give half beam value
+        slit_length = x_half
+        
+        # set slit_length
+        self.slit_length = slit_length
+        return self.slit_length
+  
+    def get_slit_length_unit(self): 
+        """
+        :return: the slit length unit.
+        """
+        return self.slit_length_unit
Index: sanscalculator/src/sans/calculator/src/sans/__init__.py
===================================================================
--- sanscalculator/src/sans/calculator/src/sans/__init__.py	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
+++ sanscalculator/src/sans/calculator/src/sans/__init__.py	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
@@ -0,0 +1,2 @@
+from pkgutil import extend_path
+__path__ = extend_path(__path__, __name__)
Index: sanscalculator/src/sans/calculator/test/beam profile.DAT
===================================================================
--- sanscalculator/src/sans/calculator/test/beam profile.DAT	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
+++ sanscalculator/src/sans/calculator/test/beam profile.DAT	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
@@ -0,0 +1,54 @@
+                                                                                
+SAXS BOX                                                                       
+       49        30         0         0         0         0         0         0
+  0.000000E+00   0.261200E+03   0.000000E+00   0.100000E+01   0.154200E+00
+  0.100000E+01   0.155999E+01   0.000000E+00   0.000000E+00   0.000000E+00
+  0.000000E+00   0.100000E+01   0.836825E+02
+  0.754396E-01   0.975440E+00   0.938981E+02
+  0.150879E+00   0.975745E+00   0.991879E+02
+  0.226319E+00   0.975473E+00   0.767819E+02
+  0.301758E+00   0.974517E+00   0.131319E+03
+  0.377198E+00   0.973001E+00   0.817830E+02
+  0.452637E+00   0.969088E+00   0.668273E+02
+  0.528077E+00   0.967890E+00   0.934950E+02
+  0.603517E+00   0.975536E+00   0.116805E+03
+  0.678956E+00   0.982809E+00   0.966191E+02
+  0.754396E+00   0.982538E+00   0.138675E+03
+  0.829835E+00   0.985082E+00  -0.100000E+01
+  0.905275E+00   0.991786E+00  -0.100000E+01
+  0.980715E+00   0.988353E+00  -0.100000E+01
+  0.105615E+01   0.977319E+00  -0.100000E+01
+  0.113159E+01   0.973398E+00  -0.100000E+01
+  0.120703E+01   0.975829E+00  -0.100000E+01
+  0.128247E+01   0.978032E+00  -0.100000E+01
+  0.135791E+01   0.977557E+00  -0.100000E+01
+  0.143335E+01   0.976422E+00  -0.100000E+01
+  0.150879E+01   0.982926E+00  -0.100000E+01
+  0.158423E+01   0.991207E+00  -0.100000E+01
+  0.165967E+01   0.982255E+00  -0.100000E+01
+  0.173511E+01   0.968295E+00  -0.100000E+01
+  0.181055E+01   0.973161E+00  -0.100000E+01
+  0.188599E+01   0.980441E+00  -0.100000E+01
+  0.196143E+01   0.973060E+00  -0.100000E+01
+  0.203687E+01   0.967479E+00  -0.100000E+01
+  0.211231E+01   0.968228E+00  -0.100000E+01
+  0.218775E+01   0.954858E+00  -0.100000E+01
+  0.226319E+01   0.920322E+00  -0.100000E+01
+  0.233863E+01   0.870665E+00  -0.100000E+01
+  0.241407E+01   0.814629E+00  -0.100000E+01
+  0.248951E+01   0.758434E+00  -0.100000E+01
+  0.256495E+01   0.694671E+00  -0.100000E+01
+  0.264039E+01   0.621470E+00  -0.100000E+01
+  0.271583E+01   0.554105E+00  -0.100000E+01
+  0.279126E+01   0.490278E+00  -0.100000E+01
+  0.286670E+01   0.408652E+00  -0.100000E+01
+  0.294214E+01   0.321530E+00  -0.100000E+01
+  0.301758E+01   0.255968E+00  -0.100000E+01
+  0.309302E+01   0.200420E+00  -0.100000E+01
+  0.316846E+01   0.140477E+00  -0.100000E+01
+  0.324390E+01   0.907699E-01  -0.100000E+01
+  0.331934E+01   0.593287E-01  -0.100000E+01
+  0.339478E+01   0.366914E-01  -0.100000E+01
+  0.347022E+01   0.198629E-01  -0.100000E+01
+  0.354566E+01   0.120037E-01  -0.100000E+01
+  0.362110E+01   0.110363E-01  -0.100000E+01
Index: sanscalculator/src/sans/calculator/test/utest_resolution_calculator.py
===================================================================
--- sanscalculator/src/sans/calculator/test/utest_resolution_calculator.py	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
+++ sanscalculator/src/sans/calculator/test/utest_resolution_calculator.py	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
@@ -0,0 +1,38 @@
+"""
+    Unit test for resolution_calculator
+"""
+
+import unittest
+from  sans.calculator.resolution_calculator import ResolutionCalculator \
+                                            as calculator
+
+class resolution_calculator(unittest.TestCase):
+    
+    def setUp(self):
+        
+        self.cal = calculator()
+        
+    def test_resolution_calculation(self):
+        """
+            Test resolution_calculator"
+        """
+        self.cal.set_wavelength(15)
+        self.cal.set_source_aperture_size([2])
+        self.cal.set_sample_aperture_size([1])
+        self.cal.set_detector_pix_size([1])
+        self.cal.set_source2sample_distance([1500])
+        self.cal.set_sample2detector_distance([1500])
+        self.cal.set_wavelength_spread(0.1)
+        # all instr. params for cal
+        self.cal.get_all_instrument_params()
+        qr, phi, sigma_1, sigma_2, _, sigma_1d = self.cal.compute(15, 0.1, 
+                                                        0, 0, coord = 'polar')
+        sigma_1d = self.cal.sigma_1d
+        
+        # The value "0.000213283" was obtained by manual calculation.
+        self.assertAlmostEqual(sigma_1d,   0.000213283, 5)
+        
+        
+if __name__ == '__main__':
+    unittest.main()
+   
Index: sanscalculator/src/sans/calculator/test/utest_slit_length_calculator.py
===================================================================
--- sanscalculator/src/sans/calculator/test/utest_slit_length_calculator.py	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
+++ sanscalculator/src/sans/calculator/test/utest_slit_length_calculator.py	(revision f93b6a1e44942756bff7125ae743ac0c6f5988e6)
@@ -0,0 +1,33 @@
+"""
+    Unit tests for slit_length_calculator
+"""
+
+import unittest
+from DataLoader.readers.ascii_reader import Reader
+from  sans.calculator.slit_length_calculator import SlitlengthCalculator as calculator
+
+import os.path
+
+class slit_calculator(unittest.TestCase):
+    
+    def setUp(self):
+        
+        self.reader = Reader()
+        
+    def test_slitlength_calculation(self):
+        """
+            Test slit_length_calculator"
+        """
+        f = self.reader.read("beam profile.DAT")
+        cal = calculator()
+        cal.set_data(f.x,f.y)
+        slitlength = cal.calculate_slit_length()
+        
+        # The value "5.5858" was obtained by manual calculation.
+        # It turns out our slit length is FWHM/2
+        self.assertAlmostEqual(slitlength,5.5858/2, 3)
+        
+        
+if __name__ == '__main__':
+    unittest.main()
+   
