Skip to content

Commit ede5919

Browse files
committed
style(lint): linting
1 parent c8ad6c4 commit ede5919

File tree

2 files changed

+25
-21
lines changed

2 files changed

+25
-21
lines changed

pages/output_analysis/length_warmup.qmd

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ bibliography: length_warmup_resources/references.bib
77

88
{{< include ../../scripts/_reticulate-setup.md >}}
99

10+
```{python}
11+
#| echo: false
12+
# pylint: disable=undefined-variable,unused-import
13+
```
14+
1015
:::: {.pale-blue}
1116

1217
**Learning objectives:**
@@ -27,10 +32,11 @@ These should be available from environment setup in the "Test yourself" section
2732
::: {.python-content}
2833

2934
```{python}
35+
import os
36+
3037
from IPython.display import HTML
3138
from itables import to_html_datatable
3239
import numpy as np
33-
import os
3440
import pandas as pd
3541
import plotly.express as px
3642
import plotly.graph_objects as go
@@ -173,11 +179,13 @@ def time_series_inspection(result, file_path, warm_up=None):
173179
.mean()
174180
.reset_index(level=0, drop=True)
175181
)
176-
182+
177183
# Overall cumulative mean (across all runs)
178184
result_overall = result.sort_values("arrival_time")
179-
result_overall["overall_cumulative_mean"] = result_overall["wait_time"].expanding().mean()
180-
185+
result_overall["overall_cumulative_mean"] = (
186+
result_overall["wait_time"].expanding().mean()
187+
)
188+
181189
# Plot: all individual runs as light lines, overall as dark line
182190
fig = go.Figure()
183191
@@ -186,7 +194,7 @@ def time_series_inspection(result, file_path, warm_up=None):
186194
x=df_run["arrival_time"],
187195
y=df_run["cumulative_mean"],
188196
mode="lines",
189-
line=dict(color="lightblue", width=1),
197+
line={"color": "lightblue", "width": 1},
190198
opacity=0.7,
191199
name=f"Run {run}",
192200
showlegend=False
@@ -196,7 +204,7 @@ def time_series_inspection(result, file_path, warm_up=None):
196204
x=result_overall["arrival_time"],
197205
y=result_overall["overall_cumulative_mean"],
198206
mode="lines",
199-
line=dict(color="darkblue", width=3),
207+
line={"color": "darkblue", "width": 3},
200208
name="Overall"
201209
))
202210
@@ -213,11 +221,7 @@ def time_series_inspection(result, file_path, warm_up=None):
213221
y0=ymin,
214222
x1=warm_up,
215223
y1=ymax,
216-
line=dict(
217-
color="red",
218-
width=2,
219-
dash="dash"
220-
),
224+
line={"color": "red", "width": 2, "dash": "dash"},
221225
xref="x",
222226
yref="y"
223227
)
@@ -226,7 +230,7 @@ def time_series_inspection(result, file_path, warm_up=None):
226230
y=ymax,
227231
text="Suggested warm-up length",
228232
showarrow=False,
229-
font=dict(color="red"),
233+
font={"color": "red"},
230234
yanchor="top",
231235
xanchor="left"
232236
)
@@ -480,18 +484,18 @@ As mention above, we have used multiple replications (`number_of_runs = 5`) and
480484
```{python}
481485
# Run model with base parameters for 5 replications with no warm-up and
482486
# long data collection period, keeping the patient-level results
483-
param = Parameters(warm_up_period = 0,
484-
data_collection_period = 100000,
485-
number_of_runs = 5)
487+
param = Parameters(warm_up_period=0,
488+
data_collection_period=100000,
489+
number_of_runs=5)
486490
runner = Runner(param)
487491
results = runner.run_reps()["patient"]
488492
489493
# Provide to time_series_inspection() function
490494
time_series_inspection(
491-
result = results,
492-
file_path = os.path.join("length_warmup_resources",
493-
"python_length_warmup.png"),
494-
warm_up = 15000
495+
result=results,
496+
file_path=os.path.join("length_warmup_resources",
497+
"python_length_warmup.png"),
498+
warm_up=15000
495499
)
496500
```
497501

pages/verification_validation/tests_resources/simulation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ def run_reps(self):
372372
overall_results_df = pd.DataFrame(uncertainty_metrics)
373373

374374
return {
375-
"patient": patient_results_df,
376-
"run": run_results_df,
375+
"patient": patient_results_df,
376+
"run": run_results_df,
377377
"overall": overall_results_df
378378
}

0 commit comments

Comments
 (0)