Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Code Block
import pycdb

def upgradeIpimbConfig(cfg):
    dat = cfg.get()          # retrieve the contents in a Python dictionary object
    dat['trigPsDelay'] = 0   # reset the presampling delay
    cfg.set(dat)             # store the change

if __name__ == "__main__":
    db = pycdb.Db('/reg/g/pcds/dist/pds/xpp/configdb/current') # set the target database
    xtclist = db.get(alias="BEAM",typeid=0x100170x20017)              # retrieve all IPIMB configurations for BEAM runs (0x10x2 = version, 0x0017 = IPIMB)
    for x in xtclist:                                          # loop over the retrieved configurations
        upgradeIpimbConfig(x)                                  # modify the configuration
        db.set(x,"BEAM",x)                                       # write the configuration back to the database
    db.commit()                                                # update the database with the changes

...

Code Block
 --- pycdb module ---

class pycdb.Db(path)

        Initializes access to the configuration database residing at 'path'.

Members:

        get(key=<Integer> or alias=<string>,
            src=<Integer> or level=<Integer>, typeid=<Integer>) or
        get(key=<Integer> or alias=<string>,
            typeid=<Integer>)
                Returns a tuple of configuration datum which satisfies the
                search criteria.  The search criteria is composed of either
                a particular database key number (integer) or alias name
                (for example, "BEAM"), an integer detector id 'src' or level
                (for example, 0=control), and an integer typeid
                (for example, 0x00050008 = Evr configuration version 5).
                The Python type of each returned object is specific to the
                datum returned { pycdb.DiodeFexConfig, pycdb.CspadConfig, ... }.

        set(aliasdatum, datumalias)
                Inserts the configuration 'datum' into the database for the
                global entry 'alias' (for example, "BEAM").

        commit()
                Updates all current run keys with the data inserted via calls to 'set'.

        clone(key)
                Returns a new database key created as a copy of the existing key 'key'.
                The returned key is suitable for modifying via calls to 'substitute'.

        substitute(key, datum)
                Insert the configuration 'datum' only for the given database 'key'.

...

Code Block
 --- pydaq module ---

class pydaq.Control(host, platform=0)

    Arguments:
        'host'     : host name or IP address (dotted-string notation or integer)
        'platform' : DAQ platform number (subdivision of readout hardware)

    Function:
        Initializes the interface for controlling the data acquisition system remotely.
        Creates a connection with the local control and queries the configuration
        database and current key in use.

Members:

    Control.dbpath()
        Returns path to configuration database

    Control.dbkey()
        Returns current configuration key (integer) in use

    Control.dbalias()
        Returns current configuration alias (string) in use

    Control.partition()
        Returns a list of dictionary objects describing all nodes in the DAQ readout.

    Control.configure(record=<Bool>,
                key=<Integer>,
              events=<Integer> or l1t_events=<Integer> or l3t_events=<Integer> or duration=[seconds,nanoseconds],
              controls=[(name,value)],
              monitors=[(name,lo_range,hi_range)],
              partition=[()])
        Configures control to use database key (default to current key) either:
          (1) collecting a fixed number of events on each cycle (when events=<Integer>
              or l1t_events=<Integer> is specified) or
          (2) collecting events until a fixed number of events have been accepted by
              the level3 filter (when l3t_events=<Integer>) or
          (2) collecting events for a fixed duration (when duration=[seconds,nanoseconds]
              is specified).  
        The list of variables controlled (optional) in the scan and
        the list of variables to be monitored (optional) during acquisition
        are specified.
        The option to record can also be set.  If it is omitted, then the value from
        the local control is used.

    Control.begin(events=<Integer> or l1t_events=<Integer> or l3t_events=<Integer> or duration=[seconds,nanoseconds],
              controls=[(name,value)],)
              monitors=[(name,lo_range,hi_range)])
        Begins acquisition for the specified settings of control variables (if specified).
        Actual control of these variables is the responsibility of the remote application.  
        Monitor variables (optional) are enforced during acquisition.  Omitted values
        default to those specified most recently (or in the 'configure' method).

    Control.end()
        Waits for the end of acquisition cycle signalled from the local host control.

    Control.stop()
        Signals the local host control to terminate the current acquisition cycle        A modified list of objects from the Control.partition() call may be given for the partition argument to
        select only a subset of detectors for readout or recording by changing the values of the 'Readout' or 'Record'
		dictionary entries.  If this argument is omitted, the partition is readout and recorded as initially configured.

    Control.begin(events=<Integer> or l1t_events=<Integer> or l3t_events=<Integer> or duration=[seconds,nanoseconds],
              controls=[(name,value)],)
              monitors=[(name,lo_range,hi_range)])
        Begins acquisition for the specified settings of control variables (if specified).
        Actual control of these variables is the responsibility of the remote application.  
        Monitor variables (optional) are enforced during acquisition.  Omitted values
        default to those specified most recently (or in the 'configure' method).

    Control.end()
        Waits for the end of acquisition cycle signalled from the local host control.
		
    Control.stop()
        Signals the local host control to terminate the current acquisition cycle.
		This method can be used to prematurely end a scan without closing the connection or reconfiguring.  
		The KeyboardInterrupt(SIGINT) signal handler can be reimplemented to call this method, which will
		result in the scan ending and a python ValueError exception being raised.

    Control.eventnum()
        Returns the number of events acquired in the current acquisition run.

    Control.experiment()
        Returns experiment number of run, if recorded.  
        Only valid after acquisition is complete.

    Control.runnumber()
        Returns run number, if recorded.  
        Only valid after acquisition is complete.

...