Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="203938d27939788c-7c899238-45ea4f39-ba19b938-aaa40171a9c0fb0fcb87ca40"><ac:plain-text-body><![CDATA[

self.configBool(param_name[,default])

returns value of parameter as a boolean value, strings "yes", "true", "True", "on", "1" represent true value, strings "no", "false", "False", "off", "0" represent false value, any other string will raise exception. If parameter is not defined in a file then default value is returned without conversion, if default value was not given then exception is raised.

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="52c42994232e38c4-6267f718-4fcf42c0-8d37bb60-acf06a5d43fa3d89ddb43eb9"><ac:plain-text-body><![CDATA[

self.configInt(param_name[,default])

returns value of parameter as integer value. If parameter is not defined in a file then default value is returned without conversion, if default value was not given then exception is raised. If conversion from string to integer fails the standard exception is raised.

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="98917de8d87c64a6-262a0198-40334ac2-b7a08d94-a988f45465912f21012e99aa"><ac:plain-text-body><![CDATA[

self.configFloat(param_name[,default])

returns value of parameter as floating point value. If parameter is not defined in a file then default value is returned without conversion, if default value was not given then exception is raised. If conversion from string to floating point fails the standard exception is raised.

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="35460c664296adac-9459b24b-44e24655-962a906f-149594ba37d95d8be1a391ec"><ac:plain-text-body><![CDATA[

self.configStr(param_name[,default])

returns value of parameter as string. If parameter is not defined in a file then default value is returned without conversion, if default value was not given then exception is raised.

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="7869710b3b925691-a06eb11e-42a1429f-a38e9ae7-8434f7133fc3148639898b97"><ac:plain-text-body><![CDATA[

self.configSrc(param_name[,default])

returns value of parameter as "source address" string. If parameter is not defined in a file then default value is returned without conversion, if default value was not given then exception is raised. This method does the same as self.configStr but it may also check correctness of the source string format.

]]></ac:plain-text-body></ac:structured-macro>

self.configListBool(param_name)

returns value of parameter as a list of boolean values. If parameter is not defined in a file then empty list is returned, otherwise every word in a parameter value is converted to boolean (according to same rules as defined for self.configBool) and all values are returned in one list.

self.configListInt(param_name)

returns value of parameter as a list of integers. If parameter is not defined in a file then empty list is returned, otherwise every word in a parameter value is converted to integers and all numbers are returned in one list. Conversion errors will raise exception.

self.configListFloat(param_name)

returns value of parameter as a list of floating point numbers. If parameter is not defined in a file then empty list is returned, otherwise every word in a parameter value is converted to float and all numbers are returned in one list. Conversion errors will raise exception.

self.configListStr(param_name)

returns value of parameter as a list of strings. If parameter is not defined in a file then empty list is returned, otherwise parameter value is split into words which are returned in one list.

self.configListSrc(param_name)

returns value of parameter as a list of "source address" strings. If parameter is not defined in a file then empty list is returned, otherwise parameter value is split into words which are returned in one list.

...

Just like event class the environment class in pyana provides a number of specific method for individual data types and a generic method which works for any data type. Specific methods should not be used frequently, one should prefer to use generic method. Generic method has this definition:

  • Wiki Markup
    {{env.getConfig(typeId:int\[, address=None\])}} - takes integer number for the first argument and optional string for second. Integer number is an XTC TypeId value such as {{xtc.TypeId.Type.Id_AcqConfig}} (note that TypeId values for event data and configuration data are different). This method retrieves configuration data of the type corresponding to the TypeId coming from a device that matches source address.

An example:

Code Block
from pypdsdata import xtc
......
        src = self.configSrc('source', '')
        config = env.getConfig(xtc.TypeId.Type.Id_AcqConfig, src)
        if config:
            print "config.nbrChannels =", config.nbrChannels()

...

  1. store.get(type, src) where type is python class corresponding to the configuration data type (or list of classes), e.g. psana.Acqiris.Config. src argument must be an instance of psana.Source type which provides a match for device address.
  2. Wiki Markup
    {{self.get(typeId:int\[, address:string=""\])}} - this is pyana-compatibility method and should only be used in the code which is supposed to run in both pyana and psana. This method is equivalent to pyana method {{env.getConfig(TypeId, address)}}.

For pyana compatibility environment also defines evt.getConfig(...) method which is a shortcut for env.configStore().get(...), this method should only be used in a code which should run in both pyana and psana.

...