removed old python docs

This commit is contained in:
Erik Frojdh 2020-06-24 09:11:26 +02:00
parent ba7f54744b
commit 4ca46e4123
17 changed files with 3 additions and 1073 deletions

View File

@ -21,7 +21,7 @@ print(sys.path)
# -- Project information -----------------------------------------------------
project = 'slsDetectorPackage'
copyright = '2019, PSD Detector Group'
copyright = '2020, PSD Detector Group'
author = 'PSD Detector Group'
version = '@PROJECT_VERSION@'

View File

@ -4,7 +4,7 @@ Enums
These enums are defined in slsDetectorDefs in the C++ package and
exposed to Python through pybind11.
.. py:currentmodule:: sls_detector
.. py:currentmodule:: slsdet
.. autoclass:: runStatus
:members:

View File

@ -1,5 +1,5 @@
"""
Setup file for sls_detector
Setup file for slsdet
Build upon the pybind11 example found here: https://github.com/pybind/python_example
"""
from setuptools import setup, Extension, find_packages

View File

@ -1,20 +0,0 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = python -msphinx
SPHINXPROJ = sls_detector_tools
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)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

View File

@ -1,134 +0,0 @@
Code quality
=============================
For usability and reliability of the software the code needs to be high quality. For this
project it means meeting the four criteria described below. Any addition should pass all of
them.
--------------------------------
Look, read and feel like Python
--------------------------------
When using classes and functions from the
package it should feel like you are using Python tools and be forces
to write C++ style code with Python syntax.
::
with xray_box.shutter_open():
for th in threshold:
d.vthreshold = th
d.acq()
should be preferred over
::
N = len(threshold)
xray_box.open_shutter()
for i in range(N):
d.dacs.set_dac('vthreshold', threshold[i])
d.acq()
xray_box.close_shutter()
even if the difference might seem small.
--------------------
Have documentation
--------------------
Classes and functions should be documented with doc-strings
in the source code. Preferably with examples. The syntax to be used
is numpy-sphinx.
::
def function(arg):
"""
This is a function that does something
Parameters
----------
arg: int
An argument
Returns
--------
value: double
Returns a value
"""
return np.sin(arg+np.pi)
---------------------------------
Pass static analysis with pylint
---------------------------------
Yes, anything less than 9/10 just means that you are lazy. If
there is a good reason why to diverge, then we can always
add an exception.
Currently the following additions are made:
* good-names: x, y, ax, im etc.
* function arguments 10
* Whitelist: numpy, _sls
-----------------------
Tested code
-----------------------
Last but not least... *actually last just because of the long list included.*
All code that goes in should have adequate tests. If a new function does not
have a minimum of one test it does not get added.
**Unit-tests with pytest and mocker**
::
----------- coverage: platform linux, python 3.6.4-final-0 -----------
Name Stmts Miss Cover
------------------------------------------------
sls_detector/__init__.py 4 0 100%
sls_detector/decorators.py 14 3 79%
sls_detector/detector.py 461 115 75%
sls_detector/eiger.py 150 64 57%
sls_detector/errors.py 7 0 100%
sls_detector/jungfrau.py 59 26 56%
------------------------------------------------
TOTAL 695 208 70%
========= 78 passed in 0.60 seconds =========
**Simple integration tests**
These tests require a detector connected. Performs simple tasks like setting
exposure time and reading back to double check the value
::
----------- coverage: platform linux, python 3.6.4-final-0 -----------
Name Stmts Miss Cover
------------------------------------------------
sls_detector/__init__.py 4 0 100%
sls_detector/decorators.py 14 0 100%
sls_detector/detector.py 461 103 78%
sls_detector/eiger.py 150 20 87%
sls_detector/errors.py 7 0 100%
sls_detector/jungfrau.py 59 26 56%
------------------------------------------------
TOTAL 695 149 79%
========= 67 passed, 1 skipped in 16.66 seconds =========
**Complex integration test**
Typical measurements. Might require X-rays. Tests are usually evaluated from
plots

View File

