@@ -17,8 +17,8 @@ class RestrictAttributesMeta(type):
1717 def __call__ (cls , * args , ** kwargs ):
1818 # Create instance using the standard method
1919 instance = super ().__call__ (* args , ** kwargs )
20- # Set the ' _initialised' flag to True, marking end of initialisation
21- instance .__dict__ [' _initialised' ] = True
20+ # Set the " _initialised" flag to True, marking end of initialisation
21+ instance .__dict__ [" _initialised" ] = True
2222 return instance
2323
2424
@@ -39,24 +39,26 @@ def __setattr__(self, name, value):
3939 """
4040 Prevent addition of new attributes.
4141
42- Arguments:
43- name (str):
44- The name of the attribute to set.
45- value (Any):
46- The value to assign to the attribute.
42+ Parameters
43+ ----------
44+ name: str
45+ The name of the attribute to set.
46+ value: any
47+ The value to assign to the attribute.
4748
48- Raises:
49- AttributeError:
50- If `name` is not an existing attribute and an attempt is made
51- to add it to the class instance.
49+ Raises
50+ ------
51+ AttributeError
52+ If `name` is not an existing attribute and an attempt is made
53+ to add it to the class instance.
5254 """
53- # Check if the instance is initialised and the attribute doesn' t exist
54- if hasattr (self , ' _initialised' ) and not hasattr (self , name ):
55+ # Check if the instance is initialised and the attribute doesn" t exist
56+ if hasattr (self , " _initialised" ) and not hasattr (self , name ):
5557 # Get a list of existing attributes for the error message
56- existing = ', ' .join (self .__dict__ .keys ())
58+ existing = ", " .join (self .__dict__ .keys ())
5759 raise AttributeError (
58- f' Cannot add new attribute " { name } " - only possible to ' +
59- f' modify existing attributes: { existing } .'
60+ f" Cannot add new attribute ' { name } ' - only possible to " +
61+ f" modify existing attributes: { existing } ."
6062 )
6163 # If checks pass, set the attribute using the standard method
6264 object .__setattr__ (self , name , value )
@@ -71,15 +73,16 @@ class ASUArrivals(RestrictAttributes):
7173 """
7274 def __init__ (self , stroke = 1.2 , tia = 9.3 , neuro = 3.6 , other = 3.2 ):
7375 """
74- Arguments:
75- stroke (float):
76- Stroke patient.
77- tia (float):
78- Transient ischaemic attack (TIA) patient.
79- neuro (float):
80- Complex neurological patient.
81- other (float):
82- Other patient types (including medical outliers).
76+ Parameters
77+ ----------
78+ stroke: float
79+ Stroke patient.
80+ tia: float
81+ Transient ischaemic attack (TIA) patient.
82+ neuro: float
83+ Complex neurological patient.
84+ other: float
85+ Other patient types (including medical outliers).
8386 """
8487 self .stroke = stroke
8588 self .tia = tia
@@ -96,13 +99,14 @@ class RehabArrivals(RestrictAttributes):
9699 """
97100 def __init__ (self , stroke = 21.8 , neuro = 31.7 , other = 28.6 ):
98101 """
99- Arguments:
100- stroke (float):
101- Stroke patient.
102- neuro (float):
103- Complex neurological patient.
104- other (float):
105- Other patient types.
102+ Parameters
103+ ----------
104+ stroke: float
105+ Stroke patient.
106+ neuro: float
107+ Complex neurological patient.
108+ other: float
109+ Other patient types.
106110 """
107111 self .stroke = stroke
108112 self .neuro = neuro
@@ -120,28 +124,29 @@ def __init__(
120124 neuro_mean = 4.0 , neuro_sd = 5.0 , other_mean = 3.8 , other_sd = 5.2
121125 ):
122126 """
123- Arguments:
124- stroke_no_esd_mean (float):
125- Mean LOS for stroke patients without early support discharge
126- (ESD) services.
127- stroke_no_esd_sd (float):
128- SD of LOS for stroke patients without ESD.
129- stroke_esd_mean (float):
130- Mean LOS for stroke patients with ESD.
131- stroke_esd_sd (float):
132- SD of LOS for stroke patients with ESD.
133- tia_mean (float):
134- Mean LOS for transient ischemic attack (TIA) patients.
135- tia_sd (float):
136- SD of LOS for TIA patients.
137- neuro_mean (float):
138- Mean LOS for complex neurological patients.
139- neuro_sd (float):
140- SD of LOS for complex neurological patients.
141- other_mean (float):
142- Mean LOS for other patient types.
143- other_sd (float):
144- SD of LOS for other patient types.
127+ Parameters
128+ ----------
129+ stroke_no_esd_mean: float
130+ Mean LOS for stroke patients without early support discharge (ESD)
131+ services.
132+ stroke_no_esd_sd: float
133+ SD of LOS for stroke patients without ESD.
134+ stroke_esd_mean: float
135+ Mean LOS for stroke patients with ESD.
136+ stroke_esd_sd: float
137+ SD of LOS for stroke patients with ESD.
138+ tia_mean: float
139+ Mean LOS for transient ischemic attack (TIA) patients.
140+ tia_sd: float
141+ SD of LOS for TIA patients.
142+ neuro_mean: float
143+ Mean LOS for complex neurological patients.
144+ neuro_sd: float
145+ SD of LOS for complex neurological patients.
146+ other_mean: float
147+ Mean LOS for other patient types.
148+ other_sd: float
149+ SD of LOS for other patient types.
145150 """
146151 self .stroke_no_esd_mean = stroke_no_esd_mean
147152 self .stroke_no_esd_sd = stroke_no_esd_sd
@@ -166,28 +171,29 @@ def __init__(
166171 neuro_mean = 27.6 , neuro_sd = 28.4 , other_mean = 16.1 , other_sd = 14.1
167172 ):
168173 """
169- Arguments:
170- stroke_no_esd_mean (float):
171- Mean LOS for stroke patients without early support discharge
172- (ESD) services.
173- stroke_no_esd_sd (float):
174- SD of LOS for stroke patients without ESD.
175- stroke_esd_mean (float):
176- Mean LOS for stroke patients with ESD.
177- stroke_esd_sd (float):
178- SD of LOS for stroke patients with ESD.
179- tia_mean (float):
180- Mean LOS for transient ischemic attack (TIA) patients.
181- tia_sd (float):
182- SD of LOS for TIA patients.
183- neuro_mean (float):
184- Mean LOS for complex neurological patients.
185- neuro_sd (float):
186- SD of LOS for complex neurological patients.
187- other_mean (float):
188- Mean LOS for other patient types.
189- other_sd (float):
190- SD of LOS for other patient types.
174+ Parameters
175+ ----------
176+ stroke_no_esd_mean: float
177+ Mean LOS for stroke patients without early support discharge (ESD)
178+ services.
179+ stroke_no_esd_sd: float
180+ SD of LOS for stroke patients without ESD.
181+ stroke_esd_mean: float
182+ Mean LOS for stroke patients with ESD.
183+ stroke_esd_sd: float
184+ SD of LOS for stroke patients with ESD.
185+ tia_mean: float
186+ Mean LOS for transient ischemic attack (TIA) patients.
187+ tia_sd: float
188+ SD of LOS for TIA patients.
189+ neuro_mean: float
190+ Mean LOS for complex neurological patients.
191+ neuro_sd: float
192+ SD of LOS for complex neurological patients.
193+ other_mean: float
194+ Mean LOS for other patient types.
195+ other_sd: float
196+ SD of LOS for other patient types.
191197 """
192198 self .stroke_no_esd_mean = stroke_no_esd_mean
193199 self .stroke_no_esd_sd = stroke_no_esd_sd
@@ -213,32 +219,33 @@ def __init__(
213219 other_stroke = 0.63 , other_tia = 0.98 , other_neuro = 0.84 , other_other = 0.85
214220 ):
215221 """
216- Arguments:
217- rehab_stroke (float):
218- Stroke patient to rehabilitation unit.
219- rehab_tia (float):
220- Transient ischemic attack (TIA) patient to rehabilitation unit.
221- rehab_neuro (float):
222- Complex neurological patient to rehabilitation unit.
223- rehab_other (float):
224- Other patient type to rehabilitation unit.
225- esd_stroke (float):
226- Stroke patient to early support discharge (ESD) services.
227- esd_tia (float):
228- TIA patient to ESD.
229- esd_neuro (float):
230- Complex neurological patient to ESD.
231- esd_other (float):
232- Other patient type to ESD.
233- other_stroke (float):
234- Stroke patient to other destinations (e.g., own home, care
235- home, mortality).
236- other_tia (float):
237- TIA patient to other destinations.
238- other_neuro (float):
239- Complex neurological patient to other destinations.
240- other_other (float):
241- Other patient type to other destinations.
222+ Parameters
223+ ----------
224+ rehab_stroke: float
225+ Stroke patient to rehabilitation unit.
226+ rehab_tia: float
227+ Transient ischemic attack (TIA) patient to rehabilitation unit.
228+ rehab_neuro: float
229+ Complex neurological patient to rehabilitation unit.
230+ rehab_other: float
231+ Other patient type to rehabilitation unit.
232+ esd_stroke: float
233+ Stroke patient to early support discharge (ESD) services.
234+ esd_tia: float
235+ TIA patient to ESD.
236+ esd_neuro: float
237+ Complex neurological patient to ESD.
238+ esd_other: float
239+ Other patient type to ESD.
240+ other_stroke: float
241+ Stroke patient to other destinations (e.g., own home, care
242+ home, mortality).
243+ other_tia: float
244+ TIA patient to other destinations.
245+ other_neuro: float
246+ Complex neurological patient to other destinations.
247+ other_other: float
248+ Other patient type to other destinations.
242249 """
243250 self .rehab_stroke = rehab_stroke
244251 self .rehab_tia = rehab_tia
@@ -265,24 +272,25 @@ def __init__(
265272 other_neuro = 0.91 , other_other = 0.88
266273 ):
267274 """
268- Arguments:
269- esd_stroke (float):
270- Stroke patient to early support discharge (ESD) services.
271- esd_tia (float):
272- Transient ischemic attack (TIA) patient to ESD.
273- esd_neuro (float):
274- Complex neurological patient to ESD.
275- esd_other (float):
276- Other patient type to ESD.
277- other_stroke (float):
278- Stroke patient to other destinations (e.g., own home, care
279- home, mortality).
280- other_tia (float):
281- TIA patient to other destinations.
282- other_neuro (float):
283- Complex neurological patient to other destinations.
284- other_other (float):
285- Other patient type to other destinations.
275+ Parameters
276+ ----------
277+ esd_stroke: float
278+ Stroke patient to early support discharge (ESD) services.
279+ esd_tia: float
280+ Transient ischemic attack (TIA) patient to ESD.
281+ esd_neuro: float
282+ Complex neurological patient to ESD.
283+ esd_other: float
284+ Other patient type to ESD.
285+ other_stroke: float
286+ Stroke patient to other destinations (e.g., own home, care home,
287+ mortality).
288+ other_tia: float
289+ TIA patient to other destinations.
290+ other_neuro: float
291+ Complex neurological patient to other destinations.
292+ other_other: float
293+ Other patient type to other destinations.
286294 """
287295 self .esd_stroke = esd_stroke
288296 self .esd_tia = esd_tia
@@ -305,29 +313,38 @@ def __init__(
305313 asu_los = ASULOS (),
306314 rehab_los = RehabLOS (),
307315 asu_routing = ASURouting (),
308- rehab_routing = RehabRouting ()
316+ rehab_routing = RehabRouting (),
317+ warm_up_period = 0 ,
318+ data_collection_period = 20
309319 ):
310320 """
311321 Initialise a parameter set for the simulation.
312322
313- Arguments:
314- asu_arrivals (ASUArrivals):
315- Arrival rates to the acute stroke unit (ASU).
316- rehab_arrivals (RehabArrivals):
317- Arrival rates to the rehabilitation unit.
318- asu_los (ASULOS):
319- Length of stay (LOS) distributions for patients in the ASU.
320- rehab_los (RehabLOS):
321- LOS distributions for patients in the rehabilitation unit.
322- asu_routing (ASURouting):
323- Transfer probabilities from the ASU to other destinations.
324- rehab_routing (RehabRouting):
325- Transfer probabilities from the rehabilitation unit to other
326- destinations.
323+ Parameters
324+ ----------
325+ asu_arrivals: ASUArrivals
326+ Arrival rates to the acute stroke unit (ASU) in days.
327+ rehab_arrivals: RehabArrivals
328+ Arrival rates to the rehabilitation unit in days.
329+ asu_los: ASULOS
330+ Length of stay (LOS) distributions for patients in the ASU in days.
331+ rehab_los: RehabLOS
332+ LOS distributions for patients in the rehabilitation unit in days.
333+ asu_routing: ASURouting
334+ Transfer probabilities from the ASU to other destinations.
335+ rehab_routing: RehabRouting
336+ Transfer probabilities from the rehabilitation unit to other
337+ destinations.
338+ warm_up_period: int
339+ Length of the warm-up period.
340+ data_collection_period: int
341+ Length of the data collection period.
327342 """
328343 self .asu_arrivals = asu_arrivals
329344 self .rehab_arrivals = rehab_arrivals
330345 self .asu_los = asu_los
331346 self .rehab_los = rehab_los
332347 self .asu_routing = asu_routing
333348 self .rehab_routing = rehab_routing
349+ self .warm_up_period = warm_up_period
350+ self .data_collection_period = data_collection_period
0 commit comments