Commit e950cb10 authored by eric pellegrini's avatar eric pellegrini
Browse files

MDANSE MDANSE works at a command line level: the analysis has to be

reintroduced now
parent e90cede4
...@@ -101,8 +101,8 @@ class MainClass1(object): ...@@ -101,8 +101,8 @@ class MainClass1(object):
:Example: :Example:
>>> import template >>> import Template
>>> a = template.MainClass1() >>> a = Template.MainClass1()
>>> a.function1(1,1,1) >>> a.function1(1,1,1)
2 2
......
#!/bin/sh #!/bin/sh
rm -rf Documentation
sphinx-apidoc -o ../Documentation -F --separate -d 5 -H nMoldyn -A "B. Aoun & G. Goret & E. Pellegrini, G.R. Kneller" -V 4.0 -R 4.0 ../nMOLDYN/ mkdir Documentation
cp doc_utils/conf_html.py ../Documentation/conf.py sphinx-apidoc -o ./Documentation -F --separate -d 5 -H MDANSE -A "B. Aoun & G. Goret & E. Pellegrini" -V 1.0 -R 1.0 ../MDANSE/
cp conf_html.py ./Documentation/conf.py
cp doc_utils/nMoldyn_logo.png ../Documentation/_static/ cp mdanse_logo.png ./Documentation/_static/
sphinx-build -b html ../Documentation ../Documentation/_build/html/ sphinx-build -b html ./Documentation ./Documentation/_build/html/
......
...@@ -8,5 +8,5 @@ sphinx-apidoc -o . -F --separate -d 5 -H mdanse -A "G. Goret, B. Aoun & E. Pel ...@@ -8,5 +8,5 @@ sphinx-apidoc -o . -F --separate -d 5 -H mdanse -A "G. Goret, B. Aoun & E. Pel
cp conf_help.py conf.py cp conf_help.py conf.py
cp layout.html _templates/ cp layout.html _templates/
cp nMoldyn_logo.png _static/ cp mdanse_logo.png _static/
sphinx-build -b htmlhelp ./ ./Help/ sphinx-build -b htmlhelp ./ ./Help/
# -*- coding: utf-8 -*- #MDANSE : Molecular Dynamics Analysis for Neutron Scattering Experiments
#------------------------------------------------------------------------------------------
#Copyright (C)
#2015- Eric C. Pellegrini Institut Laue-Langevin
#BP 156
#6, rue Jules Horowitz
#38042 Grenoble Cedex 9
#France
#pellegrini[at]ill.fr
#goret[at]ill.fr
#aoun[at]ill.fr
# #
# nMoldyn documentation build configuration file, created by Gael Goret #This library is free software; you can redistribute it and/or
# on Fri Feb 28 10:35:22 2014. #modify it under the terms of the GNU Lesser General Public
#License as published by the Free Software Foundation; either
#version 2.1 of the License, or (at your option) any later version.
# #
# This file is execfile()d with the current directory set to its containing dir. #This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#Lesser General Public License for more details.
# #
# Note that not all possible configuration values are present in this #You should have received a copy of the GNU Lesser General Public
# autogenerated file. #License along with this library; if not, write to the Free Software
# #Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
# All configuration values have a default; values that are commented out
# serve to show the default. '''
Created on Mar 30, 2015
@author: goret
'''
import sys, os import sys, os
# #
# If extensions (or modules to document with autodoc) are in another directory, # 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 # add these directories to sys.path here. If the directory is relative to the
...@@ -41,17 +61,17 @@ source_suffix = '.rst' ...@@ -41,17 +61,17 @@ source_suffix = '.rst'
master_doc = 'index' master_doc = 'index'
# General information about the project. # General information about the project.
project = u'nMoldyn' project = u'MDANSE'
copyright = u'2014, G. Goret & B. Aoun & E. Pellegrini' copyright = u'2015, G. Goret & B. Aoun & E. Pellegrini'
# The version info for the project you're documenting, acts as replacement for # The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the # |version| and |release|, also used in various other places throughout the
# built documents. # built documents.
# #
# The short X.Y version. # The short X.Y version.
version = '4.0' version = '1.0'
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = '4.0' release = '1.0'
# List of directories, relative to source directory, that shouldn't be searched # List of directories, relative to source directory, that shouldn't be searched
# for source files. # for source files.
...@@ -65,12 +85,9 @@ inheritance_graph_attrs = dict(rankdir="TB", size='""') ...@@ -65,12 +85,9 @@ inheritance_graph_attrs = dict(rankdir="TB", size='""')
inheritance_node_attrs = dict(color='lightblue', style='filled') inheritance_node_attrs = dict(color='lightblue', style='filled')
# The name of the Pygments (syntax highlighting) style to use. # The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx' pygments_style = 'sphinx'
# -- Options for HTML output --------------------------------------------------- # -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for # The theme to use for HTML and HTML Help pages. See the documentation for
...@@ -80,23 +97,18 @@ html_theme_options = {'sidebarwidth':250}#, 'nosidebar':True} ...@@ -80,23 +97,18 @@ html_theme_options = {'sidebarwidth':250}#, 'nosidebar':True}
html_show_copyright = False html_show_copyright = False
# Output file base name for HTML help builder. # Output file base name for HTML help builder.
htmlhelp_basename = 'mdanseDoc' htmlhelp_basename = 'mdanseDoc'
# Grouping the document tree into LaTeX files. List of tuples # Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]). # (source start file, target name, title, author, documentclass [howto/manual]).
#pdf_documents = [ #pdf_documents = [
# ('index', 'nMoldyn', u'nMoldyn Documentation', # ('index', 'MDANSE', u'MDANSE Documentation',
# u'B. Aoun & G. Goret & E. Pellegrini, G.R. Kneller'), # u'B. Aoun & G. Goret & E. Pellegrini, G.R. Kneller'),
#] #]
exclude_patterns = ['MDANSE.Externals**', 'MDANSE.__pkginfo__'] exclude_patterns = ['MDANSE.Externals**', 'MDANSE.__pkginfo__']
members_to_watch = ['class'] members_to_watch = ['class']
...@@ -104,13 +116,11 @@ members_to_watch = ['class'] ...@@ -104,13 +116,11 @@ members_to_watch = ['class']
def flag_onthefly(app, what, name, obj, options, lines): def flag_onthefly(app, what, name, obj, options, lines):
if(what in members_to_watch): if(what in members_to_watch):
# and modify the docstring so the rendered output is highlights the omission # and modify the docstring so the rendered output is highlights the omission
if lines: if lines:
lines.insert(0,' **Description:**\n\n\n') lines.insert(0,' **Description:**\n\n\n')
# lines.insert(0,' .. inheritance-diagram:: %s\n'%name.split('.')[-1]) # lines.insert(0,' .. inheritance-diagram:: %s\n'%name.split('.')[-1])
# lines.insert(0,'**inheritance-diagram:**\n\n') # lines.insert(0,'**inheritance-diagram:**\n\n')
def autodoc_skip_member(app, what, name, obj, skip, options): def autodoc_skip_member(app, what, name, obj, skip, options):
if what in ['method','attribut','function','exception']: if what in ['method','attribut','function','exception']:
...@@ -130,5 +140,3 @@ def autodoc_skip_member(app, what, name, obj, skip, options): ...@@ -130,5 +140,3 @@ def autodoc_skip_member(app, what, name, obj, skip, options):
def setup(app): def setup(app):
app.connect('autodoc-skip-member', autodoc_skip_member) app.connect('autodoc-skip-member', autodoc_skip_member)
app.connect('autodoc-process-docstring', flag_onthefly) app.connect('autodoc-process-docstring', flag_onthefly)
# -*- coding: utf-8 -*- #MDANSE : Molecular Dynamics Analysis for Neutron Scattering Experiments
#------------------------------------------------------------------------------------------
#Copyright (C)
#2015- Eric C. Pellegrini Institut Laue-Langevin
#BP 156
#6, rue Jules Horowitz
#38042 Grenoble Cedex 9
#France
#pellegrini[at]ill.fr
#goret[at]ill.fr
#aoun[at]ill.fr
# #
# nMoldyn documentation build configuration file, created by Gael Goret #This library is free software; you can redistribute it and/or
# on Fri Feb 28 10:35:22 2014. #modify it under the terms of the GNU Lesser General Public
#License as published by the Free Software Foundation; either
#version 2.1 of the License, or (at your option) any later version.
# #
# This file is execfile()d with the current directory set to its containing dir. #This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#Lesser General Public License for more details.
# #
# Note that not all possible configuration values are present in this #You should have received a copy of the GNU Lesser General Public
# autogenerated file. #License along with this library; if not, write to the Free Software
# #Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
# All configuration values have a default; values that are commented out
# serve to show the default. '''
Created on Mar 30, 2015
@author: goret
'''
import sys, os import sys, os
# #
...@@ -17,7 +37,7 @@ import sys, os ...@@ -17,7 +37,7 @@ import sys, os
# add these directories to sys.path here. If the directory is relative to the # 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. # documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.append(os.path.abspath('../nMOLDYN')) sys.path.append(os.path.abspath('../MDANSE'))
# -- General configuration ----------------------------------------------------- # -- General configuration -----------------------------------------------------
...@@ -41,23 +61,23 @@ source_suffix = '.rst' ...@@ -41,23 +61,23 @@ source_suffix = '.rst'
master_doc = 'index' master_doc = 'index'
# General information about the project. # General information about the project.
project = u'nMoldyn' project = u'MDANSE'
copyright = u'2014, B. Aoun & G. Goret & E. Pellegrini, G.R. Kneller' copyright = u'2014, B. Aoun & G. Goret & E. Pellegrini'
# The version info for the project you're documenting, acts as replacement for # The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the # |version| and |release|, also used in various other places throughout the
# built documents. # built documents.
# #
# The short X.Y version. # The short X.Y version.
version = '4.0' version = '1.0'
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = '4.0' release = '1.0'
# List of directories, relative to source directory, that shouldn't be searched # List of directories, relative to source directory, that shouldn't be searched
# for source files. # for source files.
exclude_patterns = ['Externals','_build', '**Tests**'] exclude_patterns = ['MDANSE.Externals','_build', '**Tests**']
html_logo = '_static/nMoldyn_logo.png' html_logo = '_static/mdanse_logo.png'
inheritance_graph_attrs = dict(size='""') inheritance_graph_attrs = dict(size='""')
...@@ -69,8 +89,6 @@ inheritance_node_attrs = dict(color='lightblue', style='filled') ...@@ -69,8 +89,6 @@ inheritance_node_attrs = dict(color='lightblue', style='filled')
# The name of the Pygments (syntax highlighting) style to use. # The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx' pygments_style = 'sphinx'
# -- Options for HTML output --------------------------------------------------- # -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for # The theme to use for HTML and HTML Help pages. See the documentation for
...@@ -78,55 +96,37 @@ pygments_style = 'sphinx' ...@@ -78,55 +96,37 @@ pygments_style = 'sphinx'
html_theme = "nature" html_theme = "nature"
html_theme_options = {'sidebarwidth':250}#, 'nosidebar':True} html_theme_options = {'sidebarwidth':250}#, 'nosidebar':True}
# Output file base name for HTML help builder. # Output file base name for HTML help builder.
htmlhelp_basename = 'nMoldyndoc' htmlhelp_basename = 'MDANSE_doc'
# Grouping the document tree into LaTeX files. List of tuples # Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]). # (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [ latex_documents = [
('index', 'nMoldyn.tex', u'nMoldyn Documentation', ('index', 'MDANSE.tex', u'MDANSE Documentation',
u'B. Aoun \\& G. Goret \\& E. Pellegrini, G.R. Kneller', 'manual'), u'B. Aoun \\& G. Goret \\& E. Pellegrini, G.R. Kneller', 'manual'),
] ]
#pdf_documents = [ pdf_documents = [('index', 'MDANSE', u'MDANSE Documentation', u'B. Aoun & G. Goret & E. Pellegrini'),]
# ('index', 'nMoldyn', u'nMoldyn Documentation',
# u'B. Aoun & G. Goret & E. Pellegrini, G.R. Kneller'),
#]
# -- Options for manual page output -------------------------------------------- # -- Options for manual page output --------------------------------------------
# One entry per manual page. List of tuples # One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section). # (source start file, name, description, authors, manual section).
man_pages = [ man_pages = [('index', 'MDANSE', u'MDANSE Documentation', u'B. Aoun & G. Goret & E. Pellegrini'),]
('index', 'nmoldyn', u'nMoldyn Documentation',
[u'B. Aoun & G. Goret & E. Pellegrini, G.R. Kneller'], 1)
]
# Grouping the document tree into Texinfo files. List of tuples # Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author, # (source start file, target name, title, author,
# dir menu entry, description, category) # dir menu entry, description, category)
texinfo_documents = [ texinfo_documents = [('index', 'MDANSE', u'MDANSE Documentation',u'B. Aoun & G. Goret & E. Pellegrini','MDANSE', 'One line description of project.','Miscellaneous'),]
('index', 'nMoldyn', u'nMoldyn Documentation',
u'B. Aoun & G. Goret & E. Pellegrini, G.R. Kneller', 'nMoldyn', 'One line description of project.',
'Miscellaneous'),
]
exclude_patterns = ['MDANSE.Externals**', 'MDANSE.__pkginfo__']
exclude_patterns = ['nMOLDYN.Externals**', 'nMOLDYN.nMOLDYN.__pkginfo__']
members_to_watch = ['class'] members_to_watch = ['class']
def flag_onthefly(app, what, name, obj, options, lines): def flag_onthefly(app, what, name, obj, options, lines):
from MDANSE import REGISTRY
for kls in REGISTRY["job"].values():
kls.__doc__ += kls.configurators.build_doc()
if(what in members_to_watch): if(what in members_to_watch):
# and modify the docstring so the rendered output is highlights the omission # and modify the docstring so the rendered output is highlights the omission
if lines: if lines:
...@@ -134,7 +134,7 @@ def flag_onthefly(app, what, name, obj, options, lines): ...@@ -134,7 +134,7 @@ def flag_onthefly(app, what, name, obj, options, lines):
lines.insert(0,' .. inheritance-diagram:: %s\n'%name.split('.')[-1]) lines.insert(0,' .. inheritance-diagram:: %s\n'%name.split('.')[-1])
lines.insert(0,'**inheritance-diagram:**\n\n') lines.insert(0,'**inheritance-diagram:**\n\n')
def setup(app): def setup(app):
app.connect('autodoc-process-docstring', flag_onthefly) app.connect('autodoc-process-docstring', flag_onthefly)
#!/bin/sh #!/bin/sh
cd ../Tests/ cd ../Tests/
coverage run --source=../nMOLDYN/ ../Tests/AllTests.py coverage run --source=../MDANSE/ ../Tests/AllTests.py
coverage html --omit=../nMOLDYN/Externals/*,../nMOLDYN/GUI/*,../nMOLDYN/Framework/Plugins/*,../nMOLDYN/Framework/ConfiguratorWidgets/* coverage html --omit=../MDANSE/Externals/*,../MDANSE/GUI/*,../MDANSE/Framework/Plugins/*,../MDANSE/Framework/ConfiguratorWidgets/*
\ No newline at end of file
...@@ -49,7 +49,7 @@ EXTENSIONS = [Extension('distance_histogram', ...@@ -49,7 +49,7 @@ EXTENSIONS = [Extension('distance_histogram',
setup (name = "nMolDyn_Extensions", setup (name = "MDANSE_Extensions",
version = "0.1", version = "1.0",
ext_modules = EXTENSIONS, ext_modules = EXTENSIONS,
cmdclass = {'build_ext': build_ext}) cmdclass = {'build_ext': build_ext})
...@@ -3,11 +3,11 @@ include LICENCE ...@@ -3,11 +3,11 @@ include LICENCE
recursive-include Extensions/qhull_lib *.h *c *.pxd recursive-include Extensions/qhull_lib *.h *c *.pxd
recursive-include nMOLDYN/GUI/Resources/Icons *.png recursive-include MDANSE/GUI/Resources/Icons *.png
include nMOLDYN/Data/elements_database.csv include MDANSEData/elements_database.csv
include nMOLDYN/Data/Atoms/* include MDANSE/Data/Atoms/*
recursive-include UserData * recursive-include UserData *
......
#MDANSE : Molecular Dynamics Analysis for Neutron Scattering Experiments
#------------------------------------------------------------------------------------------
#Copyright (C)
#2015- Eric C. Pellegrini Institut Laue-Langevin
#BP 156
#6, rue Jules Horowitz
#38042 Grenoble Cedex 9
#France
#pellegrini[at]ill.fr
#goret[at]ill.fr
#aoun[at]ill.fr
#
#This library is free software; you can redistribute it and/or
#modify it under the terms of the GNU Lesser General Public
#License as published by the Free Software Foundation; either
#version 2.1 of the License, or (at your option) any later version.
#
#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#Lesser General Public License for more details.
#
#You should have received a copy of the GNU Lesser General Public
#License along with this library; if not, write to the Free Software
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
'''
Created on Mar 30, 2015
@author: pellegrini
'''
import optparse
import textwrap
class IndentedHelp(optparse.IndentedHelpFormatter):
'''This class modify slightly the help formatter of the optparse.OptionParser class.
This allows to take into account the line feed properly.
@note: code taken as it is from an implementation made by Tim Chase
(http://groups.google.com/group/comp.lang.python/browse_thread/thread/6df6e6b541a15bc2/09f28e26af0699b1)
'''
def format_description(self, description):
if not description:
return ""
desc_width = self.width - self.current_indent
indent = " "*self.current_indent
bits = description.split('\n')
formatted_bits = [textwrap.fill(bit,desc_width,initial_indent=indent,subsequent_indent=indent) for bit in bits]
result = "\n".join(formatted_bits) + "\n"
return result
def format_option(self, option):
result = []
opts = self.option_strings[option]
opt_width = self.help_position - self.current_indent - 2
if len(opts) > opt_width:
opts = "%*s%s\n" % (self.current_indent, "", opts)
indent_first = self.help_position
else: # start help on same line as opts
opts = "%*s%-*s " % (self.current_indent, "", opt_width, opts)
indent_first = 0
result.append(opts)
if option.help:
help_text = self.expand_default(option)
# Everything is the same up through here
help_lines = []
for para in help_text.split("\n"):
help_lines.extend(textwrap.wrap(para, self.help_width))
# Everything is the same after here
result.append("%*s%s\n" % (indent_first, "", help_lines[0]))
result.extend(["%*s%s\n" % (self.help_position, "", line) for line in help_lines[1:]])
elif opts[-1] != "\n":
result.append("\n")
return "".join(result)
#MDANSE : Molecular Dynamics Analysis for Neutron Scattering Experiments
#------------------------------------------------------------------------------------------
#Copyright (C)
#2015- Eric C. Pellegrini Institut Laue-Langevin
#BP 156
#6, rue Jules Horowitz
#38042 Grenoble Cedex 9
#France
#pellegrini[at]ill.fr
#goret[at]ill.fr
#aoun[at]ill.fr
#
#This library is free software; you can redistribute it and/or
#modify it under the terms of the GNU Lesser General Public
#License as published by the Free Software Foundation; either
#version 2.1 of the License, or (at your option) any later version.
#
#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#Lesser General Public License for more details.
#
#You should have received a copy of the GNU Lesser General Public
#License along with this library; if not, write to the Free Software
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
'''
Created on Mar 30, 2015
@author: pellegrini
'''
import abc import abc
import inspect
import os
class _Meta(type): class _Meta(type):
''' '''
...@@ -17,14 +51,11 @@ class _Meta(type): ...@@ -17,14 +51,11 @@ class _Meta(type):
class ClassRegistry(abc.ABCMeta): class ClassRegistry(abc.ABCMeta):
''' '''
Metaclass that registers the subclasses of bases classes. Metaclass that registers the subclasses of all the base classes used in MDANSE framework.
The internal registry is defined as a nested dictionary whose keys The subclasses are stored internally in a nested dictionary whose primary key
are the |type| class attribute of the base classes and values another dictionary is the 'type' class attribute of the base class they are inheriting from and secondary key is
whose keys are the |type| class attribute of the subclasses and values are the corresponding their own 'type' class attribute.
class instances.
Hence any base or child class that does not define |type| class attribute will not be resgistered.
''' '''
__metaclass__ = _Meta __metaclass__ = _Meta
...@@ -38,8 +69,11 @@ class ClassRegistry(abc.ABCMeta): ...@@ -38,8 +69,11 @@ class ClassRegistry(abc.ABCMeta):