@ -1,370 +0,0 @@
Command line to Python
=========================
If you are already familiar with the command line interface to the
slsDetectorSoftware here is a quick reference translating to Python commands
.. note ::
Commands labeled Mythen only or Gotthard only are currently not implemented in the
Python class. If you need this functionallity please contact the SLS Detector Group
.. py:currentmodule:: sls_detector
.. |ro| replace:: *(read only)*
.. |free| replace:: :py:func:`Detector.free_shared_memory`
.. |sub| replace:: :py:attr:`Detector.sub_exposure_time`
.. |mg| replace:: Mythen and Gotthard only
.. |g| replace:: Gotthard only
.. |m| replace:: Mythen only
.. |msp| replace:: :py:attr:`Detector.measured_subperiod`
.. |new_chiptest| replace:: New chip test board only
.. |chiptest| replace:: Chip test board only
.. |dr| replace:: :py:attr:`Detector.dynamic_range`
.. |j| replace:: Jungfrau only
.. |te| replace:: :py:attr:`Detector.trimmed_energies`
.. |temp_fpgaext| replace:: :py:attr:`Detector.temp`.fpgaext
.. |epa| replace:: :py:func:`Eiger.pulse_all_pixels`
.. |rfc| replace:: :py:func:`Detector.reset_frames_caught`
.. |rfi| replace:: :py:attr:`Detector.receiver_frame_index`
.. |ron| replace:: :py:attr:`Detector.receiver_online`
.. |flipy| replace:: :py:attr:`Detector.flipped_data_y`
.. |flipx| replace:: :py:attr:`Detector.flipped_data_x`
.. |adcr| replace:: :py:func:`DetectorApi.writeAdcRegister`
.. |sb| replace:: :py:func:`DetectorApi.setBitInRegister`
.. |cb| replace:: :py:func:`DetectorApi.clearBitInRegister`
.. |tempth| replace:: :py:attr:`Jungfrau.temperature_threshold`
.. |tempev| replace:: :py:attr:`Jungfrau.temperature_event`
.. |tempco| replace:: :py:attr:`Jungfrau.temperature_control`
.. |depr| replace:: *Deprecated/Internal*
.. |nimp| replace:: *Not implemented*
.. |rudp| replace:: :py:attr:`Detector.rx_realudpsocksize`
.. |lci| replace:: :py:attr:`Detector.last_client_ip`
.. |rlci| replace:: :py:attr:`Detector.receiver_last_client_ip`
.. |fdp| replace:: :py:attr:`Detector.frame_discard_policy`
.. |apic| replace:: :py:attr:`Detector.api_compatibility`
------------------------
Commands
------------------------
===================== ===================================== ================== =========
Command Python Implementation Tests
===================== ===================================== ================== =========
sls_detector_acquire :py:func:`Detector.acq` OK OK
test |depr| \- \-
help help(Detector.acq) \- \-
exitserver |depr| \- \-
exitreceiver |depr| \- \-
flippeddatay |flipy| OK \-
digitest |depr| \- \-
bustest |depr| \- \-
digibittest Which detector? \- \-
reg :py:attr:`Detector.register` OK \-
adcreg |adcr| OK \-
setbit |sb| OK \-
clearbit |cb| OK \-
getbit |nimp| \- \-
r_compression Not implemented in receiver \- \-
acquire :py:func:`Detector.acq` OK \-
busy :py:attr:`Detector.busy` OK Partial
status :py:attr:`Detector.status` OK |ro| \-
status start :py:func:`Detector.start_detector` OK \-
status stop :py:func:`Detector.stop_detector` OK \-
data |depr| \- \-
frame |depr| \- \-
readctr |g| \- \-
resetctr |g| \- \-
resmat :py:attr:`Eiger.eiger_matrix_reset` OK OK
free |free| OK \-
hostname :py:attr:`Detector.hostname` OK OK
add |nimp| \- \-
replace |nimp| \- \-
user |nimp| \- \-
master |nimp| \- \-
sync Which detector? \- \-
online :py:attr:`Detector.online` OK \-
checkonline |nimp| \- \-
activate :py:attr:`Eiger.active` \- \-
nmod :py:attr:`Detector.n_modules` OK \-
maxmod |depr| \- \-
dr |dr| OK OK
roi |g| \- \-
detsizechan :py:attr:`Detector.image_size` OK \-
roimask |nimp| \- \-
flippeddatax |flipx| OK \-
tengiga :py:attr:`Eiger.tengiga` OK \-
gappixels :py:attr:`Eiger.add_gappixels` OK \-
flags :py:attr:`Detector.flags` OK \-
extsig |mg| \- \-
programfpga |j| \- \-
resetfpga |j| \- \-
powerchip :py:attr:`Jungfrau.powerchip` \- \-
led |nimp| \- \-
auto_comp_disable |j| \- \-
pulse Used in |epa| OK \-
pulsenmove Used in |epa| OK \-
pulsechip :py:func:`Eiger.pulse_chip` OK \-
checkdetversion |apic| \- \-
checkrecversion |apic| \- \-
moduleversion |m| \- \-
detectornumber :py:attr:`Detector.detector_number` OK \-
modulenumber |m| \- \-
detectorversion :py:attr:`Detector.firmware_version` OK OK
softwareversion :py:attr:`Detector.server_version` \- \-
thisversion :py:attr:`Detector.client_version` Reads date \-
receiverversion :py:attr:`Detector.receiver_version` Reads date \-
timing :py:attr:`Detector.timing_mode` OK \-
exptime :py:attr:`Detector.exposure_time` OK OK
subexptime |sub| OK OK
period :py:attr:`Detector.period` OK OK
subdeadtime :py:attr:`Eiger.sub_deadtime` OK OK
delay :py:attr:`Jungfrau.delay` OK \-
gates :py:attr:`Jungfrau.n_gates` OK \-
frames :py:attr:`Detector.n_frames` OK OK
cycles :py:attr:`Detector.n_cycles` OK \-
probes :py:attr:`Jungfrau.n_probes` OK \-
measurements :py:attr:`Detector.n_measurements` OK \-
samples Chip test board only (new?) \- \-
storagecells :py:attr:`Jungfrau.n_storagecells` OK \-
storagecell_start :py:attr:`Jungfrau.storagecell_start` OK \-
exptimel |mg| \- \-
periodl |mg| \- \-
delayl |mg| \- \-
gatesl |mg| \- \-
framesl |mg| \- \-
cyclesl |mg| \- \-
probesl |mg| \- \-
now |nimp| \- \-
timestamp |m| \- \-
nframes |nimp| \- \-
measuredperiod :py:attr:`Detector.measured_period` OK \-
measuredsubperiod |msp| \- \-
clkdivider :py:attr:`Detector.readout_clock` OK OK
setlength |m| \- \-
waitstates |m| \- \-
totdivider |m| \- \-
totdutycycle |m| \- \-
phasestep |g| \- \-
oversampling |new_chiptest| \- \-
adcclk |new_chiptest| \- \-
adcphase |new_chiptest| \- \-
adcpipeline |new_chiptest| \- \-
dbitclk |new_chiptest| \- \-
dbitphase |new_chiptest| \- \-
dbitpipeline |new_chiptest| \- \-
config :py:func:`Detector.load_config` OK \-
rx_printconfig |nimp| \- \-
parameters :py:func:`Detector.load_parameters` OK \-
setup |nimp| \- \-
flatfield |nimp| \- \-
ffdir |nimp| \- \-
ratecorr :py:attr:`Detector.rate_correction` OK \-
badchannels |nimp| \- \-
angconv |m| \- \-
globaloff |nimp| \- \-
fineoff |nimp| \- \-
binsize |nimp| \- \-
angdir |nimp| \- \-
moveflag |nimp| \- \-
samplex |nimp| \- \-
sampley |nimp| \- \-
threaded :py:attr:`Detector.threaded` OK \-
darkimage |nimp| \- \-
gainimage |nimp| \- \-
settingsdir :py:attr:`Detector.settings_path` OK \-
trimdir |nimp| \- \-
caldir |nimp| \- \-
trimen :py:attr:`Detector.trimmed_energies` OK \-
settings :py:attr:`Detector.settings` OK \-
threshold :py:attr:`Detector.threshold` OK \-
thresholdnotb |nimp| \- \-
trimbits :py:func:`Detector.load_trimbits` OK \-
trim |nimp| \- \-
trimval :py:attr:`Detector.trimbits` OK OK
pedestal |nimp| \- \-
vthreshold :py:attr:`Detector.vthreshold` OK \-
vcalibration |nimp| \- \-
vtrimbit |nimp| \- \-
vpreamp |nimp| \- \-
vshaper1 |nimp| \- \-
vshaper2 |nimp| \- \-
vhighvoltage :py:attr:`Detector.high_voltage` OK \-
vapower |nimp| \- \-
vddpower |nimp| \- \-
vshpower |nimp| \- \-
viopower |nimp| \- \-
vref_ds :py:attr:`Jungfrau.dacs.vref_ds` OK \-
vcascn_pb |nimp| \- \-
vcascp_pb |nimp| \- \-
vout_cm |nimp| \- \-
vcasc_out |nimp| \- \-
vin_cm |nimp| \- \-
vref_comp |nimp| \- \-
ib_test_c |nimp| \- \-
dac0 |nimp| \- \-
dac1 |nimp| \- \-
dac2 |nimp| \- \-
dac3 |nimp| \- \-
dac4 |nimp| \- \-
dac5 |nimp| \- \-
dac6 |nimp| \- \-
dac7 |nimp| \- \-
vsvp :py:attr:`Eiger.dacs.vsvp` OK \-
vsvn :py:attr:`Eiger.dacs.vsvn` OK \-
vtr :py:attr:`Eiger.dacs.vtr` OK \-
vrf :py:attr:`Eiger.dacs.vrf` OK \-
vrs :py:attr:`Eiger.dacs.vrs` OK \-
vtgstv :py:attr:`Eiger.dacs.vtgstv` OK \-
vcmp_ll :py:attr:`Eiger.dacs.vcmp_ll` OK \-
vcmp_ll :py:attr:`Eiger.dacs.vcmp_ll` OK \-
vcall :py:attr:`Eiger.dacs.vcall` OK \-
vcmp_rl :py:attr:`Eiger.dacs.vcmp_rl` OK \-
vcmp_rr :py:attr:`Eiger.dacs.vcmp_rr` OK \-
rxb_rb :py:attr:`Eiger.dacs.rxb_rb` OK \-
rxb_lb :py:attr:`Eiger.dacs.rxb_lb` OK \-
vcp :py:attr:`Eiger.dacs.vcp` OK \-
vcn :py:attr:`Eiger.dacs.vcn` OK \-
vis :py:attr:`Eiger.dacs.vis` OK \-
iodelay :py:attr:`Eiger.dacs.iodelay` OK \-
dac |nimp| \- \-
adcvpp |nimp| \- \-
v_a |nimp| \- \-
v_b |nimp| \- \-
v_c |nimp| \- \-
v_d |nimp| \- \-
v_io |nimp| \- \-
v_chip |nimp| \- \-
v_limit |nimp| \- \-
vIpre |nimp| \- \-
VcdSh |nimp| \- \-
Vth1 |nimp| \- \-
Vth2 |nimp| \- \-
Vth3 |nimp| \- \-
VPL |nimp| \- \-
Vtrim |nimp| \- \-
vIbias |nimp| \- \-
vIinSh |nimp| \- \-
cas |nimp| \- \-
casSh |nimp| \- \-
vIbiasSh |nimp| \- \-
vIcin |nimp| \- \-
vIpreOut |nimp| \- \-
temp_adc |nimp| \- \-
temp_fpga :py:attr:`Detector.temp`.fpga OK \-
temp_fpgaext |temp_fpgaext| OK \-
temp_10ge :py:attr:`Detector.temp`.t10ge OK \-
temp_dcdc :py:attr:`Detector.temp`.dcdc OK \-
temp_sodl :py:attr:`Detector.temp`.sodl OK \-
temp_sodr :py:attr:`Detector.temp`.sodr OK \-
adc |nimp| \- \-
temp_fpgafl :py:attr:`Detector.temp`.fpgafl OK \-
temp_fpgafr :py:attr:`Detector.temp`.fpgafr OK \-
i_a |nimp| \- \-
i_b |nimp| \- \-
i_c |nimp| \- \-
i_d |nimp| \- \-
i_io |nimp| \- \-
vm_a |nimp| \- \-
vm_b |nimp| \- \-
vm_c |nimp| \- \-
vm_d |nimp| \- \-
vm_io |nimp| \- \-
temp_threshold |tempth| \- \-
temp_control |tempco| \- \-
temp_event |tempev| \- \-
outdir :py:attr:`Detector.file_path` OK OK
fname :py:attr:`Detector.file_name` OK OK
index :py:attr:`Detector.file_index` OK OK
enablefwrite :py:attr:`Detector.file_write` OK OK
overwrite :py:attr:`Detector.file_overwrite` OK \-
currentfname |nimp| \- \-
fileformat :py:attr:`Detector.file_format` OK \-
positions |depr| \- \-
startscript |depr| \- \-
startscriptpar |depr| \- \-
stopscript |depr| \- \-
stopscriptpar |depr| \- \-
scriptbefore |depr| \- \-
scriptbeforepar |depr| \- \-
scriptafter |depr| \- \-
scriptafterpar |depr| \- \-
headerafter |depr| \- \-
headerbefore |depr| \- \-
headerbeforepar |depr| \- \-
headerafterpar |depr| \- \-
encallog |depr| \- \-
angcallog |depr| \- \-
scan0script |depr| \- \-
scan0par |depr| \- \-
scan0prec |depr| \- \-
scan0steps |depr| \- \-
scan0range |depr| \- \-
scan1script |depr| \- \-
scan1par |depr| \- \-
scan1prec |depr| \- \-
scan1steps |depr| \- \-
scan1range |depr| \- \-
rx_hostname :py:attr:`Detector.rx_hostname` OK \-
rx_udpip :py:attr:`Detector.rx_udpip` OK \-
rx_udpmac :py:attr:`Detector.rx_udpmac` OK \-
rx_udpport :py:attr:`Detector.rx_udpport` OK \-
rx_udpport2 :py:attr:`Detector.rx_udpport` OK \-
rx_udpsocksize :py:attr:`Detector.rx_udpsocksize` OK \-
rx_realudpsocksize |rudp| OK
detectormac :py:attr:`Detector.detector_mac` OK \-
detectorip :py:attr:`Detector.detector_ip` OK \-
txndelay_left :py:attr:`Eiger.delay`.left OK \-
txndelay_right :py:attr:`Eiger.delay`.right OK \-
txndelay_frame :py:attr:`Eiger.delay`.frame OK \-
flowcontrol_10g :py:attr:`Eiger.flowcontrol_10g` OK \-
zmqport :py:attr:`Detector.client_zmqport` Read \-
rx_zmqport :py:attr:`Detector.rx_zmqport` Read \-
rx_datastream :py:attr:`Detector.rx_datastream` OK \-
zmqip :py:attr:`Detector.client_zmqip` OK \-
rx_zmqip :py:attr:`Detector.rx_zmqip` Read \-
rx_jsonaddheader :py:attr:`Detector.rx_jsonaddheader` OK \-
configuremac :py:attr:`Detector.config_network` OK \-
rx_tcpport :py:attr:`Detector.rx_tcpport`
port |nimp| \- \-
stopport |nimp| \- \-
lock :py:attr:`Detector.lock` OK \-
lastclient :py:attr:`Detector.last_client_ip` OK \-
receiver start :py:func:`Detector.start_receiver` OK \-
receiver stop :py:func:`Detector.stop_receiver` \- \-
r_online |ron| OK \-
r_checkonline |nimp| \- \-
framescaught :py:attr:`Detector.frames_caught` OK \-
resetframescaught |rfc| OK \-
frameindex |rfi| OK \-
r_lock :py:attr:`Detector.lock_receiver` OK \-
r_lastclient |rlci| OK \-
r_readfreq |nimp| \- \-
rx_fifodepth :py:attr:`Detector.rx_fifodepth` OK \-
r_silent |nimp| \- \-
r_framesperfile :py:attr:`Detector.n_frames_per_file` OK \-
r_discardpolicy |fdp| OK \-
r_padding :py:attr:`Detector.file_padding` OK \-
adcinvert |chiptest| \- \-
adcdisable |chiptest| \- \-
pattern |chiptest| \- \-
patword |chiptest| \- \-
patioctrl |chiptest| \- \-
patclkctrl |chiptest| \- \-
patlimits |chiptest| \- \-
patloop0 |chiptest| \- \-
patnloop0 |chiptest| \- \-
patwait0 |chiptest| \- \-
patwaittime0 |chiptest| \- \-
patloop1 |chiptest| \- \-
patnloop1 |chiptest| \- \-
patwait1 |chiptest| \- \-
patwaittime1 |chiptest| \- \-
patloop2 |chiptest| \- \-
patnloop2 |chiptest| \- \-
patwait2 |chiptest| \- \-
patwaittime2 |chiptest| \- \-
dut_clk |chiptest| \- \-
===================== ===================================== ================== =========

