Commit 95ca0754 authored by Valentin Valls's avatar Valentin Valls
Browse files

Use code block

parent 2bd83550
......@@ -137,17 +137,19 @@ def all_equal(iterable):
def split_keys_to_tree(dico, separator):
""" Takes a dict, iterate over keys and split the key around 'separator' into tags.
Then creates a nested dict (like a tree) where each tag is a node.
example: with dico = {'A_B_C':1, 'A_B_D':2} and separator = '_'
returns {'A':
{'B':
{'C':1, 'D':2},
},
}
"""
"""Takes a dict, iterate over keys and split the key around 'separator'
into tags.
Then creates a nested dict (like a tree) where each tag is a node.
Example:
.. code-block:: python
dico = {'A_B_C':1, 'A_B_D':2}
result = split_keys_to_tree(dico, '_')
assert result == {'A': {'B': {'C':1, 'D':2},},}
"""
tree = {}
for k, v in dico.items():
......
......@@ -1064,7 +1064,11 @@ class bcolors:
class Switch(BaseSwitch):
"""
Switch for PI_E712 Analog and piezo amplifier Outputs
Basic configuration:
.. code-block::
name: pi_switch0
output-channel: 5 # 5 (first analogue output) 1 (first piezo amplifier)
output-type: POSITION # POSITION (default) or CONTROL_VOLTAGE
......
......@@ -25,7 +25,10 @@ All distances and motor positions are in mm
8 id21 kb|zpz support.
Example configuration
Example configuration:
.. code-block::
controller:
class: tab3
d1: 660
......
......@@ -11,61 +11,65 @@ Example YAML_ configuration:
1. Attenuator with 3 predefined positions, moving 1 motor (dummy1)
class: MultiplePositions
name: att1
positions:
- label: Al3
description: Aluminum 3 mm
target:
- axis: $dummy1
destination: 2.5
tolerance: 0.01
- label: Cu2
description: Copper 2 mm
target:
- axis: $dummy1
destination: 2.0
tolerance: 0.2
- label: Al4
description: Aluminum 4 mm
target:
- axis: $dummy1
destination: 3.5
tolerance: 0.01
.. code-block::
class: MultiplePositions
name: att1
positions:
- label: Al3
description: Aluminum 3 mm
target:
- axis: $dummy1
destination: 2.5
tolerance: 0.01
- label: Cu2
description: Copper 2 mm
target:
- axis: $dummy1
destination: 2.0
tolerance: 0.2
- label: Al4
description: Aluminum 4 mm
target:
- axis: $dummy1
destination: 3.5
tolerance: 0.01
2. Beamstop with 3 predefined positions, moving 2 motors at the same time
class: MultiplePositions
name: beamstop
simultaneous_move: True
positions:
- label: IN
description: Beamstop position IN the beam
target:
- axis: $dummy1
destination: 2.5
tolerance: 0.01
- axis: $dummy2
destination: 1.0
tolerance: 0.2
- label: OUT
description: Beamstop position OUT of the beam
target:
- axis: $dummy1
destination: 3.5
tolerance: 0.01
- axis: $dummy2
destination: 2.0
tolerance: 0.2
- label: PARK
description: Beamstop in safe position
target:
- axis: $dummy1
destination: 1.5
tolerance: 0.01
- axis: $dummy2
destination: 0.0
tolerance: 0.2
.. code-block::
class: MultiplePositions
name: beamstop
simultaneous_move: True
positions:
- label: IN
description: Beamstop position IN the beam
target:
- axis: $dummy1
destination: 2.5
tolerance: 0.01
- axis: $dummy2
destination: 1.0
tolerance: 0.2
- label: OUT
description: Beamstop position OUT of the beam
target:
- axis: $dummy1
destination: 3.5
tolerance: 0.01
- axis: $dummy2
destination: 2.0
tolerance: 0.2
- label: PARK
description: Beamstop in safe position
target:
- axis: $dummy1
destination: 1.5
tolerance: 0.01
- axis: $dummy2
destination: 0.0
tolerance: 0.2
"""
import functools
......
......@@ -834,17 +834,21 @@ class musst:
class Switch(BaseSwitch):
"""
This class wrapped musst command to emulate a switch.
the configuration may look like this:
musst: $musst_name
states:
- label: OPEN
set_cmd: "#BTRIG 1"
test_cmd: "?BTRIG"
test_cmd_reply: "1"
- label: CLOSED
set_cmd: "#BTRIG 0"
test_cmd: "?BTRIG"
test_cmd_reply: "0"
The configuration may look like this:
.. code-block::
musst: $musst_name
states:
- label: OPEN
set_cmd: "#BTRIG 1"
test_cmd: "?BTRIG"
test_cmd_reply: "1"
- label: CLOSED
set_cmd: "#BTRIG 0"
test_cmd: "?BTRIG"
test_cmd_reply: "0"
"""
def __init__(self, name, config):
......
......@@ -259,21 +259,25 @@ class Opiom:
class Switch(BaseSwitch):
"""
This class wrapped opiom command to emulate a switch
the configuration may look like this:
opiom: $opiom_name
register: IMA
mask: 0x3
shift: 1
states:
- label: OPEN
value: 1
- label: CLOSED
value: 0
- label: MUSST
value: 2
- label: COUNTER_CARD
value: 3
This class wrapped opiom command to emulate a switch.
The configuration may look like this:
.. code-block::
opiom: $opiom_name
register: IMA
mask: 0x3
shift: 1
states:
- label: OPEN
value: 1
- label: CLOSED
value: 0
- label: MUSST
value: 2
- label: COUNTER_CARD
value: 3
"""
def __init__(self, name, config):
......
......@@ -61,6 +61,8 @@ def idint_to_float(value, integer=40, decimal=8):
Trick: the missing sign bits can be padded using
the following formula:
.. code-block::
value |= -2 * mask(value, sign_bit)
Load data:
......
......@@ -13,6 +13,7 @@ Class to be inherited by regulation controllers
Example of .yml file for a mockup temperature controller
with the mandatory fields:
.. code-block::
class: Mockup
module: temperature.mockup
......
......@@ -2,15 +2,18 @@
Rontec MCA, acessible via serial line
yml configuration example:
name: mca
class: rontec
serial:
url: "rfc2217://lid30b2:28010" #serial line name
calib_c: [-0.40290063, 0.0050059618, 0] #calibration coefficients
or
calib_file: rontec calibration file, formated as:
# calibration coefficients
0 0.00410435 1.2e-9
.. code-block::
name: mca
class: rontec
serial:
url: "rfc2217://lid30b2:28010" #serial line name
calib_c: [-0.40290063, 0.0050059618, 0] #calibration coefficients
or
calib_file: rontec calibration file, formated as:
# calibration coefficients
0 0.00410435 1.2e-9
"""
import math
import time
......
......@@ -550,11 +550,13 @@ class FixedShapeCounter:
class AutoFilterDetMon:
"""Simulated monitor (flat signal) and detector counter with
has a gaussian shape with maximum `monitor * transmission`.
has a gaussian shape with maximum :code:`monitor * transmission`.
The predefined peak shape can be obtained by scanning the
associated software axis from 0 to 1:
.. code-block:: python
s = self.auto_filter.ascan(self.axis, 0, 1, self.npoints, expo, *self.detectors)
"""
......
......@@ -10,18 +10,21 @@ Tango shutter is used to control frontend or safety shutter or a valve.
Some commands/attributes (like automatic/manual) are only implemented in the
front end device server, set by the _frontend variable.
example yml file:
-
# front end shutter
class: TangoShutter
name: frontend
uri: //orion:10000/fe/master/id30
-
# safety shutter
class: TangoShutter
name: safshut
uri: id30/bsh/1
Example yml file:
.. code-block::
-
# front end shutter
class: TangoShutter
name: frontend
uri: //orion:10000/fe/master/id30
-
# safety shutter
class: TangoShutter
name: safshut
uri: id30/bsh/1
"""
from enum import Enum
......@@ -132,7 +135,8 @@ class TangoShutter(BaseShutter):
@property
def state_string(self):
"""Return state as combined string
"""Return state as combined string.
Returns
(tuple): state as string, tango status
"""
......
......@@ -7,6 +7,8 @@
"""
Usage:
.. code-block::
timing_info = {'cycles': 1,
'framesets': [{'nb_frames': 30,
'latency': 0.0000001,
......
......@@ -13,24 +13,26 @@ Class to be inherited by temperature controllers
Example of .yml file for a mockup temperature controller
with the mandatory fields:
controller:
class: mockup <- mandatory
host: lid269
inputs:
-
name: thermo_sample <- mandatory
outputs:
-
name: heater <- mandatory
low_limit: 10 <- recommended (default: None)
high_limit: 200 <- recommended (default: None)
deadband: 0.1 <- recommended (default: None)
ctrl_loops:
-
name: sample_regulation <- mandatory
input: $thermo_sample <- mandatory
output: $heater <- mandatory
.. code-block::
controller:
class: mockup <- mandatory
host: lid269
inputs:
-
name: thermo_sample <- mandatory
outputs:
-
name: heater <- mandatory
low_limit: 10 <- recommended (default: None)
high_limit: 200 <- recommended (default: None)
deadband: 0.1 <- recommended (default: None)
ctrl_loops:
-
name: sample_regulation <- mandatory
input: $thermo_sample <- mandatory
output: $heater <- mandatory
"""
import itertools
from gevent import lock
......
......@@ -9,25 +9,27 @@
Eurothers 2000 Series Cryostream, acessible via serial line
yml configuration example:
plugin: temperature
class: eurotherm2000
serial:
url: rfc2217://lid30b2:28003 #serial line name
outputs:
-
name: heatblower
type: sp
unit: deg
low_limit: 10
high_limit: 30
deadband: 0.1
tango_server: euro2400_ss
inputs:
-
name: T1
type: pv
#tango_server: euro2400_ss
.. code-block::
plugin: temperature
class: eurotherm2000
serial:
url: rfc2217://lid30b2:28003 #serial line name
outputs:
-
name: heatblower
type: sp
unit: deg
low_limit: 10
high_limit: 30
deadband: 0.1
tango_server: euro2400_ss
inputs:
-
name: T1
type: pv
#tango_server: euro2400_ss
"""
import logging
from collections import namedtuple
......@@ -342,7 +344,8 @@ class Eurotherm2000Device:
return self.SensorTypes[sensor]
def prog_status(self):
"""Read the setpoint status
"""Read the setpoint status.
Returns:
(int): 0 - ready
1 - wsp != sp so running
......
......@@ -11,15 +11,18 @@ PACE (Pressure Automated Calibration Equipmet) , acessible via tcp sockets
Only one channel to control
yml configuration example:
controller:
class: pace
url: 'id29pace1:5025' #host:port
outputs:
- name: pmbpress
low_limit: 0
high_limit: 2.1
default_unit: 'BAR'
channel: 1 # for 6000 only
.. code-block::
controller:
class: pace
url: 'id29pace1:5025' #host:port
outputs:
- name: pmbpress
low_limit: 0
high_limit: 2.1
default_unit: 'BAR'
channel: 1 # for 6000 only
"""
# temperature controller
from bliss.controllers.temp import Controller
......
......@@ -286,7 +286,11 @@ cfgarr = {"filename": None}
def interlock_parse_relay_line(line):
"""
Syntax:
.. code-block::
relay <outrelay1> {<iflag> ... } [name <name_string>]
Notes:
- <outrelay> must be a digital output channel
- Instance flags (<iflag>): inverted, sticky, noforce
......@@ -317,9 +321,12 @@ ParsedChannelLine = namedtuple(
def interlock_parse_channel_line(line):
"""
Syntax:
.. code-block::
<chan1> <type> [<min> <max>] {<chflag> ... }
<chan2> <type> [<min> <max>] {<chflag> ... }
...
...
<chanN> <type> [<min> <max>] {<chflag> ... }
Notes:
......
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