Commit 406cdd5c authored by Valentin Valls's avatar Valentin Valls
Browse files

Code block

parent 59876b10
......@@ -118,40 +118,43 @@ class Session:
Sessions group objects with a setup.
YAML file example:
- plugin: session # could be defined in parents
class: Session
name: super_mario # session name
# 'config-objects' contains
# object name you want to export
# either in yaml compact list
config-objects: [seby,diode2]
# or standard yaml list
config-objects:
- seby
- diode2
# if config-objects key doesn't exist,
# session will export all objects;
# 'exclude-objects' can be used to exclude objects
exclude-objects: [seby]
# you can also include other session
# with the 'include-sessions'
include-sessions: [luigi]
# finally a setup file can be defined to be
# executed for the session.
# All objects or functions defined in the
# setup file will be exported in the environment.
# The file path is relative to the session yaml file
# location if it starts with a './'
# otherwise it is absolute from the root of the
# beacon file data base.
setup-file: ./super_mario.py
# A svg synoptic (Web shell) can be added:
synoptic:
svg-file: super_mario.svg
.. code-block::
- plugin: session # could be defined in parents
class: Session
name: super_mario # session name
# 'config-objects' contains
# object name you want to export
# either in yaml compact list
config-objects: [seby,diode2]
# or standard yaml list
config-objects:
- seby
- diode2
# if config-objects key doesn't exist,
# session will export all objects;
# 'exclude-objects' can be used to exclude objects
exclude-objects: [seby]
# you can also include other session
# with the 'include-sessions'
include-sessions: [luigi]
# finally a setup file can be defined to be
# executed for the session.
# All objects or functions defined in the
# setup file will be exported in the environment.
# The file path is relative to the session yaml file
# location if it starts with a './'
# otherwise it is absolute from the root of the
# beacon file data base.
setup-file: ./super_mario.py
# A svg synoptic (Web shell) can be added:
synoptic:
svg-file: super_mario.svg
"""
def __init__(self, name, config_tree):
......
......@@ -146,21 +146,23 @@ def iter_axes_position(*axes, **kwargs):
Args:
axis (~bliss.common.axis.Axis): motor axis
example:
DEMO [18]: wm(m2, m1, m3)
m2 m1[mm] m3
------- ---------- ---------- -------
User
High -123.00000 128.00000 inf
Current -12.00000 7.00000 3.00000
Low 456.00000 -451.00000 -inf
Offset 0.00000 3.00000 0.00000
Dial
High 123.00000 123.00000 inf
Current 12.00000 2.00000 3.00000
Low -456.00000 -456.00000 -inf
Example:
.. code-block::
DEMO [18]: wm(m2, m1, m3)
m2 m1[mm] m3
------- ---------- ---------- -------
User
High -123.00000 128.00000 inf
Current -12.00000 7.00000 3.00000
Low 456.00000 -451.00000 -inf
Offset 0.00000 3.00000 0.00000
Dial
High 123.00000 123.00000 inf
Current 12.00000 2.00000 3.00000
Low -456.00000 -456.00000 -inf
"""
if not axes:
raise RuntimeError("need at least one axis name/object")
......@@ -372,9 +374,12 @@ def rockit(motor, total_move):
"""
Rock an axis from it's current position +/- total_move/2.
Usage example:
with rockit(mot1, 10):
ascan(mot2,-1,1,10,0.1,diode)
amesh(....)
.. code-block:: python
with rockit(mot1, 10):
ascan(mot2,-1,1,10,0.1,diode)
amesh(....)
"""
if motor.is_moving:
raise RuntimeError(f"Motor {motor.name} is moving")
......
......@@ -119,9 +119,14 @@ def flatten(items):
def merge(items):
"""merge a list of list, first level only
e.g. merge([ [1,2], [3] ]) -> [1,2,3]
merge([ [1,2], [[3,4]], [5] ]) -> [1,2,[3,4],5]
"""Merge a list of list, first level only
Example:
.. code-block:
merge([ [1,2], [3] ]) -> [1,2,3]
merge([ [1,2], [[3,4]], [5] ]) -> [1,2,[3,4],5]
"""
return [item for sublist in items for item in sublist]
......@@ -906,10 +911,14 @@ def typeguardTypeError_to_hint(function):
def typecheck_var_args_pattern(args_pattern, empty_var_pos_args_allowed=False):
"""decorator that can be used for typechecking of *args that have to follow a certain pattern e.g.
@typecheck_var_args_pattern([_scannable,_float])
def umv(*args):
...
"""Decorator that can be used for typechecking of `*args` that have to
follow a certain pattern e.g.
.. code-block::
@typecheck_var_args_pattern([_scannable,_float])
def umv(*args):
...
"""
def decorate(function):
......@@ -940,10 +949,13 @@ def typecheck_var_args_pattern(args_pattern, empty_var_pos_args_allowed=False):
def modify_annotations(annotations):
"""Modify the annotation in an existing signature
@modify_annotations({"args": "motor1, rel. pos1, motor2, rel. pos2, ..."})
def umvr(*args):
...
"""Modify the annotation in an existing signature.
.. code-block: python
@modify_annotations({"args": "motor1, rel. pos1, motor2, rel. pos2, ..."})
def umvr(*args):
...
"""
def decorate(function):
......
......@@ -1541,25 +1541,27 @@ class ParametersWardrobe(metaclass=ParametersType):
def to_beacon(self, name: str, *instances):
"""
Export one or more instance to Beacon.
It will save the Wardrobe under Beacon subfolder /wardrobe/
It will save the Wardrobe under Beacon subfolder `/wardrobe/`
Args:
name: name of the file (will be saved with .dat extension)
instances: arguments passed as comma separated
Example:
>>>materials = ParametersWardrobe("materials")
>>>materials.switch('copper')
>>># exporting current instance
>>>materials.to_beacon('2019-06-23-materials')
.. code-block:: python
>>># exporting a instance giving the name
>>>materials.to_beacon('2019-06-23-materials', 'copper')
materials = ParametersWardrobe("materials")
materials.switch('copper')
>>># exporting all instances
>>>materials.to_beacon('2019-06-23-materials', *materials.instances) # uses python list unpacking
# exporting current instance
materials.to_beacon('2019-06-23-materials')
# exporting a instance giving the name
materials.to_beacon('2019-06-23-materials', 'copper')
# exporting all instances
materials.to_beacon('2019-06-23-materials', *materials.instances) # uses python list unpacking
"""
if re.match("[A-Za-z_]+[A-Za-z0-9_-]*", name) is None:
raise NameError(
......
......@@ -20,43 +20,43 @@ from bliss.scanning.acquisition.counter import SamplingCounterAcquisitionSlave
from bliss.flint.client.live_plots import LiveImagePlot
"""
# EBV mockup
- controller: EBV
plugin: bliss
name: bv1
class: EBV
wago_controller: $ebv_wago_simulator
single_model: False
has_foil: False
channel: 0
counter_name: ebv_diode
camera_tango_url: id00/limaccds/simulator2
- name: ebv_wago_simulator
plugin: bliss
module: wago.wago
class: WagoMockup
modbustcp:
url: localhost
ignore_missing: True
mapping:
- type: 750-436
logical_names: status,status,status,status
- type: 750-530
logical_names: screen,screen,led,led,gain,gain,gain,gain
- type: 750-530
logical_names: _,_,_,_,_,_,_,_
- type: 750-479
logical_names: current
- name: mybpm
plugin: bliss
module: ebv
class: BpmController
camera_tango_url: idxx/limaccds/camname
.. code-block::
# EBV mockup
- controller: EBV
plugin: bliss
name: bv1
class: EBV
wago_controller: $ebv_wago_simulator
single_model: False
has_foil: False
channel: 0
counter_name: ebv_diode
camera_tango_url: id00/limaccds/simulator2
- name: ebv_wago_simulator
plugin: bliss
module: wago.wago
class: WagoMockup
modbustcp:
url: localhost
ignore_missing: True
mapping:
- type: 750-436
logical_names: status,status,status,status
- type: 750-530
logical_names: screen,screen,led,led,gain,gain,gain,gain
- type: 750-530
logical_names: _,_,_,_,_,_,_,_
- type: 750-479
logical_names: current
- name: mybpm
plugin: bliss
module: ebv
class: BpmController
camera_tango_url: idxx/limaccds/camname
"""
......
......@@ -22,13 +22,14 @@ Example YAML_ configuration:
- counter_name: e2
channel: 2
Usage::
Usage:
>>> from bliss.config.static import get_config
>>> from bliss.controllers.EMH import ...
>>> config = get_config()
.. code-block:: python
>>> em.test_hw()
from bliss.config.static import get_config
from bliss.controllers.EMH import ...
config = get_config()
em.test_hw()
"""
......
......@@ -67,9 +67,14 @@ The following sensor parameters are stored as settings:
A demo is available from the command line:
$ python -m bliss.controllers.keithley <url> <pad>
.. code-block:: python
python -m bliss.controllers.keithley <url> <pad>
Developer details:
.. code-block::
READ? <=> INIT + FETCH?
MEASURE[:<function>]? <=> CONF[:<function>] + READ? == CONF[:<function>] + INIT + READ?
"""
......
......@@ -9,15 +9,19 @@
Monochromatic attenuators, controlled via wago - pneumatic actuators and ADC.
yml configuration example:
name: matt
class: matt
controller_ip: wcid29a
nb_filter: 12
att_type: 2
control_module: "750-516"
.. code-block::
name: matt
class: matt
controller_ip: wcid29a
nb_filter: 12
att_type: 2
control_module: "750-516"
The filters are controlled pneumatically via WAGO output modules.
The position is red from WAGO modules, in a different way, depending
on the mechanics (4 types - 0 to 3).
The input and output modules are next to each other, so ther should
......
......@@ -15,23 +15,26 @@ Before sending a set command, the key to be turned off, and back to on after
executing the command.
Example yml file:
class: Mcce
channels:
-
name: mcce_ch1
address: 1
serial:
url: "rfc2217://ld231:28100"
-
name: mcce_ch2
address: 2
serial:
url: "rfc2217://ld231:28016"
-
name: mcce_ch3
address: 3
serial:
url: "rfc2217://ld231:28017"
.. code-block::
class: Mcce
channels:
-
name: mcce_ch1
address: 1
serial:
url: "rfc2217://ld231:28100"
-
name: mcce_ch2
address: 2
serial:
url: "rfc2217://ld231:28016"
-
name: mcce_ch3
address: 3
serial:
url: "rfc2217://ld231:28017"
"""
import enum
import tabulate
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment