Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: updated pycdb example to reflect current interface

...

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

...