Person
Represents an individual with attributes like age, gender, household status, etc.
A person object consists of demographic attributes such as age, sex, household type, and primary status (studying, working or inactive) and a unique identifier. Further, the person object is equipped with relational attributes such as a household identifier, the origin of the building they belong to, a parent identifier and a work location.
Attributes:
Name | Type | Description |
---|---|---|
uuid |
UUID
|
Unique identifier for the person. |
household_uuid |
Optional[UUID]
|
Identifier for the person's household. |
parent_uuid |
List[UUID]
|
Identifiers for the person's parents. |
age |
int
|
Age of the person. |
sex |
str
|
Gender of the person. |
household_type |
str
|
Type of household the person belongs to. |
household |
Optional[Household]
|
Household instance the person is part of. |
has_car |
bool
|
Whether the person owns a car. |
child_count |
int
|
Number of children the person has. |
is_head |
bool
|
If the person is the head of the household. |
is_child |
bool
|
If the person is a child in the household. |
origin |
Optional[Point]
|
Origin of the person. |
activity_sequence |
Optional[ActivitySequence]
|
Activity sequence associated with the person. |
instances |
list[Person]
|
Class attribute to track all person instances. |
Source code in tripsender\person.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
|
__init__(age, sex, household_type)
Initialize the Person with given attributes.
Source code in tripsender\person.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|
__repr__()
Representation of the Person instance.
Source code in tripsender\person.py
82 83 84 |
|
__str__()
String representation of the Person instance.
Source code in tripsender\person.py
86 87 88 89 |
|
clear_instances()
classmethod
Class method to clear all instances stored in the class.
Source code in tripsender\person.py
110 111 112 113 |
|
get_adults()
classmethod
Class method to get all persons above 17 years of age.
Source code in tripsender\person.py
115 116 117 118 |
|
get_female()
classmethod
Class method to get all female instances of the class.
Source code in tripsender\person.py
128 129 130 131 |
|
get_male()
classmethod
Class method to get all male instances of the class.
Source code in tripsender\person.py
133 134 135 136 |
|
info()
Retrieve a dictionary containing information about the person.
Source code in tripsender\person.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|
return_adults_df()
classmethod
Class method to return a dataframe of all Person instances.
Source code in tripsender\person.py
120 121 122 123 124 125 126 |
|
return_dataframe()
classmethod
Class method to return a dataframe of all Person instances.
Source code in tripsender\person.py
138 139 140 141 |
|
sample_from_bounds(bounds)
staticmethod
Static method to sample an age from a given range.
Parameters:
bounds : str A string representing the age range (e.g., '20-30').
Returns:
int A random age sampled from the given range.
Source code in tripsender\person.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
|