pam.read.diary
add_hhs_from_hhs_attributes(population, hhs_attributes=None)
#
Source code in pam/read/diary.py
add_hhs_from_persons_attributes(population, persons_attributes=None)
#
Source code in pam/read/diary.py
add_hhs_from_trips(population, trips=None)
#
Source code in pam/read/diary.py
add_persons_from_persons_attributes(population, persons_attributes=None)
#
Source code in pam/read/diary.py
add_persons_from_trips(population, trips=None)
#
Source code in pam/read/diary.py
build_population(trips=None, persons_attributes=None, hhs_attributes=None)
#
Build a population of households and persons (without plans).
Built from available trips, persons_attributes and households_attributes data. Details of required table formats are in the README.
PARAMETER | DESCRIPTION |
---|---|
trips |
trips table. Defaults to None. |
persons_attributes |
persons attributes table. Defaults to None. |
hhs_attributes |
households attributes table. Defaults to None. |
RETURNS | DESCRIPTION |
---|---|
Population
|
pam.Population: population object |
Source code in pam/read/diary.py
from_to_travel_diary_read(trips, persons_attributes=None, hhs_attributes=None, include_loc=False, sort_by_seq=False)
#
Turn Diary Plan tabular data inputs into core population format.
Tabular data derived from travel survey and attributes.
This is a variation of the standard load_travel_diary() method because it does not require activity inference or home location. We expect broadly the same data schema except rather than purp (purpose) we use trips oact (origin activity) and dact (destination activity).
PARAMETER | DESCRIPTION |
---|---|
trips |
TYPE:
|
persons_attributes |
Defaults to None. |
hhs_attributes |
Defaults to None. |
include_loc |
optionally include location data as shapely Point geometries ('start_loc' and 'end_loc' columns) (Default value = False). Defaults to False.
TYPE:
|
sort_by_seq |
optionally force trip sorting as True or False. Defaults to False. |
RETURNS | DESCRIPTION |
---|---|
Population
|
core.Population: |
Source code in pam/read/diary.py
688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 |
|
load_travel_diary(trips, persons_attributes=None, hhs_attributes=None, sample_perc=None, tour_based=True, from_to=False, include_loc=False, sort_by_seq=None, trip_freq_as_person_freq=False, trip_freq_as_hh_freq=False)
#
Turn standard tabular data inputs (travel survey and attributes) into core population format.
PARAMETER | DESCRIPTION |
---|---|
trips |
|
persons_attributes |
Defaults to None. |
hhs_attributes |
Defaults to None. |
sample_perc |
If different to None, it samples the travel population by the corresponding percentage. Defaults to None.
TYPE:
|
tour_based |
Set to False to force a simpler trip-based purpose parser. Defaults to True.
TYPE:
|
from_to |
Set to True to force the from-to purpose parser (requires 'oact' and 'dact' trips columns). Defaults to False.
TYPE:
|
include_loc |
If True, include location data as shapely Point geometries ('start_loc' and 'end_loc' trips columns). Defaults to False.
TYPE:
|
sort_by_seq |
If not None, force trip sorting as True or False. Defaults to None.
TYPE:
|
trip_freq_as_person_freq |
Defaults to False.
TYPE:
|
trip_freq_as_hh_freq |
Defaults to False.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Population
|
core.Population: |
Source code in pam/read/diary.py
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 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 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 |
|
sample_population(trips_df, sample_perc, attributes_df=None, weight_col='freq')
#
Return the trips of a random sample of the travel population.
We merge the trips and attribute datasets to enable probability weights based on population demographics.
PARAMETER | DESCRIPTION |
---|---|
trips_df |
Trips dataset
TYPE:
|
sample_perc |
Sampling percentage
TYPE:
|
attributes_df |
Population attributes dataset. Defaults to None. |
weight_col |
The field to use for probability weighting. Defaults to "freq".
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
DataFrame
|
pd.DataFrame: a sampled version of the |
Source code in pam/read/diary.py
tour_based_travel_diary_read(trips, persons_attributes=None, hhs_attributes=None, include_loc=False, sort_by_seq=None)
#
Complex travel diray reader.
Will try to infer home activity and tour based purposes.
PARAMETER | DESCRIPTION |
---|---|
trips |
TYPE:
|
persons_attributes |
Defaults to None. |
hhs_attributes |
Defaults to None. |
include_loc |
optionally include location data as shapely Point geometries ('start_loc' and 'end_loc' columns). Defaults to False.
TYPE:
|
sort_by_seq |
optionally force trip sorting as True or False. Defaults to None. |
RETURNS | DESCRIPTION |
---|---|
Population
|
core.Population: |
Source code in pam/read/diary.py
484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 |
|
trip_based_travel_diary_read(trips, persons_attributes=None, hhs_attributes=None, include_loc=False, sort_by_seq=None)
#
Turn Activity Plan tabular data inputs into core population format.
Tabular data inputs are derived from travel survey and attributes.
This is a variation of the standard load_travel_diary() method because it does not require activity inference. However all plans are expected to be tour based, so assumed to start and end at home. We expect broadly the same data schema except rather than trip 'purpose' we use trips 'activity'.
PARAMETER | DESCRIPTION |
---|---|
trips |
TYPE:
|
persons_attributes |
Defaults to None. |
hhs_attributes |
Defaults to None. |
include_loc |
optionally include location data as shapely Point geometries ('start_loc' and 'end_loc' columns). Defaults to False.
TYPE:
|
sort_by_seq |
optionally force trip sorting as True or False. Defaults to None. |
RETURNS | DESCRIPTION |
---|---|
Population
|
core.Population: |
Source code in pam/read/diary.py
585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 |
|