Commit fa4dce85 authored by bliss administrator's avatar bliss administrator
Browse files

Commit Staffan

parent 0af8e919
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
ID19 software & configuration
Copyright (C) 2018 BCU Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
include LICENSE
include README.rst
recursive-include tests *
recursive-exclude * __pycache__
recursive-exclude * *.py[co]
recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif
============
ID19 project
============
[![build status](https://gitlab.esrf.fr/ID19/id19/badges/master/build.svg)](http://ID19.gitlab-pages.esrf.fr/ID19)
[![coverage report](https://gitlab.esrf.fr/ID19/id19/badges/master/coverage.svg)](http://ID19.gitlab-pages.esrf.fr/id19/htmlcov)
ID19 software & configuration
Latest documentation from master can be found [here](http://ID19.gitlab-pages.esrf.fr/id19)
/id19.rst
/id19.*.rst
/modules.rst
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = python -msphinx
SPHINXPROJ = id19
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# id19 documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
#
# 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.
# 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.
#
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
import id19
# -- 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', 'sphinx.ext.viewcode']
# 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'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'ID19 project'
copyright = u"2018, BCU Team"
author = u"BCU Team"
# 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 = id19.__version__
# The full version, including alpha/beta/rc tags.
release = id19.__version__
# 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
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# 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 = 'alabaster'
# 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 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']
# -- Options for HTMLHelp output ---------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'id19doc'
# -- 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',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass
# [howto, manual, or own class]).
latex_documents = [
(master_doc, 'id19.tex',
u'ID19 project Documentation',
u'BCU Team', 'manual'),
]
# -- 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, 'id19',
u'ID19 project Documentation',
[author], 1)
]
# -- 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, 'id19',
u'ID19 project Documentation',
author,
'id19',
'One line description of project.',
'Miscellaneous'),
]
Welcome to ID19 project's documentation!
======================================
.. toctree::
:maxdepth: 2
:caption: Contents:
readme
usage
modules
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
.. include:: ../README.rst
=====
Usage
=====
To use ID19 project in a project::
import id19
# -*- coding: utf-8 -*-
"""Top-level package for ID19 project."""
__author__ = """BCU Team"""
__email__ = 'bliss@esrf.fr'
__version__ = '0.1.0'
from bliss.common.standard import *
from bliss.common.axis import *
from bliss.setup_globals import *
import sys
def init_sx():
sx.limits(low_limit=-100,high_limit=100)
######### LIMIT -
print("Moving to hard limit -")
sx.hw_limit(-1,wait=False)
gevent.sleep(1)
sys.stdout.write("Searching limit- ...")
sys.stdout.flush()
_status = sx.state()
while _status == "MOVING":
_status = sx.state()
sys.stdout.write('.')
sys.stdout.flush()
gevent.sleep(1)
print(".\n")
print("lim- found !\n")
# hardware synchronization
sx.sync_hard()
_myposn = sx.position()
print("Hard limit - value: %f" % (_myposn))
######### LIMIT +
print("Moving to hard limit +")
sx.hw_limit(1,wait=False)
gevent.sleep(1)
sys.stdout.write("Searching limit+ ...")
sys.stdout.flush()
_status = sx.state()
while _status == "MOVING":
_status = sx.state()
sys.stdout.write('.')
sys.stdout.flush()
gevent.sleep(1)
print(".\n")
print("lim+ found !\n")
# hardware synchronization
sx.sync_hard()
_myposp = sx.position()
print("Hard limit + value: %f" % (_myposp))
mid = (_myposp - _myposn) / 2.0 + _myposn
print("moving to middle position %f\n" % (mid))
umv(sx,mid)
print("reseting sx to 0\n")
sx.dial(0)
sx.position(0)
slp = (_myposp - _myposn) / 2.0 - 0.05
print("reseting sx limits to hard limits +/- 0.05\n")
sx.limits(low_limit=-slp,high_limit=slp)
# search for SY pos and neg limits and reset dial to 0 in the middle of them.
def init_sy():
sy.limits(low_limit=-100,high_limit=100)
######### LIMIT -
print("Moving to hard limit -")
sy.hw_limit(-1,wait=False)
gevent.sleep(1)
sys.stdout.write("Searching limit- ...")
sys.stdout.flush()
_status = sy.state()
while _status == "MOVING":
_status = sy.state()
sys.stdout.write('.')
sys.stdout.flush()
gevent.sleep(1)
print(".\n")
print("lim- found !\n")
# hardware synchronization
sy.sync_hard()
_myposn = sy.position()
print("Hard limit - value: %f" % (_myposn))
######### LIMIT +
print("Moving to hard limit +")
sy.hw_limit(1,wait=False)
gevent.sleep(1)
sys.stdout.write("Searching limit+ ...")
sys.stdout.flush()
_status = sy.state()
while _status == "MOVING":
_status = sy.state()
sys.stdout.write('.')
sys.stdout.flush()
gevent.sleep(1)
print(".\n")
print("lim+ found !\n")
# hardware synchronization
sy.sync_hard()
_myposp = sy.position()
print("Hard limit + value: %f" % (_myposp))
mid = (_myposp - _myposn) / 2.0 + _myposn
print("moving to middle position %f\n" % (mid))
umv(sy,mid)
print("reseting sy to 0\n")
sy.dial(0)
sy.position(0)
slp = (_myposp - _myposn) / 2.0 - 0.05
print("reseting sy limits to hard limits +/- 0.05\n")
sy.limits(low_limit=-slp,high_limit=slp)
# search for YROT pos and neg limits and reset dial to 0 in the middle of them.
def init_hr_yrot():
yrot.limits(low_limit=-1000,high_limit=1000)
######### LIMIT -
print("Moving to hard limit -")
yrot.hw_limit(-1,wait=False)
gevent.sleep(1)
sys.stdout.write("Searching limit- ...")
sys.stdout.flush()
_status = yrot.state()
while _status == "MOVING":
_status = yrot.state()
sys.stdout.write('.')
sys.stdout.flush()
gevent.sleep(1)
print(".\n")
print("lim- found !\n")
# hardware synchronization
yrot.sync_hard()
_myposn = yrot.position()
print("Hard limit - value: %f" % (_myposn))
######### LIMIT +
print("Moving to hard limit +")
yrot.hw_limit(1,wait=False)
gevent.sleep(1)
sys.stdout.write("Searching limit+ ...")
sys.stdout.flush()
_status = yrot.state()
while _status == "MOVING":
_status = yrot.state()
sys.stdout.write('.')
sys.stdout.flush()
gevent.sleep(1)
print(".\n")
print("lim+ found !\n")
# hardware synchronization
yrot.sync_hard()
_myposp = yrot.position()
print("Hard limit + value: %f" % (_myposp))
mid = (_myposp - _myposn) / 2.0 + _myposn
print("moving to middle position %f\n" % (mid))
umv(yrot,mid)
print("reseting yrot to 0\n")
yrot.dial(0)
yrot.position(0)
slp = (_myposp - _myposn) / 2.0 - 0.05
print("reseting yrot limits to hard limits +/- 0.05\n")
yrot.limits(low_limit=-slp,high_limit=slp)
def init_hr_sz():
lim_n = sz.limits()[0]
sz.limits(low_limit=lim_n,high_limit=100)
######### LIMIT +
print("Moving to hard limit +")
sz.hw_limit(1,wait=False)
gevent.sleep(1)
sys.stdout.write("Searching limit+ ...")
sys.stdout.flush()
_status = sz.state()
while _status == "MOVING":
_status = sz.state()
sys.stdout.write('.')
sys.stdout.flush()
gevent.sleep(1)
print(".\n")
print("lim+ found !\n")
# hardware synchronization
sz.sync_hard()
_myposp = sz.position()
print("Hard limit + value: %f" % (_myposp))
cal_pos = 40.0
slp = cal_pos - 0.05
print("reseting sz to %f\n" % (cal_pos))
sz.dial(cal_pos)
sz.position(cal_pos)
print("moving to calibration position %f\n" % (cal_pos - 10.0))
umvr(sz,-10.0)
print("reseting sz limit+ to hard limit - 0.05\n")
sz.limits(low_limit=lim_n,high_limit=slp)
def init_hr_z0():
lim_p = z0.limits()[1]
z0.limits(low_limit=-100,high_limit=lim_p)
######### LIMIT -
print("Moving to hard limit -")
z0.hw_limit(-1,wait=False)
gevent.sleep(1)
sys.stdout.write("Searching limit- ...")
sys.stdout.flush()
_status = z0.state()
while _status == "MOVING":
_status = z0.state()
sys.stdout.write('.')
sys.stdout.flush()
gevent.sleep(1)
print(".\n")
print("lim- found !\n")
# hardware synchronization
z0.sync_hard()
_myposn = z0.position()
print("Hard limit - value: %f" % (_myposn))
cal_pos = 0.0
sln = cal_pos + 0.05
print("reseting z0 to %f\n" % (cal_pos))
z0.dial(cal_pos)
z0.position(cal_pos)
print("moving to calibration position %f\n" % (cal_pos + 10.0))
umvr(z0,10.0)
print("reseting z0 limit- to hard limit + 0.05\n")
z0.limits(low_limit=sln,high_limit=lim_p)
def calib_motors(*argv):
cal = [gevent.spawn(arg) for arg in argv]
gevent.joinall(cal)
[flake8]
exclude = docs
[aliases]
# Define setup.py command aliases here
test = pytest
[tool:pytest]
addopts = --cov id19 --cov-report html:tests/htmlcov --cov-report term -v tests/
# -*- coding: utf-8 -*-
"""The setup script."""
import sys
from setuptools import setup, find_packages
TESTING = any(x in sys.argv for x in ['test', 'pytest'])
with open('README.rst') as readme_file:
readme = readme_file.read()
requirements = ['bliss']
setup_requirements = ['pytest-runner', 'pytest'] if TESTING else []
test_requirements = ['pytest-cov', 'mock']
setup(
author="BCU Team",
author_email='bliss@esrf.fr',
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Natural Language :: English',
"Programming Language :: Python :: 2",