View File

@ -1,178 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# sls_detector_tools documentation build configuration file, created by
# sphinx-quickstart on Wed Nov 1 10:17:29 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('..'))
# -- 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.doctest',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'sphinx.ext.todo',
'sphinx.ext.autosummary']
# 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 = 'sls_detector'
copyright = '2019, Sls Detector Group'
author = 'Erik Frojdh'
# 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 = '4.0.1'
# The full version, including alpha/beta/rc tags.
release = '4.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
# 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 = True
# -- 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 = "sphinx_rtd_theme"
# 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']
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# This is required for the alabaster theme
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
html_sidebars = {
'**': [
'about.html',
'navigation.html',
'relations.html', # needs 'show_related': True theme option to display
'searchbox.html',
'donate.html',
]
}
# -- Options for HTMLHelp output ------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'sls_detector_doc'
napoleon_use_ivar = True
# -- 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, 'sls_detector.tex', 'sls_detector Documentation',
'Erik Frojdh', '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, 'sls_detector_tools', 'sls_detector_tools 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, 'py_sls', 'py_sls Documentation',
author, 'py_sls', 'One line description of project.',
'Miscellaneous'),
]

View File

@ -1,12 +0,0 @@
C++ API
=====================================================
.. py:currentmodule:: _slsdet
.. autoclass:: DetectorApi
:members:
:undoc-members:

