Versions Compared

Key

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

...

Configuration file in both frameworks is starting from section pyana or psana with followed by the list of parameters. The list of parameters is different for historical reasons. When python modules are designed to support both frameworks, both sections may be presented in the same configuration file. Alien section is ignored at run time of each framework. Example of these sections in the same configuration file:

Code Block
bgColor#AAFFFF
[pyana]
files  = /reg/d/psdm/xcs/xcs72913/xtc/e265-r0049-s00-c00.xtc /reg/d/psdm/xcs/xcs72913/xtc/e265-r0049-s04-c00.xtc /reg/d/psdm/xcs/xcs72913/xtc/e265-r0049-s05-c00.xtc
num-events = 500
#skip-events = 0
#num-cpu = 1
verbose = 1
modules = py_img_algos.tahometer py_img_algos.cspad_arr_producer py_img_algos.cspad_image_producer py_img_algos.image_save_in_file

[psana]
files = exp=xcs72913:run=49
events = 500                 
#skip-events = 0
modules = py_img_algos.tahometer py_img_algos.cspad_arr_producer py_img_algos.cspad_image_producer py_img_algos.image_save_in_file

At least 4 A few differences can be clearly seen:

  • psana accepts both forms for files, pyana - only explicit list of files.
  • Parameter for number of events is has different name events and num-events for psana and pyana, respectively.
  • verbose mode currently works for pyana only. Logger does not have interface in psana yet.
  • psana currently does not support multiprocessor mode num-cpu.

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="5362fb0a17af48cc-fb72ebd5-4de0483a-9260835d-5bd37a64b9876ac51fec3d6e"><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="c5387933b94a9a18-41fb82a5-4a6d41ba-b03d990c-4cb9c37e6a3f96acdc0f7bc5"><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="82d53800792e2447-815f2b86-4b934a63-9b798012-e1f67e6e360e9c040ea74436"><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="545d4a4ba659269e-682cefca-43414572-893aa5bf-9e399b7f5eeaca00f048b11c"><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="382cc596895e2e88-c1b7cd5f-489847bb-a5faba54-91f4cc0ad49b2fa3944db76a"><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.

...

pyana

psana

_pdsdata.cspad

Psana.CsPad

config = env.getConfig(TypeId.Type.Id_CspadConfig, self.m_src)

config = env.configStore().get(CsPad.Config, self.m_src)

quads = evt.get(TypeId.Type.Id_CspadElement, self.m_src)

data = evt.get(CsPad.Data, self.m_src)

for q in quads : data = q.data() # image data as 3-dimentional array of the shape (N, 185, 388)

 

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="ee2b1a0037c6cd24-2c734015-41b54242-904bb062-31f43cdc52a560e374bd2f14"><ac:plain-text-body><![CDATA[

list_of_masks = [config.roiMask(q) for q in range(4)]

list_of_masks = [config.roiMask(q) for q in range(4)]

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="5e27832927d3a6d3-05fb9427-4da74678-a37ca7b8-00c067469ba93937258fcc6c"><ac:plain-text-body><![CDATA[

print " numQuads =", config.numQuads();

nQuads = data.quads_shape()[0] # etc.

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

for i in range(nQuads): q = data.quads(i); data_arr = q.data() # etc.

for i in range(nQuads): q = data.quads(i); data_arr = q.data() # etc.

...