Model

The Model class define a data type for use with a Block.

class pyrogue.Model(*args, **kwargs)[source]

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) – Huh?

name

String representation of the Model type

Type:

str

fstring

Not sure what this is, Where is it used?

Type:

str

encoding

Encoding type for converting between string and byte arrays. i.e. UTF-8

Type:

str

pytype

Python type class.

Type:

int

defaultdisp

Default display formatting string. May be overriden by the Variable disp parameter.

Type:

str

signed

Flag indicating if value is signed. Default=False

Type:

bool

endianness

Endianness indicator. ‘little’ or ‘big’. Default=’little’

Type:

str

bitReverse

Bit reversal flag.

Type:

bool

modelId

Block processing ID. See interfaces_memory_constants_ptype

Type:

int

isBigEndian

True if endianness = ‘big’

Type:

bool

ndType

numpy type value (bool, int32, int64, uint32, uin64, float32, float64)

Type:

np.dtype

toBytes(value)[source]

Convert the python value to byte array.

Parameters:

value (obj) – Python value to convert

fromBytes(ba)[source]

Convert the python value to byte array.

Parameters:

ba (bytearray) – Byte array to extract value from

fromString(string)[source]

Convert the string to a python value.

Parameters:

string (str) – String representation of the value

minValue()[source]

Return the minimum value for the Model type

maxValue()[source]

Return the maximum value for the Model type

Standard Models

The following are pre-defined models for various data types.

UInt

class pyrogue.UInt(*args, **kwargs)[source]

Model class for unsigned integers

pytype

alias of int

toBytes(value)[source]
Parameters:

value

fromBytes(ba)[source]
Parameters:

ba

fromString(string)[source]
Parameters:

string

UIntBE

class pyrogue.UIntBE(*args, **kwargs)[source]

Model class for big endian unsigned integers

UIntReversed

class pyrogue.UIntReversed(*args, **kwargs)[source]

Model class for unsigned integers, stored in reverse bit order

toBytes(value)[source]
Parameters:

value

fromBytes(ba)[source]
Parameters:

ba

Int

class pyrogue.Int(*args, **kwargs)[source]

Model class for integers

toBytes(value)[source]
Parameters:

value

fromBytes(ba)[source]
Parameters:

ba

fromString(string)[source]
Parameters:

string

IntBE

class pyrogue.IntBE(*args, **kwargs)[source]

Model class for big endian integers

Bool

class pyrogue.Bool(*args, **kwargs)[source]

Model class for booleans

pytype

alias of bool

toBytes(value)[source]
Parameters:

value

fromBytes(ba)[source]
Parameters:

ba

fromString(string)[source]
Parameters:

string

String

class pyrogue.String(*args, **kwargs)[source]

Model class for strings

pytype

alias of str

toBytes(value)[source]
Parameters:

value

fromBytes(ba)[source]
Parameters:

ba

fromString(string)[source]
Parameters:

string

Float

class pyrogue.Float(*args, **kwargs)[source]

Model class for 32-bit floats

pytype

alias of float

toBytes(value)[source]
Parameters:

value

fromBytes(ba)[source]
Parameters:

ba

fromString(string)[source]
Parameters:

string

FloatBE

class pyrogue.FloatBE(*args, **kwargs)[source]

Model class for 32-bit floats stored as big endian

Double

class pyrogue.Double(*args, **kwargs)[source]

Model class for 64-bit floats

DoubleBE

class pyrogue.DoubleBE(*args, **kwargs)[source]

Model class for 64-bit floats stored as big endian

Fixed

class pyrogue.Fixed(*args, **kwargs)[source]

Model class for fixed point signed integers

Parameters:
  • bitSize (int) – Specifies the total number of bits, including the binary point bit width.

  • binPoint (int) – Specifies the bit location of the binary point, where bit zero is the least significant bit.

pytype

alias of float