Data processing input file API

These classes provide information about processing APBS output.

The top-level output summarizes or combines results from multiple calculations.

class apbs.input_file.process.Element(dict_=None, yaml=None, json=None)[source]

Bases: InputFile

Element of an arithmetic operation.

Objects can be initialized with dictionary/JSON/YAML data with a list of the following keys:

  • alias: alias for quantity on which to operate

  • coefficient: multiplicative coefficient for quantity (e.g., -1.0 to convert a sum to difference)

property alias: str

Return alias for object to which this element refers.

Raises

TypeError – if alias is not a string.

property coefficient: float

Return coefficient for this element.

Raises

TypeError – if not a number

from_dict(input_)[source]

Load object contents from dictionary.

Parameters

input (dict) – dictionary with object contents

Raises

KeyError – if dictionary elements missing

from_json(input_)

Parse JSON-format input string into this object.

Parameters

input (str) – JSON-format input string

from_yaml(input_)

Parse YAML-format input string into this object.

Parameters

input (str) – YAML-format input string

to_dict() dict[source]

Produce dictionary representation of self.

to_json() str

Produce JSON representation of self.

to_yaml() str

Produce YAML representation of self.

validate()[source]

Validate the object.

Raises

ValueError – if object is not valid

class apbs.input_file.process.Operation(dict_=None, yaml=None, json=None)[source]

Bases: InputFile

Generic arithmetic operation.

Objects can be initialized with dictionary/JSON/YAML data with the following keys:

  • alias: string for referring to the output of this operation elsewhere

  • elements: a list of elements for the operation; see Element for details

property alias: str

String for referring to the output of this operation elsewhere.

Raises

TypeError – if alias is not a string

property elements: list

List of Element objects for operation.

Raises

TypeError – if list contains objects not Element

from_dict(dict_)[source]

Load object contents from dictionary.

Parameters

dict (dict) – dictionary with object contents

Raises

KeyError – if dictionary elements missing

from_json(input_)

Parse JSON-format input string into this object.

Parameters

input (str) – JSON-format input string

from_yaml(input_)

Parse YAML-format input string into this object.

Parameters

input (str) – YAML-format input string

to_dict() dict[source]

Produce dictionary representation of self.

to_json() str

Produce JSON representation of self.

to_yaml() str

Produce YAML representation of self.

validate()[source]

Validate object.

Raises

ValueError – if object contents are invalid

class apbs.input_file.process.Process(dict_=None, yaml=None, json=None)[source]

Bases: InputFile

Arithmetic operations for output from APBS energy/force calculations.

Objects can be initialized with dictionary/JSON/YAML data with the following keys:

  • sums: add elements together. This is a list of Operation objects.

  • products: multiply elements together. This is a list of Operation objects.

  • exps: element-wise exponentiation of elements. This is a list of Operation objects.

property exps: list

List of exponential Operation objects.

Raises

TypeError – if list contains something other than class:Operation objects

from_dict(input_)[source]

Populate object from dictionary.

Parameters

input (dict) – input information

Raises

KeyError – if elements are missing from the input dictionary

from_json(input_)

Parse JSON-format input string into this object.

Parameters

input (str) – JSON-format input string

from_yaml(input_)

Parse YAML-format input string into this object.

Parameters

input (str) – YAML-format input string

property products: list

List of product Operation objects.

Raises

TypeError – if list contains something other than class:Operation objects

property sums: list

List of sum Operation objects.

Raises

TypeError – if list contains something other than class:Operation objects

to_dict() dict[source]

Produce dictionary representation of self.

to_json() str

Produce JSON representation of self.

to_yaml() str

Produce YAML representation of self.

validate()[source]

Validate contents of object.

Raises

ValueError – if invalid object encountered