Skip to content

Commit cd471a4

Browse files
committed
FIX
1 parent 8c59446 commit cd471a4

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

exercises/exercise09.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -175,16 +175,14 @@ def set_contact_matrices(model, damping_start, damping_value):
175175
damping_value: Strength of the contact reduction in [0, 1]
176176
"""
177177
contact_matrices = mio.ContactMatrixGroup(1, 6)
178-
baseline_file = os.path.join("contact_matrix_baseline.txt")
179-
minimum_file = os.path.join("contact_matrix_minimum.txt")
178+
baseline_file = os.path.join("data/contact_matrix_baseline.txt")
179+
minimum_file = os.path.join("data/contact_matrix_minimum.txt")
180180

181181
contact_matrices[0] = mio.ContactMatrix(
182182
mio.read_mobility_plain(baseline_file),
183183
mio.read_mobility_plain(minimum_file),
184184
)
185185

186-
contact_matrices[0].add_damping(mio.Damping(coeffs=damping_value, t=damping_start))
187-
188186
# TODO: Add a damping to contact_matrices[0] using mio.Damping(...).
189187
# The damping should apply a 6×6 matrix filled with damping_value
190188
# uniformly across all age groups, starting at time damping_start.
@@ -260,7 +258,7 @@ def set_mobility(graph):
260258
Mobility is expressed as fraction of population commuting per day.
261259
Dead individuals are excluded from mobility.
262260
"""
263-
mobility_matrix = np.loadtxt("mobility_matrix.txt")
261+
mobility_matrix = np.loadtxt("data/mobility_matrix.txt")
264262
num_groups = graph.get_node(0).property.model.populations.numel()
265263

266264
for i in range(graph.num_nodes):
@@ -270,14 +268,10 @@ def set_mobility(graph):
270268

271269
coeff_ij = (mobility_matrix[i, j] / total_i) * np.ones(num_groups)
272270
coeff_ji = (mobility_matrix[j, i] / total_j) * np.ones(num_groups)
273-
coeff_ij[-1] = 0
274-
coeff_ji[-1] = 0
275271

276272
# TODO: Set the Dead compartment's mobility coefficient to 0 for
277273
# both directions — deceased individuals should not commute.
278274

279-
graph.add_edge(i, j, )
280-
281275
# TODO: Add directed edges in both directions to the graph.
282276
# Use graph.add_edge()
283277

@@ -605,7 +599,7 @@ def load_data():
605599
(the '1' is a batch dimension for workflow.sample)
606600
data: np.ndarray of shape (T, 12, 5)
607601
"""
608-
df = pd.read_csv("cases_3.csv").to_numpy() # shape: (T, 60)
602+
df = pd.read_csv("data/cases_3.csv").to_numpy() # shape: (T, 60)
609603

610604
data = np.zeros((df.shape[0], df.shape[1] // 5, 5))
611605
conditions = {}

0 commit comments

Comments
 (0)