Skip to content

Commit 02f3a8f

Browse files
committed
feat(warm-up): quick checks
1 parent 5e4a796 commit 02f3a8f

File tree

1 file changed

+83
-10
lines changed

1 file changed

+83
-10
lines changed

content/13_warm_up.ipynb

Lines changed: 83 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"source": [
88
"# Implementing a warm-up period\n",
99
"\n",
10-
"We will implement warm-up as an event that resets all of our results collection variables. \n",
10+
"We will implement warm-up as a single event that resets all of our results collection variables. \n",
1111
"\n",
1212
"This is a simpler approach than including lots of if statements in `simpy` processes."
1313
]
@@ -309,7 +309,7 @@
309309
},
310310
{
311311
"cell_type": "code",
312-
"execution_count": 8,
312+
"execution_count": 33,
313313
"id": "b3e686ce-5371-4471-a052-b9d43309bc85",
314314
"metadata": {},
315315
"outputs": [],
@@ -334,7 +334,7 @@
334334
" inter_arrival_time = args.arrival_strokes.sample()\n",
335335
" yield env.timeout(inter_arrival_time)\n",
336336
"\n",
337-
" args.results[\"n_arrivals\"] = patient_id\n",
337+
" args.results[\"n_arrivals\"] += 1\n",
338338
" \n",
339339
" trace(f\"{env.now:.2f}: Stroke arrival.\")\n",
340340
"\n",
@@ -352,7 +352,7 @@
352352
},
353353
{
354354
"cell_type": "code",
355-
"execution_count": 10,
355+
"execution_count": 34,
356356
"id": "0d0ea6cf-7d95-4d2c-9690-fcdbdae35d84",
357357
"metadata": {},
358358
"outputs": [],
@@ -414,11 +414,84 @@
414414
" return results"
415415
]
416416
},
417+
{
418+
"cell_type": "markdown",
419+
"id": "c13f5e57-723c-409b-a1ce-cdb831b4e166",
420+
"metadata": {},
421+
"source": [
422+
"## Quick check 1: No warm-up"
423+
]
424+
},
417425
{
418426
"cell_type": "code",
419-
"execution_count": 23,
427+
"execution_count": 35,
420428
"id": "caf52390-5455-4fa1-bb22-60b5b91ad8d0",
421429
"metadata": {},
430+
"outputs": [
431+
{
432+
"name": "stdout",
433+
"output_type": "stream",
434+
"text": [
435+
"0.00: 🥵 Warm up complete.\n",
436+
"3.29: Stroke arrival.\n",
437+
"3.29: Patient 1 admitted to acute ward.(waited 0.00 days)\n",
438+
"4.06: Stroke arrival.\n",
439+
"4.06: Patient 2 admitted to acute ward.(waited 0.00 days)\n"
440+
]
441+
},
442+
{
443+
"data": {
444+
"text/plain": [
445+
"{'mean_acute_wait': 0.0}"
446+
]
447+
},
448+
"execution_count": 35,
449+
"metadata": {},
450+
"output_type": "execute_result"
451+
}
452+
],
453+
"source": [
454+
"TRACE = True\n",
455+
"experiment = Experiment()\n",
456+
"results = single_run(experiment, rep=0, wu_period=0.0, rc_period=5.0)\n",
457+
"results"
458+
]
459+
},
460+
{
461+
"cell_type": "code",
462+
"execution_count": 36,
463+
"id": "ddedb4f1-207d-4295-9ae4-c49b2c7cdcaf",
464+
"metadata": {},
465+
"outputs": [
466+
{
467+
"data": {
468+
"text/plain": [
469+
"{'n_arrivals': 2, 'waiting_acute': [0.0, 0.0]}"
470+
]
471+
},
472+
"execution_count": 36,
473+
"metadata": {},
474+
"output_type": "execute_result"
475+
}
476+
],
477+
"source": [
478+
"# check how many patient waiting times recorded.\n",
479+
"experiment.results"
480+
]
481+
},
482+
{
483+
"cell_type": "markdown",
484+
"id": "660ea2e1-d9c2-4355-876c-43dfd9dab0fe",
485+
"metadata": {},
486+
"source": [
487+
"## Quick check 1: Include a warm-up"
488+
]
489+
},
490+
{
491+
"cell_type": "code",
492+
"execution_count": 37,
493+
"id": "72b5284a-1fcb-4126-b663-c0ef0002e4bf",
494+
"metadata": {},
422495
"outputs": [
423496
{
424497
"name": "stdout",
@@ -443,7 +516,7 @@
443516
"{'mean_acute_wait': 0.0}"
444517
]
445518
},
446-
"execution_count": 23,
519+
"execution_count": 37,
447520
"metadata": {},
448521
"output_type": "execute_result"
449522
}
@@ -457,17 +530,17 @@
457530
},
458531
{
459532
"cell_type": "code",
460-
"execution_count": 24,
461-
"id": "ddedb4f1-207d-4295-9ae4-c49b2c7cdcaf",
533+
"execution_count": 38,
534+
"id": "7f5e282b-0f41-41df-bdca-f128e7d418c1",
462535
"metadata": {},
463536
"outputs": [
464537
{
465538
"data": {
466539
"text/plain": [
467-
"{'n_arrivals': 5, 'waiting_acute': [0.0, 0.0, 0.0]}"
540+
"{'n_arrivals': 3, 'waiting_acute': [0.0, 0.0, 0.0]}"
468541
]
469542
},
470-
"execution_count": 24,
543+
"execution_count": 38,
471544
"metadata": {},
472545
"output_type": "execute_result"
473546
}

0 commit comments

Comments
 (0)