Skip to content

Commit

Permalink
typing fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Jan 8, 2024
1 parent 9e9d4bf commit 83492b9
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 15 deletions.
12 changes: 6 additions & 6 deletions mcmc/mcmc_cholesky_vertex.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

from pacman.model.graphs.machine import MachineVertex
from pacman.model.resources import ConstantSDRAM
from enum import Enum

from spinn_utilities.overrides import overrides

from spinnman.model.enums import ExecutableType

from pacman.model.graphs.machine import MachineVertex
from pacman.model.placements import Placement
from pacman.model.resources import ConstantSDRAM

from spinn_front_end_common.abstract_models.abstract_has_associated_binary \
import AbstractHasAssociatedBinary
from spinn_front_end_common.abstract_models\
.abstract_generates_data_specification \
import AbstractGeneratesDataSpecification
from spinn_front_end_common.interface.ds import DataSpecificationGenerator
from spinn_front_end_common.utilities.utility_objs.executable_type \
import ExecutableType

from enum import Enum


class MCMCCholeskyRegions(Enum):
Expand Down
11 changes: 6 additions & 5 deletions mcmc/mcmc_coordinator_vertex.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
from pacman.model.resources import ConstantSDRAM
from spinn_utilities.overrides import overrides

from spinnman.model.enums import ExecutableType

from pacman.model.placements import Placement

from spinn_front_end_common.abstract_models.abstract_has_associated_binary \
Expand All @@ -27,8 +29,6 @@
from spinn_front_end_common.data import FecDataView
from spinn_front_end_common.interface.ds import (
DataSpecificationGenerator, DataType)
from spinn_front_end_common.utilities.utility_objs.executable_type \
import ExecutableType
from spinn_utilities.progress_bar import ProgressBar

import numpy
Expand Down Expand Up @@ -236,16 +236,17 @@ def generate_data_specification(
spec.write_value(len(keys), data_type=DataType.UINT32)

# Write the key
routing_info = routing_info.get_routing_info_from_pre_vertex(
vertex_routing_info = routing_info.get_routing_info_from_pre_vertex(
self, self._data_partition_name)
spec.write_value(routing_info.key, data_type=DataType.UINT32)
assert vertex_routing_info is not None
spec.write_value(vertex_routing_info.key, data_type=DataType.UINT32)

# Write the window size
spec.write_value(self._window_size, data_type=DataType.UINT32)

# Write the sequence mask
spec.write_value(
~routing_info.mask & 0xFFFFFFFF, data_type=DataType.UINT32)
~vertex_routing_info.mask & 0xFFFFFFFF, data_type=DataType.UINT32)

# Write the timer
spec.write_value(self._send_timer, data_type=DataType.UINT32)
Expand Down
3 changes: 3 additions & 0 deletions mcmc/mcmc_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,20 @@ def get_parameters(self) -> List[MCMCParameter]:
:rtype: list of :py:class:`mcmc.mcmc_parameter.MCMCParameter`
"""
raise NotImplementedError

@abstractmethod
def get_state_variables(self) -> List[MCMCStateVariable]:
""" Get the state variables of the model
:rtype: list of :py:class:`mcmc.mcmc_state_variable.MCMCStateVariable`
"""
raise NotImplementedError

@abstractmethod
def get_binary_name(self) -> str:
""" Get the name of the binary compiled with this model
:rtype: str
"""
raise NotImplementedError
4 changes: 2 additions & 2 deletions mcmc/mcmc_root_finder_vertex.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@

from pacman.model.placements import Placement

from spinnman.model.enums import ExecutableType

from spinn_front_end_common.abstract_models.abstract_has_associated_binary \
import AbstractHasAssociatedBinary
from spinn_front_end_common.abstract_models\
.abstract_generates_data_specification \
import AbstractGeneratesDataSpecification
from spinn_front_end_common.interface.ds import DataSpecificationGenerator
from spinn_front_end_common.utilities.utility_objs.executable_type \
import ExecutableType

from enum import Enum

Expand Down
5 changes: 3 additions & 2 deletions mcmc/mcmc_vertex.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
from pacman.model.resources import ConstantSDRAM
from spinn_utilities.overrides import overrides

from spinnman.model.enums import ExecutableType

from pacman.model.placements import Placement

from spinn_front_end_common.abstract_models.abstract_has_associated_binary \
Expand All @@ -32,8 +34,6 @@
from spinn_front_end_common.utilities import helpful_functions
from spinn_front_end_common.interface.buffer_management \
import recording_utilities
from spinn_front_end_common.utilities.utility_objs.executable_type \
import ExecutableType

from enum import Enum
import numpy
Expand Down Expand Up @@ -262,6 +262,7 @@ def generate_data_specification(
if (self._model.root_finder):
routing_info_rf = routing_info.get_routing_info_from_pre_vertex(
self, self._parameter_partition_name)
assert routing_info_rf is not None
spec.write_value(routing_info_rf.key, data_type=DataType.UINT32)
else:
spec.write_value(0, data_type=DataType.UINT32)
Expand Down

0 comments on commit 83492b9

Please sign in to comment.