pop_attrs2.py

This script allows the handling of a population’s attributes in a qdf file.

Code: pop_attrs2.py,

attr_tools.py, PopAttrs.py, QHGError.py

This tool requires the python modules h5py and numpy to be installed.

Usage

Display Atributes

${QHG4_DIR}/tools_qdf/pop_attrs2.py show  <pop-qdf>[:<pop-name>]

Modify Atributes

${QHG4_DIR}/tools_qdf/pop_attrs2.py mod   <pop-qdf>[:<pop-name>] (<attr-path> <attr-val>)*

Add an Atribute

${QHG4_DIR}/tools_qdf/pop_attrs2.py add   <pop-qdf>[:<pop-name>] <attr-path> <attr-val> [<attr_type>]

Delete Attributes

${QHG4_DIR}/tools_qdf/pop_attrs2.py del   <pop-qdf>[:<pop-name>] <attr-path>*

where:

pop-qdf

QDF file with populations.

pop-name

Name of population (if omitted, the first population is used).

attr-path

Path and name of the attribute: <action_group>/<attr_name>.

attr-val

Nw value for attribute (the value must have the correct type).

attr_type

A numpy type such as ‘float64’, ‘int32’, ‘S2’ etc.

There are shell scripts for each type of call: show_attr, add_attr, change_attr, and del_attr.

Examples

Add a new float attribute named “Navigate_bridge_prob0” to the group “Navigate” and set its value to 0.05.

${QHG4_DIR}/tools_qdf/pop_attrs2.py add xxx.qdf Navigate/Navigate_bridge_prob0 0.05 float64

Change the value of attribute named “Navigate_bridge_prob0” in the group “Navigate” to 0.03.

${QHG4_DIR}/tools_qdf/pop_attrs2.py mod xxx.qdf Navigate/Navigate_bridge_prob0 0.03

Delete the attribute named “Navigate_bridge_prob0” in the group “Navigate”.

${QHG4_DIR}/tools_qdf/pop_attrs2.py del xxx.qdf Navigate/Navigate_bridge_prob0