OECIFCategory

struct OECIFCategory

This class represents the OECIFCategory that holds CIF header data and acts as an interface to interact with this header data. This object reflects what is contained in a CIF category.

The CIF File Format section explains in more detail the CIF data structure.

See also

Constructors

OECIFCategory() -> OECIFCategory
OECIFCategory(categoryName: str) -> OECIFCategory
OECIFCategory(categoryName: str, attributes: OEStringVector) -> OECIFCategory
OECIFCategory(categoryName: str, attributes: OEStringVector,
              values: OEStringVector) -> OECIFCategory
OECIFCategory(categoryName: str, attribute: str, value: str) -> OECIFCategory
OECIFCategory(category: OECIFCategory) -> OECIFCategory

Create a OECIFCategory object.

AddAttribute

AddAttribute(newAttribute: str, newValues: OEStringVector) -> bool

Adds a column of values to the indicated CIF attribute. If no values are input, a question mark “?” value will be used to populate attribute values.

AddRow

AddRow(newValues: OEStringVector) -> bool

Adds a row of value(s) to the CIF category.

If no values are input, by default, it will add a question mark “?” to every attribute in the category.

DeleteRow

DeleteRow(row: int) -> bool

Deletes a category’s indicated row.

DeleteAttribute

DeleteAttribute(attribute: str) -> bool

Deletes a category attribute.

GetAttributes

GetAttributes() -> OEStringVector

Returns the category’s attributes.

GetAttributeValue

GetAttributeValue(attribute: str, raw: bool = False) -> str
GetAttributeValue(attribute: str, row: int, raw: bool = False) -> str

Gets the saved value on the indicated attribute. If multiple values exist for a given attribute, then a row number must be identified.

GetAttributeValues

GetAttributeValues(attribute: str, raw: bool = False) -> OEStringVector

Gets all the saved values on the indicated attribute.

GetAttributeIndex

GetAttributeIndex(attribute: str) -> int

Returns the attribute’s base-0 index. For any given row of data associated with the category, this index correlates with the attribute’s value in that row. For example, if GetAttributeIndex(“type”)=1, for every row generated by GetRows(), the _category.type data would be the [1] value in that row.

GetCategoryName

GetCategoryName() -> str

Returns the category’s name.

GetDataItem

GetDataItem(attribute: str) -> str

Returns the CIF data item name in the format: ‘_category.attribute’

GetDataItems

GetDataItems() -> OEStringVector

Returns all the CIF data item names in the category in the format: ‘_category.attribute’

GetNumRows

GetNumRows() -> int

Number of CIF rows in the category.

GetNumAttributes

GetNumAttributes() -> int

Number of CIF attributes in the category.

GetNumericAttributeValue

Gets the saved value for the indicated attribute and converts it to a numeric value. If multiple values exist for a given attribute, then a row number must be identified. If a value cannot be easily converted to a numeric value, it will default to 0.

GetNumericAttributeValues

GetNumericAttributeValues(attribute: str, vals: OEFloatVector) -> bool
GetNumericAttributeValues(attribute: str, vals: OEIntVector) -> bool

Gets all the saved values for the indicated attribute and converts to a numeric value. If a value cannot be easily converted to a numeric value, it will default to 0.

GetRow

GetRow(row: int, raw: bool = False) -> OEStringVector

Returns as a specific row from the category. Row indicators are base-0. Raw values are formatted as they will appear in the header. This is most noticeable with values that contain space characters, as CIF formatting requires single or double quotes around such a string value.

GetRows

GetRows(beginRow: int, endRow: int, raw: bool = False) -> OEStringVectorVector
GetRows(raw: bool = False) -> OEStringVectorVector

Returns rows from the category. Row indicators are base-0. Raw values are formatted as they will appear in the header. This is most noticeable with values that contain space characters, as CIF formatting requires single or double quotes around such a string value.

GetRowIndices

GetRowIndices(attribute: str, matchValue: str) -> OEUIntVector

Returns the base-0 row indices whose values string-match with input match values.

HasAttribute

HasAttribute(attribute: str) -> bool

Returns if an attribute is present in this object.

SetData

SetData(attribute: str, newValues: OEStringVector) -> bool
SetData(attribute: str, row: int, newValue: str, init: str = "?") -> bool
SetData(row: int, newValues: OEStringVector, init: str = "?") -> bool

Sets attribute and row data. When setting data related to row values, if the indicated row value exceeds the maximum number of rows, then empty values will populate any undefined attributes values. Rows indicators are base-0.

SortByAttribute

SortByAttribute(attribute: str) -> None

All rows will be rearranged according to the alphanumeric order of the indicated attribute’s values.