diff --git a/aequilibrae/paths/results/assignment_results.py b/aequilibrae/paths/results/assignment_results.py index d1ad3b8ab..cb2140754 100644 --- a/aequilibrae/paths/results/assignment_results.py +++ b/aequilibrae/paths/results/assignment_results.py @@ -79,6 +79,9 @@ def prepare(self, graph: Graph, matrix: AequilibraeMatrix) -> None: if graph is None: raise ("Please provide a graph") else: + if not graph.cost_field: + raise Exception('Cost field needs to be set for computation. use graph.set_graph("your_cost_field")') + self.nodes = graph.num_nodes self.zones = graph.num_zones self.centroids = graph.centroids diff --git a/aequilibrae/paths/results/path_results.py b/aequilibrae/paths/results/path_results.py index dd0300a89..a76c86574 100644 --- a/aequilibrae/paths/results/path_results.py +++ b/aequilibrae/paths/results/path_results.py @@ -77,6 +77,10 @@ def prepare(self, graph: Graph) -> None: Args: *graph* (:obj:`Graph`): Needs to have been set with number of centroids and list of skims (if any) """ + + if not graph.cost_field: + raise Exception('Cost field needs to be set for cost computation. use graph.set_graph("your_cost_field")') + self.__integer_type = graph.default_types("int") self.__float_type = graph.default_types("float") self.nodes = graph.num_nodes + 1 diff --git a/aequilibrae/paths/results/skim_results.py b/aequilibrae/paths/results/skim_results.py index e435ca92b..df425ba4f 100644 --- a/aequilibrae/paths/results/skim_results.py +++ b/aequilibrae/paths/results/skim_results.py @@ -55,6 +55,9 @@ def prepare(self, graph): *graph* (:obj:`Graph`): Needs to have been set with number of centroids and list of skims (if any) """ + if not graph.cost_field: + raise Exception('Cost field needs to be set for computation. use graph.set_graph("your_cost_field")') + self.nodes = graph.num_nodes + 1 self.zones = graph.num_zones self.links = graph.num_links + 1