|
3499 | 3499 | "metadata": {}, |
3500 | 3500 | "outputs": [], |
3501 | 3501 | "source": [ |
3502 | | - "from pedpy import (\n", |
3503 | | - " compute_grid_cell_polygon_intersection_area,\n", |
3504 | | - " get_grid_cells,\n", |
3505 | | - ")\n", |
3506 | | - "\n", |
3507 | 3502 | "grid_size = 0.4\n", |
3508 | | - "grid_cells, _, _ = get_grid_cells(walkable_area=walkable_area, grid_size=grid_size)\n", |
3509 | 3503 | "\n", |
3510 | | - "min_frame_profiles = 250 # We use here just an excerpt of the\n", |
3511 | | - "max_frame_profiles = 400 # trajectory data to reduce compute time\n", |
| 3504 | + "min_frame_profiles = 500 # We use here just an excerpt of the\n", |
| 3505 | + "max_frame_profiles = 1000 # trajectory data to reduce compute time\n", |
3512 | 3506 | "\n", |
3513 | | - "profile_data = profile_data[profile_data.frame.between(min_frame_profiles, max_frame_profiles)]\n", |
3514 | | - "\n", |
3515 | | - "# Compute the grid intersection area for the resorted profile data (they have the same sorting)\n", |
3516 | | - "# for usage in multiple calls to not run the compute heavy operation multiple times\n", |
3517 | | - "(\n", |
3518 | | - " grid_cell_intersection_area,\n", |
3519 | | - " resorted_profile_data,\n", |
3520 | | - ") = compute_grid_cell_polygon_intersection_area(data=profile_data, grid_cells=grid_cells)" |
| 3507 | + "profile_data = profile_data[profile_data.frame.between(min_frame_profiles, max_frame_profiles)]" |
3521 | 3508 | ] |
3522 | 3509 | }, |
3523 | 3510 | { |
|
3567 | 3554 | }, |
3568 | 3555 | "outputs": [], |
3569 | 3556 | "source": [ |
3570 | | - "from pedpy import plot_measurement_setup\n", |
| 3557 | + "from pedpy import PEDPY_ORANGE, get_grid_cells, plot_measurement_setup\n", |
3571 | 3558 | "\n", |
3572 | | - "plot_measurement_setup(\n", |
| 3559 | + "ax = plot_measurement_setup(\n", |
3573 | 3560 | " walkable_area=walkable_area,\n", |
3574 | 3561 | " measurement_areas=[profile_measurement_area],\n", |
3575 | 3562 | " ma_line_width=2,\n", |
3576 | 3563 | " ma_alpha=0.2,\n", |
3577 | 3564 | ").set_aspect(\"equal\")\n", |
| 3565 | + "\n", |
| 3566 | + "grid_size = 0.4\n", |
| 3567 | + "grid_cells_measurement_area, _, _ = get_grid_cells(\n", |
| 3568 | + " axis_aligned_measurement_area=profile_measurement_area,\n", |
| 3569 | + " grid_size=grid_size,\n", |
| 3570 | + ")\n", |
| 3571 | + "grid_cells = [MeasurementArea(cell) for cell in grid_cells_measurement_area]\n", |
| 3572 | + "plot_measurement_setup(\n", |
| 3573 | + " measurement_areas=grid_cells,\n", |
| 3574 | + " ma_line_color=PEDPY_ORANGE,\n", |
| 3575 | + " ma_line_width=0.3,\n", |
| 3576 | + " ma_alpha=0,\n", |
| 3577 | + " axes=ax,\n", |
| 3578 | + ").set_aspect(\"equal\")\n", |
| 3579 | + "\n", |
3578 | 3580 | "plt.show()" |
3579 | 3581 | ] |
3580 | 3582 | }, |
|
3667 | 3669 | "from pedpy import SpeedMethod, compute_speed_profile\n", |
3668 | 3670 | "\n", |
3669 | 3671 | "voronoi_speed_profile = compute_speed_profile(\n", |
3670 | | - " data=resorted_profile_data,\n", |
| 3672 | + " data=profile_data,\n", |
3671 | 3673 | " walkable_area=walkable_area,\n", |
3672 | | - " grid_intersections_area=grid_cell_intersection_area,\n", |
3673 | 3674 | " grid_size=grid_size,\n", |
3674 | 3675 | " speed_method=SpeedMethod.VORONOI,\n", |
3675 | 3676 | ")\n", |
3676 | 3677 | "\n", |
3677 | 3678 | "arithmetic_speed_profile = compute_speed_profile(\n", |
3678 | | - " data=resorted_profile_data,\n", |
| 3679 | + " data=profile_data,\n", |
3679 | 3680 | " walkable_area=walkable_area,\n", |
3680 | | - " grid_intersections_area=grid_cell_intersection_area,\n", |
3681 | 3681 | " grid_size=grid_size,\n", |
3682 | 3682 | " speed_method=SpeedMethod.ARITHMETIC,\n", |
3683 | 3683 | ")\n", |
|
3770 | 3770 | "from pedpy import AxisAlignedMeasurementArea, SpeedMethod, compute_speed_profile\n", |
3771 | 3771 | "\n", |
3772 | 3772 | "voronoi_speed_profile = compute_speed_profile(\n", |
3773 | | - " data=resorted_profile_data_measurement_area,\n", |
| 3773 | + " data=profile_data,\n", |
3774 | 3774 | " walkable_area=walkable_area,\n", |
3775 | 3775 | " axis_aligned_measurement_area=profile_measurement_area,\n", |
3776 | | - " grid_intersections_area=grid_cell_intersection_area_measurement_area,\n", |
3777 | 3776 | " grid_size=grid_size,\n", |
3778 | 3777 | " speed_method=SpeedMethod.VORONOI,\n", |
3779 | 3778 | ")\n", |
3780 | 3779 | "\n", |
3781 | 3780 | "arithmetic_speed_profile = compute_speed_profile(\n", |
3782 | | - " data=resorted_profile_data_measurement_area,\n", |
| 3781 | + " data=profile_data,\n", |
3783 | 3782 | " walkable_area=walkable_area,\n", |
3784 | 3783 | " axis_aligned_measurement_area=profile_measurement_area,\n", |
3785 | | - " grid_intersections_area=grid_cell_intersection_area_measurement_area,\n", |
3786 | 3784 | " grid_size=grid_size,\n", |
3787 | 3785 | " speed_method=SpeedMethod.ARITHMETIC,\n", |
3788 | 3786 | ")\n", |
|
3916 | 3914 | "source": [ |
3917 | 3915 | "from pedpy import DensityMethod, compute_density_profile\n", |
3918 | 3916 | "\n", |
3919 | | - "# here it is important to use the resorted data, as it needs to be in the same ordering as \"grid_cell_intersection_area\"\n", |
3920 | 3917 | "voronoi_density_profile = compute_density_profile(\n", |
3921 | | - " data=resorted_profile_data,\n", |
| 3918 | + " data=profile_data,\n", |
3922 | 3919 | " walkable_area=walkable_area,\n", |
3923 | | - " grid_intersections_area=grid_cell_intersection_area,\n", |
3924 | 3920 | " grid_size=grid_size,\n", |
3925 | 3921 | " density_method=DensityMethod.VORONOI,\n", |
3926 | 3922 | ")\n", |
3927 | 3923 | "\n", |
3928 | | - "# here the unsorted data can be used\n", |
3929 | 3924 | "classic_density_profile = compute_density_profile(\n", |
3930 | 3925 | " data=profile_data,\n", |
3931 | 3926 | " walkable_area=walkable_area,\n", |
|
4005 | 4000 | "source": [ |
4006 | 4001 | "from pedpy import DensityMethod, compute_density_profile\n", |
4007 | 4002 | "\n", |
4008 | | - "# here it is important to use the resorted data, as it needs to be in the same ordering as \"grid_cell_intersection_area\"\n", |
4009 | 4003 | "voronoi_density_profile = compute_density_profile(\n", |
4010 | | - " data=resorted_profile_data_measurement_area,\n", |
| 4004 | + " data=profile_data,\n", |
4011 | 4005 | " walkable_area=walkable_area,\n", |
4012 | 4006 | " axis_aligned_measurement_area=profile_measurement_area,\n", |
4013 | | - " grid_intersections_area=grid_cell_intersection_area_measurement_area,\n", |
4014 | 4007 | " grid_size=grid_size,\n", |
4015 | 4008 | " density_method=DensityMethod.VORONOI,\n", |
4016 | 4009 | ")\n", |
4017 | 4010 | "\n", |
4018 | | - "# here the unsorted data can be used\n", |
4019 | 4011 | "classic_density_profile = compute_density_profile(\n", |
4020 | 4012 | " data=profile_data,\n", |
4021 | 4013 | " walkable_area=walkable_area,\n", |
|
0 commit comments