Model

class pyrogue.Model(bitSize, binPoint=0)[source]

Extensible base class which describes how a data type is represented and accessed using the Rogue Variables and Blocks

Parameters:
  • bitSize (int) – Number of bits being represented.

  • binPoint (int, default: 0) – Binary point position.

  • args (Any)

  • kwargs (Any)

Variables:
  • name (str) – String representation of the Model type

  • fstring (str) – Not sure what this is, Where is it used?

  • encoding (str) – Encoding type for converting between string and byte arrays. i.e. UTF-8

  • pytype (int) – Python type class.

  • defaultdisp (str) – Default display formatting string. May be overriden by the Variable disp parameter.

  • signed (bool) – Flag indicating if value is signed. Default=False

  • endianness (str) – Endianness indicator. ‘little’ or ‘big’. Default=’little’

  • bitReverse (bool) – Bit reversal flag.

  • modelId (int) – Block processing ID. See Block Process Types

  • isBigEndian (bool) – True if endianness = ‘big’

  • ndType (np.dtype) – numpy type value (bool, int32, int64, uint32, uin64, float32, float64)

Return type:

Any

property isBigEndian: bool

Return True if the model is big endian.

toBytes(value)[source]

Convert the python value to byte array. Implement this method in a subclass to define the conversion.

Parameters:

value (Any) – Python value to convert.

Return type:

Any

fromBytes(ba)[source]

Convert a byte array to a python value. Implement this method in a subclass to define the conversion.

Parameters:

ba (bytearray) – Byte array to extract value from.

Return type:

Any

fromString(string)[source]

Convert a string to a python value. Implement this method in a subclass to define the conversion.

Parameters:

string (str) – String representation of the value.

Return type:

Any

minValue()[source]

Return the minimum value for the Model type. Implement this method in a subclass to define the minimum value.

Return type:

Any

maxValue()[source]

Return the maximum value for the Model type. Implement this method in a subclass to define the maximum value.

Return type:

Any