Commit 055df4b9 authored by payno's avatar payno

Merge branch 'integrate_process' into 'master'

[core] start integration of the process

See merge request workflow/xas!1
parents c484ccad a1adf325
Pipeline #12055 passed with stage
in 9 minutes and 29 seconds
......@@ -51,3 +51,6 @@ datasets/
# octave files
octave-workspace
# submodules
pushworkflow
\ No newline at end of file
stages:
- test
variables:
http_proxy: http://proxy.esrf.fr:3128
https_proxy: http://proxy.esrf.fr:3128
no_proxy: .esrf.fr,localhost
.build_template: &test_linux_template
stage: test
before_script:
- arch
- export PYTHONPATH="${PYTHONPATH}:/usr/lib/python3/dist-packages/"
- export LD_LIBRARY_PATH=/lib/i386-linux-gnu/:${LD_LIBRARY_PATH}
- export LD_LIBRARY_PATH=/lib/x86_64-linux-gnu/:${LD_LIBRARY_PATH}
- export XAS_TEST_PROCESS=False
- python --version
- python -m pip install pip --upgrade
- python -m pip install setuptools --upgrade
- python -m pip install numpy --upgrade
- python -m pip install matplotlib
script:
- source ./ci/install_scripts.sh
- install_orange3
- install_anyqt 'master'
- python -m pip install -r requirements.txt
- python -m pip install -r requirements-dev.txt
- python -m pip install fabio --upgrade --pre
- python -m pip install silx --upgrade --pre
- cd xas
- git clone https://gitlab.esrf.fr/payno/pushworkflow.git
- cd -
- python -m pip install -e .
- python -m xas --help
- /usr/bin/xvfb-run --server-args="-screen 0 1024x768x24" -a xas test -v
test:python3.5-stretch-pyqt5:
image: docker-registry.esrf.fr/dau/tomwer:python3.5_stretch_pyqt5
<<: *test_linux_template
test:python3.5-stretch-pyside2:
image: docker-registry.esrf.fr/dau/tomwer:python3.5_stretch_pyqt5
<<: *test_linux_template
......@@ -32,7 +32,13 @@ The new widget appears in the toolbox bar under the section Example.
![screenshot](https://gitlab.esrf.fr/workflow/xas/blob/master/orangecontrib/xas/screenshots/main_workflow.png)
Application
-----------
Doc
---
To process the (full) documentation:
python setup.py build build_doc build_sphinx -b html
File mode changed from 100644 to 100755
#!/bin/bash
function install_silx(){
if [ "$2" = 'latest' ]; then
pip install silx
else
unset http_proxy
unset https_proxy
git clone https://github.com/silx-kit/silx.git
cd silx
pip install mako
pip install pybind11
pip install -r requirements.txt
pip install .
export http_proxy=http://proxy.esrf.fr:3128/
export https_proxy=http://proxy.esrf.fr:3128/
fi
}
function silx_version(){
python -c 'import silx; print(silx.version)'
}
function install_orange3(){
unset http_proxy
unset https_proxy
git clone --single-branch --branch master https://github.com/payno/orange3.git
cd orange3
pip install -r requirements-core.txt
pip install .
cd ..
export http_proxy=http://proxy.esrf.fr:3128/
export https_proxy=http://proxy.esrf.fr:3128/
}
function install_anyqt(){
if [ "$2" = 'master' ]; then
unset http_proxy
unset https_proxy
git clone --single-branch https://github.com/ales-erjavec/anyqt.git
cd anyqt
pip install .
cd ..
export http_proxy=http://proxy.esrf.fr:3128/
export https_proxy=http://proxy.esrf.fr:3128/
fi
}
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Orange3 Example Add-on documentation build configuration file, created by
# sphinx-quickstart on Fri Aug 21 11:28:31 2015.
#
# 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
import os
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'ext'))
# 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.insert(0, os.path.abspath('.'))
# -- 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 = [
'sphinx.ext.autodoc',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
source_suffix = ['.rst', '.md']
source_parsers = {".md": "recommonmark.parser.CommonMarkParser"}
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = 'xas'
copyright = '2016-2019, ESRF'
author = 'ESRF'
# 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'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
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 = []
# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'nature'
# 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 = {}
# 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 = "img/xas.png"
# 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']
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#html_extra_path = []
# 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 = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
# 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr'
#html_search_language = 'en'
# A dictionary with options for the search language support, empty by default.
# Now only 'ja' uses this config value
#html_search_options = {'type': 'default'}
# The name of a javascript file (relative to the configuration directory) that
# implements a search results scorer. If empty, the default will be used.
#html_search_scorer = 'scorer.js'
# Output file base name for HTML help builder.
htmlhelp_basename = 'xas'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
# Latex figure (float) alignment
#'figure_align': 'htbp',
}
# 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
# 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 = [
(master_doc, 'xas', 'xas Documentation',
[author], 1)
]
htmlhelp_pages = [
(master_doc, 'xas', 'xas Add-on Documentation',
[author], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'xas', 'xas Documentation',
author, 'xas', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64px"
height="64px"
id="svg2985"
version="1.1"
inkscape:version="0.48.5 r10040"
sodipodi:docname="New document 2">
<defs
id="defs2987">
<linearGradient
id="linearGradient3769">
<stop
id="stop3777"
offset="0"
style="stop-color:#b93939;stop-opacity:0.8347826;" />
<stop
style="stop-color:#d74c4c;stop-opacity:0.5043478;"
offset="1"
id="stop3773" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3769"
id="linearGradient3775"
x1="-55.954544"
y1="8.0573578"
x2="54.5"
y2="8.0573578"
gradientUnits="userSpaceOnUse" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5.5"
inkscape:cx="32"
inkscape:cy="32"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:document-units="px"
inkscape:grid-bbox="true"
inkscape:window-width="1920"
inkscape:window-height="1098"
inkscape:window-x="0"
inkscape:window-y="31"
inkscape:window-maximized="1" />
<metadata
id="metadata2990">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<path
style="fill:none;stroke:url(#linearGradient3775);stroke-width:0.8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
d="M -0.18181818,36.181818 C 10.181818,2.5454545 12.181818,73.272727 25.454545,61.272727 38.727273,49.272727 54,0 54,0 L 0.72727273,-46.545455 -55.454545,32.727273 -18.545455,50 z"
id="path2999"
inkscape:connector-curvature="0" />
<text
xml:space="preserve"
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Amiri;-inkscape-font-specification:Amiri"
x="6.4311514"
y="41.609375"
id="text2993"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan2995"
x="6.4311514"
y="41.609375"
style="font-size:30px">XAS</tspan></text>
</g>
</svg>
===
XAS
===
TODO
.. toctree::
:hidden:
tutorials/index.rst
:doc:`install`
Installation
:doc:`tutorials/index`
tutorials for using the xas library
-----------------------------
xas on esrf official debian 8
-----------------------------
A xas module for debian 8 is provided.
This mean that if you have an esrf official debian 8 distribution you can load the module:
.. code-block:: bash
module load xas_orange
and execute xas.
.. code-block:: bash
xas_orange [myworkflow.ows]
--------------
Orange Widgets
--------------
.. the orange widgets section has to be stored here to fit the orange requirement (and accessing the help from orange-canvas)
This is the list of actual widgets/boxes proposed by the workflow tool:
.. toctree::
:maxdepth: 1
widgets/pymca_exafs.rst
widgets/pymca_ft.rst
widgets/pymca_k_weight.rst
widgets/pymca_normalization.rst
widgets/xas_input.rst
widgets/xas_output.rst
This diff is collapsed.
PyMca exafs
===========
TODO
.. image:: img/pymca_exafs.png
PyMca Fourier Transform
=======================
TODO
.. image:: img/pymca_ft.png
PyMca k weight
==============
TODO
.. image:: img/pymca_kweight.png
PyMca normalization
===================
TODO
.. image:: img/pymca_normalization.png
XAS input
=========
Use to load a spectrum from a .dat file or .h5 file
.. image:: img/xas_input.png
XAS output
==========
Use to dump configuration and spectrum into a .h5 file
.. image:: img/xas_output.png
This diff is collapsed.
# coding: utf-8
# /*##########################################################################
#
# Copyright (c) 2016-2017 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
# ###########################################################################*/
__authors__ = ["H. Payno"]
__license__ = "MIT"
__date__ = "24/01/2017"
import logging
import os
import shutil
import tempfile
from silx.gui import qt
from orangecontrib.xas.test.OrangeWorkflowTest import OrangeWorflowTest
from PyMca5.PyMcaDataDir import PYMCA_DATA_DIR
from xas.gui.qtapplicationmanager import QApplicationManager
logging.disable(logging.INFO)
_logger = logging.getLogger(__file__)
app = QApplicationManager()
class TestSimplePyMcaWorkflow(OrangeWorflowTest):
"""Test the following workflow:
- XASInputOW
- NormalizationOW
- XASOutputOW
"""
def setUp(self):
OrangeWorflowTest.setUp(self)
# set input file
data_file = os.path.join(PYMCA_DATA_DIR, "EXAFS_Cu.dat")
self.xasInputWidget.setFileSelected(data_file)
# set output file
self.outputdir = tempfile.mkdtemp()
self.output_file = os.path.join(self.outputdir, 'output.h5')
self.xasOutputWidget.setFileSelected(self.output_file)
def tearDow(self):
if os.path.isdir(self.outputdir):
shutil.rmtree(self.outputdir)
OrangeWorflowTest.tearDown(self)
@classmethod
def setUpClass(cls):
OrangeWorflowTest.setUpClass()
# create widgets
xasInputNode = cls.addWidget(cls, 'orangecontrib.xas.widgets.xas_input.XASInputOW')
xasNormalizationNode = cls.addWidget(cls, 'orangecontrib.xas.widgets.normalization.NormalizationOW')
xasEXAFSNode = cls.addWidget(cls, 'orangecontrib.xas.widgets.exafs.ExafsOW')
xasKWeightNode = cls.addWidget(cls, 'orangecontrib.xas.widgets.k_weight.KWeightOW')
xasFTNode = cls.addWidget(cls, 'orangecontrib.xas.widgets.ft.FTOW')
xasOutputNode = cls.addWidget(cls, 'orangecontrib.xas.widgets.xas_output.XASOutputOW')
cls.processOrangeEvents(cls)
cls.link(cls, xasInputNode, "spectrum", xasNormalizationNode, "spectrum")
cls.link(cls, xasNormalizationNode, "spectrum", xasEXAFSNode, "spectrum")
cls.link(cls, xasEXAFSNode, "spectrum", xasKWeightNode, "spectrum")
cls.link(cls, xasKWeightNode, "spectrum", xasFTNode, "spectrum")
cls.link(cls, xasFTNode, "spectrum", xasOutputNode, "spectrum")
cls.processOrangeEvents(cls)
cls.xasInputWidget = cls.getWidgetForNode(cls, xasInputNode)
cls.xasNormalizationWidget = cls.getWidgetForNode(cls, xasNormalizationNode)
cls.xasEXAFSWidget = cls.getWidgetForNode(cls, xasEXAFSNode)
cls.xasKWeightWidget = cls.getWidgetForNode(cls, xasKWeightNode)
cls.xasFTWidget = cls.getWidgetForNode(cls, xasFTNode)
cls.xasOutputWidget = cls.getWidgetForNode(cls, xasOutputNode)
@classmethod
def tearDownClass(cls):
cls.xasInputWidget = None
cls.xasNormalizationWidget = None
cls.xasEXAFSWidget = None
cls.xasKWeightWidget = None
cls.xasFTWidget = None
cls.xasOutputWidget = None
OrangeWorflowTest.tearDownClass()
def test(self):
"""Make sure the workflow is valid and end on the data transfert"""
# start processing
self.xasInputWidget</