Versions Compared

Key

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

...

  • myana – the first C-based package,
  • pyana – python-based framework,
  • psana – C++-based framework.
    Currently, features of both frameworks are combined together under the unified
  • psana – framework, which works both with C++ and python modules.
    This new framework allows data processing using advantage of both C++ and python modules. However, there is no full backward compatibility between new psana framework and pyana modules. Original pyana modules would not work directly in psana, they need to be changed. In this note we discuss the difference between pyana and python-psana modules and present the references to documentation, which help to migrate from pyana to python-psana.

Data types and access methods

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="7feda75a6b81f781-d0323cbd-4882439f-adf49b07-d9c29332e2dcd0a4f876f6de"><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="d08f4413219ea475-07c372f1-452640a4-b7168e30-80f1eace121228c106916f86"><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="b26d73c004e683a8-cd9b8f23-4e9043c8-846baecd-46eebdf238797ffee68f58b0"><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="3baeda8a98ee9d32-d8cc2d17-4e254c45-9dc79bc7-b471f4a7a435adcf7ac0b5bb"><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="4b3e7a61e9c3599a-c16c13e0-46154f1b-acd4a0ac-9ce5a0c5ea20653ca81b20d3"><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="1f908eb3a503b1b3-1538b13a-43784874-9d4984b2-4edce82e4f4967eeea546c41"><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="57fb4861c1cffee6-a61c02d2-4e894eff-84b286a9-edf1a40c4dddebf383c88edf"><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.

...

pyana

psana

_pdsdata.cspad2x2

Psana.CsPad2x2

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

{{}}

(works the same) config = env.getConfig(CsPad2x2Config, self.m_src)

print " roiMask =", config.roiMask()

{{}} roiMask = config.roiMask()

elem = evt.get(xtc.TypeId.Type.Id_Cspad2x2Element, self.m_src)

{{}} elem = evt.get(CsPad2x2.Element, self.m_src)

data = elem.data() # image data as 3-dimentional array of the shape (185, 388, 2)

{{}} data = elem.data()

{{}}

{{}}

EPICS

pyana

psana

_pdsdata.epics

Psana.Epics

{{}}

{{}}

...

pyana

psana

_pdsdata.opal1k

Psana.Opal1k

{{}}

{{}}

...

All other modules

Interactive psana

Interactive psana API is available beginning from release ana-0.9.0.
Example of how to start interactive python-psana:

Code Block

% ipython
from psana import *
help(psana.CsPad)

References

ples: https://pswww.slac.stanford.edu/trac/psdm/browser/psdm/psana_examples#trunk/src