View File

@ -1,67 +0,0 @@
Error handling
=========================
Check input in Python
----------------------
As far as possible we try to check the input on the Python side
before calling the slsDeteectorsSoftware. Errors should not pass
silently but raise an exception
::
#Trimbit range for Eiger is 0-63
detector.trimbits = 98
(...)
ValueError: Trimbit setting 98 is outside of range:0-63
Errors in slsDetectorsSoftware
-------------------------------
The slsDetectorsSoftware uses a mask to record errors from the different
detectors. If an error is found we raise a RuntimeError at the end of the
call using the error message from slsDetectorsSoftware
.. todo ::
Implement this for all functions
::
detector.settings = 'bananas'
(...)
RuntimeError: Detector 0:
Could not set settings.
Detector 1:
Could not set settings.
Detector 2:
Could not set settings.
Using decorators
-------------------
Using decorators we can reset the error mask before the command and then
check it after the command
.. code-block:: python
#add decorator to check the error mask
@error_handling
def some_function():
a = 1+1
return a
Communication with the detector is usually the biggest overhead so
this does not impact performance.
::
%timeit d.exposure_time
>> 1.52 ms ± 5.42 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
%timeit d.decorated_exposure_time
>> 1.53 ms ± 3.18 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)

View File

@ -1,122 +0,0 @@
Getting started
================
------------------------
Setting up the detector
------------------------
All configuration of the detector can either be done from the Python
API (including loading config file) or externally. The detector setup is
discovered from the shared memory when launching a new script. Because the
detector usually should remain online longer than a specific script it is
recommended to run the receivers seperate.
---------------------------------
Setting and getting attributes
---------------------------------
Most of the detector and software setting are implemented as attributes
in the Detector class. When something is assigned it is also set
in the detector and when the attribute is called using dot notation it
it looked up from the detector.
::
#Currently Eiger and Jungfrau but Detector should work for all
from sls_detector import Eiger()
d = Eiger()
d.file_write = True
d.vthreshold = 1500
d.frame_index
>> 12
d.file_name
>> 'run'
---------------------------------
Working with DACs
---------------------------------
The following examples assumes an Eiger500k detector. But the same syntax
works for other detector sizes and models.
::
d.dacs
>>
========== DACS =========
vsvp : 0, 0
vtr : 4000, 4000
vrf : 2000, 2300
vrs : 1400, 1400
vsvn : 4000, 4000
vtgstv : 2556, 2556
vcmp_ll : 1500, 1500
vcmp_lr : 1500, 1500
vcall : 3500, 3600
vcmp_rl : 1500, 1500
rxb_rb : 1100, 1100
rxb_lb : 1100, 1100
vcmp_rr : 1500, 1500
vcp : 1500, 1500
vcn : 2000, 2000
vis : 1550, 1550
iodelay : 660, 660
#Read dac values to a variable
vrf = d.dacs.vrf[:]
#Set a dac in a module
d.dacs.vrf[0] = 1500
d.dacs.vrf[0]
>> 1500
#Set vrf to the same value in all moduels
d.dacs.vrf = 1500
#Set a dac using an iterable
d.dacs.vrf = [1500, 1600]
d.dacs.vrf
>> vrf : 1500, 1600
#Set dacs iterating on index and values
d.dacs.vrf[0,1] = 1300,1400
---------------------------------
Operating multiple detectors
---------------------------------
Operating multiple detectors is supported by assigning an id when creating the object. If no id is
set it defaults to 0.
::
d0 = Eiger() #id is now 0
d1 = Jungfrau(1)
#Or explicitly
d1 = Jungfrau(id = 0)
The detectors now operate independently of each other but can be synchronized using a hardware trigger.
::
from sls_detector import Eiger
d0 = Eiger(0)
d1 = Eiger(1)
d0.load_config('/some/path/T45.config')
d1.load_config('/some/path/T62.config')
d0.n_frames = 1
d0.exposure_time = 1
d0.timing_mode = 'trigger'
d1.n_frames = 5
d1.exposure_time = 0.2
d1.timing_mode = 'trigger'

