test_frame module

The test_frame module provides the TestFrame class.

Example:

Show selected devices, attributes in a table ( data frame.) literal blocks:

tf = TestFrame([device1, device2, ... ],["attr1", "attr2", ...])

where device_i are Tango Devices and attribute_i are lists of attribute names literal blocks:

state  = TestFrame([tile1,tile2],["state","adminMode","obstate"])

Before Operation literal blocks:

state.check()

Shows a dataframe in the notebook: rows are devices columns are the attribute values (human readable.)

If a given device does not have the attribute a blank cell is shown.

After operation literal blocks:

state.check()

Allows easy viewing of sets of tango device attributes before and after an operation is performed.

class aiv_utils.test_frame.TestFrame(devices, attributes, display='name', check_column='state', context='jupyter')

Show sets of attributes for multiple devices in a dataframe for ease of viewing.

check()

check the attributes

Return type:

DataFrame

check_relationship(device)

Check what other devices refer to a given device via a trl attribute.

Parameters:

device – device proxy

Returns:

Nothing

do_operation(operation, check_column='state', delay=30)

This method captures system state before an operation, performs an operation, waits for a delay and then captures the state again, showing what has changed.

Parameters:
  • operation – a nilary function

  • check_column – which column in the check dataframe to check for differences.

Param:

delay: A time to wait, in seconds, after the operation has been invoked, before checking for the system state again.

Returns:

A Pandas Dataframe showing the differences between before and after.

get_attribute(device, attr)

return single attribute

get_attribute_data()

return attributes

show_relationships()

For all devices loaded into this TestFrame, show which other devices refer to it.

aiv_utils.test_frame.state_difference(before_df, after_df, check_column='state')

Show the difference between two .check() dataframes by joining before and after checks, joining on the device and showing only rows which have different check_column values (e.g. state.)

Parameters:
  • before_df (DataFrame) – A Pandas Dataframe. ( result of a TestFrame.check() before some operation.

  • after_df (DataFrame) – A Pandas Dataframe ( result of a TestFrame.check() after some operation

  • check_column – str The name of the column to check for differences. Defaults to ‘state’.

Return type:

DataFrame

Returns:

A Pandas dataframe showing the merged frames but containing only the rows wherethe check_column is different in the before and after dataframes.