Differences between revisions 7 and 8
Revision 7 as of 2019-04-24 15:51:23
Size: 1553
Editor: MarkBarton
Comment:
Revision 8 as of 2019-04-26 20:40:56
Size: 3784
Editor: MarkBarton
Comment:
Deletions are marked like this. Additions are marked like this.
Line 7: Line 7:
 * [[#CLI|As a command line utility]].
Line 10: Line 9:
 * [[#CLI|As a command line utility]].
Line 11: Line 11:

<<Anchor(CLI)>>
== vistools.py as a command-line utility ==
Line 17: Line 14:

`vistools.py` is primarily an ordinary Python module which provides the class `Vis`. Each instance of `Vis` represents a single suspension and can be created with any of the following forms:
{{{
BS = vistools.Vis('BS') # an Ezca instance with prefix 'K1:' is created internally
BS = vistools.Vis('VIS-BS') # channel name prefix style
BS = vistools.Vis('VIS_BS') # Guardian file name style
BS = vistools.Vis(('BS',ezca)) # ezca should be an existing ezca.Ezca instance with prefix 'K1:'; 'BS' can be 'VIS-BS' or 'VIS_BS'
}}}

A `Vis` object has a large number of methods which are mostly organized and named by blocks of filters of the same function (e.g., DAMP) at different levels of the suspension:
{{{
BS.masterSwitchWrite('ON') # turns the master switch on
BS.dampGainWrite(1.0) # sets all gain values in all DAMP blocks to 1.0.
BS.dampGainWrite(1.0,levels=['IP']) # sets all gain values in the IP DAMP block to 1.0.
BS.dampGainWrite(1.0,levels=['IP'],chans=['L','T']) # sets the gain values for the L and T channels of the IP DAMP block to 1.0
}}}
Do `dir(vistools.Vis)` for a complete listing and `help(vistools.Vis.methodName)` for more details on individual methods. A typical signature is `dampGainWrite([self,] value, levels=[], chans=[], verbose=False, pair='none', withprefix='bare', matlab=False, dorw=2)`. The arguments are as follows:
 * `value`: a value or list of values to be written (write methods only)
 * `levels`: a list of levels to restrict the request or change the default order, e.g, `['IP','F0','F1','BF']
 * `chans`: a list of channels within a block to restrict the request or change the default order, e.g., `['L','T']` for IP DAMP.
 * `verbose`: if `True`, bring debugging information, typically the channel names written to
 * `withprefix`: can be `'full'`, `'half full'`, `'half bare'` or `'bare'`; selects how much of the PV name to return (see next argument)
 * `pair`: can be `'pv'`, `'both'` or `'value'`; selects whether to return the channel name along with the read/written value
 * `matlab`: if `True`, returns lists with Matlab-style syntax
 * `dorw`: 0 -> no live channel access; 1 -> no live write channel access (read only); 2 -> live reading and writing
Line 32: Line 54:

<<Anchor(CLI)>>
== vistools.py as a command-line utility ==

KAGRA VIS Operations Manual - vistools.py

vistools.py is a Python module and command-line utility for manipulating the suspensions. It lives in /opt/rtcds/userapps/release/vis/k1/scripts (although it may get moved to /opt/rtcds/userapps/release/vis/common/scripts and there is a symlink to it in /opt/rtcds/userapps/release/vis/k1/guardian. Nearby there may be a test version vistoolstest.py.

vistools.py has three modes of use:

vistools.py as a Python module

vistools.py is primarily an ordinary Python module which provides the class Vis. Each instance of Vis represents a single suspension and can be created with any of the following forms:

BS = vistools.Vis('BS') # an Ezca instance with prefix 'K1:' is created internally
BS = vistools.Vis('VIS-BS') # channel name prefix style
BS = vistools.Vis('VIS_BS') # Guardian file name style
BS = vistools.Vis(('BS',ezca)) # ezca should be an existing ezca.Ezca instance with prefix 'K1:'; 'BS' can be 'VIS-BS' or 'VIS_BS'

A Vis object has a large number of methods which are mostly organized and named by blocks of filters of the same function (e.g., DAMP) at different levels of the suspension:

BS.masterSwitchWrite('ON') # turns the master switch on
BS.dampGainWrite(1.0) # sets all gain values in all DAMP blocks to 1.0. 
BS.dampGainWrite(1.0,levels=['IP']) # sets all gain values in the IP DAMP block to 1.0.  
BS.dampGainWrite(1.0,levels=['IP'],chans=['L','T']) # sets the gain values for the L and T channels of the IP DAMP block to 1.0 

Do dir(vistools.Vis) for a complete listing and help(vistools.Vis.methodName) for more details on individual methods. A typical signature is dampGainWrite([self,] value, levels=[], chans=[], verbose=False, pair='none', withprefix='bare', matlab=False, dorw=2). The arguments are as follows:

  • value: a value or list of values to be written (write methods only)

  • levels: a list of levels to restrict the request or change the default order, e.g, `['IP','F0','F1','BF']

  • chans: a list of channels within a block to restrict the request or change the default order, e.g., ['L','T'] for IP DAMP.

  • verbose: if True, bring debugging information, typically the channel names written to

  • withprefix: can be 'full', 'half full', 'half bare' or 'bare'; selects how much of the PV name to return (see next argument)

  • pair: can be 'pv', 'both' or 'value'; selects whether to return the channel name along with the read/written value

  • matlab: if True, returns lists with Matlab-style syntax

  • dorw: 0 -> no live channel access; 1 -> no live write channel access (read only); 2 -> live reading and writing

vistools.py from within Guardian

The usage from within Guardian is a bit complicated. According to some versions of the Guardian documentation, there is supposed to be a global Ezca instance called ezca which can be used for channel access. And according to some versions of the documentation, it is supposed to have prefix K1:VIS_BS_ or the like (which gets prepended to channel name fragments passed to it). If you run the Guardian in interactive mode, e.g.,

guardian -i VIS_BS

then there is indeed a global ezca object, but it has prefix just K1:, so the appropriate setup is

vis=vistools.Vis((SYSTEM,ezca))
  • because (i) there is already one the ezca object used to communicate with EPICS has been changed to being

attachment:Gedit Setup.png

vistools.py as a command-line utility

KAGRA/Subgroups/VIS/OpsManual/vistools (last edited 2019-05-15 20:46:07 by MarkBarton)