View File

@ -1,30 +0,0 @@
sls_detector - Python interface for the slsDetectorsPackage
==============================================================
sls_detector provide Python bindings to the slsDetectorsPackage using mainly the
DetectorImpl API. This module contains two parts, a compiled C module to
expose the API and a Python class to offer a more Pythonic interface.
.. toctree::
:maxdepth: 3
:caption: Contents:
installation
getting_started
code_quality
command_line
examples
error-handling
sls_detector
cpp_api
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

View File

@ -1,90 +0,0 @@
Installation
=========================
The easiest way to install the Python API and the slsDetectorPackage is using conda. But other
methods are also available.
---------------------
Install using conda
---------------------
If you don't have it installed get the latest version of `Miniconda`_
.. _Miniconda: https://conda.io/miniconda.html
::
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
sh Miniconda3-latest-Linux-x86_64.sh
Install sls_detector and sls_detector_lib using:
::
#Add conda channels
conda config --add channels conda-forge
conda config --add channels slsdetectorgroup
#Install latest version
conda install sls_detector
#Install specific version
conda install sls_detector=3.0.1
------------------------------
Local build using conda-build
------------------------------
Needs the `sls_detector_lib`_ installed in order to automatically find headers
and shared libraries. Make sure that the branch of sls_detector matches the lib
version installed.
.. _sls_detector_lib: https://github.com/slsdetectorgroup/sls_detector_lib
::
#Clone source code
git clone https://github.com/slsdetectorgroup/sls_detector.git
#Checkout the branch needed
git checkout 3.0.1
#Build and install the local version
conda-build sls_detector
conda install --use-local sls_detector
-----------------------
Developer build
-----------------------
IF you if you are developing and are making constant changes to the code it's a bit cumbersome
to build with conda and install. Then an easier way is to build the C/C++ parts in the package
directory and temporary add this to the path
::
#in path/to/sls_detector
python setup.py build_ext --inplace
Then in your Python script
::
import sys
sys.path.append('/path/to/sls_detector')
from sls_detector import Detector
--------------
Prerequisites
--------------
All dependencies are manged trough conda but for a stand alone build you would need
* gcc 4.8+
* Qwt 6
* Qt 4.8
* numpy
* slsDetectorPackage

View File

@ -1,6 +0,0 @@
make clean
make html
rm -rf ../docs/
mv _build/html/ ../docs/
touch ../docs/.nojekyll
rm -rf _build

View File

@ -1,8 +0,0 @@
sls_detector
==================
.. toctree::
:maxdepth: 4
sls_detector

View File

@ -1,33 +0,0 @@
Python classes
=====================================================
.. py:currentmodule:: sls_detector
Detector
----------
.. autoclass:: Detector
:members:
:undoc-members:
:show-inheritance:
Eiger
-------
.. autoclass:: Eiger
:members:
:undoc-members:
:show-inheritance:
Jungfrau
----------
.. autoclass:: Jungfrau
:members:
:undoc-members:
:show-inheritance: