allow multiple uids
@@ -4,11 +4,13 @@ Defines the Person class and functions associated with making people.
#%% Imports
import numpy as np
+import sciris as sc
+from collections import defaultdict
from . import utils as cvu
from . import defaults as cvd
from . import base as cvb
from . import plotting as cvplt
-from collections import defaultdict
+
__all__ = ['People']
@@ -473,13 +475,13 @@ class People(cvb.BasePeople):
return fig
- def story(self, uid, output=False):
+ def story(self, uid, *args):
'''
Print out a short history of the named individual.
Args:
- uid (int): the person whose story is being recounted
- output (bool): whether to return the days and events of their life
+ uid (int/list): the person or people whose story is being recounted
+ args (list): extra people whose stories to print
**Example**::
@@ -505,6 +507,11 @@ class People(cvb.BasePeople):
llabel = f'"{lkey}"'
return llabel
+ uids = sc.promotetolist(uid)
+ uids.extend(args)
+
+ for uid in uids:
+
p = self[uid]
sex = 'female' if p.sex == 0 else 'male'
@@ -573,5 +580,4 @@ class People(cvb.BasePeople):
print(f'On day {day:.0f}, {uid} {event}')
else:
print(f'Nothing happened to {uid} during the simulation.')
- if output:
- return events
\ No newline at end of file
+ return
\ No newline at end of file
