pacman.model.graphs.common package

Module contents

class pacman.model.graphs.common.ChipAndCore(x, y, p=None)

Bases: object

A constraint to place a vertex on a specific chip and, optionally, a specific core on that chip.

Parameters:
  • x (int) – the x-coordinate of the chip
  • y (int) – the y-coordinate of the chip
  • p (int or None) – the processor (if any) of the chip
p

The processor on the chip, or None if that is not constrained

Return type:int or None
x

The x-coordinate of the chip

Return type:int
y

The y-coordinate of the chip

Return type:int
class pacman.model.graphs.common.Slice

Bases: pacman.model.graphs.common.slice.Slice

Represents a slice of a vertex.

Attr int lo_atom:
 The lowest atom represented in the slice.
Attr int hi_atom:
 The highest atom represented in the slice.
Attr int n_atoms:
 The number of atoms represented by the slice.
Attr slice as_slice:
 This slice represented as a slice object (for use in indexing lists, arrays, etc.)
Attr tuple(int,…) shape:
 The shape of the atoms over multiple dimensions. By default the shape will be 1-dimensional.
Attr tuple(int,…) start:
 The start coordinates of the slice. By default this will be lo_atom in 1 dimension.

Create a new Slice object.

Parameters:
  • lo_atom (int) – Index of the lowest atom to represent.
  • hi_atom (int) – Index of the highest atom to represent.
Raises:

PacmanValueError – If the bounds of the slice are invalid.

as_slice
end

The end positions of the slice in each dimension

get_raster_ids(atoms_shape)[source]
Get the IDs of the atoms in the slice as they would appear in a
“raster scan” of the atoms over the whole shape.
Parameters:atoms_shape (tuple(int)) – The size of each dimension of the whole shape
Returns:A list of the global raster IDs of the atoms in this slice
get_slice(n)[source]

Get a slice in the n-th dimension

Parameters:n (int) – The 0-indexed dimension to get the shape of
Type:slice
slices

Get slices for every dimension

Return type:tuple(slice)