Configures the exp
object by adding parameters for all user-specified interventions.
This function checks the list of interventions in the exp
object and updates the
object with the necessary parameters for each supported intervention. If no
interventions are specified, a message is printed. If an invalid intervention is
specified, a ValueError
is raised.
Currently, the function supports the cc_step
intervention and includes a placeholder
for other potential interventions (e.g., smc
).
Parameters: |
-
exp
(object )
–
An object representing the experiment, which should have an
intervention_list attribute (a list of strings specifying interventions).
|
Returns: |
-
object –
The updated exp object with added parameters for specified interventions.
|
Raises: |
-
ValueError
–
If an invalid intervention is specified in the intervention_list .
|
Source code in utility\helper_interventions.py
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42 | def exp_params_to_update(exp):
"""
Configures the `exp` object by adding parameters for all user-specified interventions.
This function checks the list of interventions in the `exp` object and updates the
object with the necessary parameters for each supported intervention. If no
interventions are specified, a message is printed. If an invalid intervention is
specified, a `ValueError` is raised.
Currently, the function supports the `cc_step` intervention and includes a placeholder
for other potential interventions (e.g., `smc`).
Args:
exp (object): An object representing the experiment, which should have an
`intervention_list` attribute (a list of strings specifying interventions).
Returns:
object: The updated `exp` object with added parameters for specified interventions.
Raises:
ValueError: If an invalid intervention is specified in the `intervention_list`.
"""
if not exp.intervention_list or exp.intervention_list == []:
print('No interventions specified')
else:
if 'cc_step' in exp.intervention_list:
print('Adding parameters for cc_step')
exp = cc_step_params(exp)
# if 'smc' in exp.intervention_list:
# print('Adding parameters for smc')
# exp = smc_params(exp)
else:
raise ValueError('Invalid intervention specified. Note that case management is automatically included.')
return exp
|