ActivitySim / activitysim

An Open Platform for Activity-Based Travel Modeling
https://activitysim.github.io
BSD 3-Clause "New" or "Revised" License
192 stars 99 forks source link

Index out of bound when run ActivitySim Example Estimation with another dataset #880

Open HuyLeDinhGia opened 2 months ago

HuyLeDinhGia commented 2 months ago

Hi, I generated my data and used the Example Estimation as the default setting for the project. Then I got the issue as described below:

  1. Keep all the files in the Example Estimation Sample, only replace the data folder with these files which I generated (https://drive.google.com/file/d/1buKRg9HaBf4HTTevXJlrIoyvq1_kyLMm/view?usp=sharing)
  2. Run ActivitySim
  3. Got the issue with stack trace: Traceback (most recent call last): File "C:\Users\Lenovo\Downloads\Documents\workspace\activitysim\activitysim\cli\main.py", line 72, in main sys.exit(asim.execute()) File "C:\Users\Lenovo\Downloads\Documents\workspace\activitysim\activitysim\cli\cli.py", line 39, in execute return args.afunc(args) File "C:\Users\Lenovo\Downloads\Documents\workspace\activitysim\activitysim\cli\run.py", line 396, in run state.run( File "C:\Users\Lenovo\Downloads\Documents\workspace\activitysim\activitysim\core\workflow\runner.py", line 170, in call self.by_name(model) File "C:\Users\Lenovo\Downloads\Documents\workspace\activitysim\activitysim\core\workflow\runner.py", line 347, in by_name self._obj._context = run_named_step( File "C:\Users\Lenovo\Downloads\Documents\workspace\activitysim\activitysim\core\workflow\steps.py", line 83, in run_named_step step_func(context, kwargs) File "C:\Users\Lenovo\Downloads\Documents\workspace\activitysim\activitysim\core\workflow\steps.py", line 367, in run_step outcome = error_logging(wrapped_func)(state, *args, *kwargs) File "C:\Users\Lenovo\Downloads\Documents\workspace\activitysim\activitysim\core\workflow\steps.py", line 46, in wrapper return func(args, kwargs) File "C:\Users\Lenovo\Downloads\Documents\workspace\activitysim\activitysim\abm\models\location_choice.py", line 1241, in school_location iterate_location_choice( File "C:\Users\Lenovo\Downloads\Documents\workspace\activitysim\activitysim\abm\models\location_choice.py", line 1020, in iterate_location_choice choicesdf, save_sample_df = run_location_choice( File "C:\Users\Lenovo\Downloads\Documents\workspace\activitysim\activitysim\abm\models\location_choice.py", line 814, in run_location_choice choices_df = run_location_simulate( File "C:\Users\Lenovo\Downloads\Documents\workspace\activitysim\activitysim\abm\models\location_choice.py", line 685, in run_location_simulate choices = interaction_sample_simulate( File "C:\Users\Lenovo\Downloads\Documents\workspace\activitysim\activitysim\core\interaction_sample_simulate.py", line 499, in interaction_sample_simulate choices = _interaction_sample_simulate( File "C:\Users\Lenovo\Downloads\Documents\workspace\activitysim\activitysim\core\interaction_sample_simulate.py", line 356, in _interaction_sample_simulate choices = alternatives[choice_column].take(positions + first_row_offsets) File "C:\Users\Lenovo\Downloads\Documents\workspace\ASIM-ENV\lib\site-packages\pandas\core\series.py", line 907, in take new_index = self.index.take(indices) File "C:\Users\Lenovo\Downloads\Documents\workspace\ASIM-ENV\lib\site-packages\pandas\core\indexes\base.py", line 1121, in take taken = algos.take( File "C:\Users\Lenovo\Downloads\Documents\workspace\ASIM-ENV\lib\site-packages\pandas\core\algorithms.py", line 1449, in take result = arr.take(indices, axis=axis) IndexError: index 3988 is out of bounds for axis 0 with size 3985

I tried to debug. The position and offset in function _interaction_sample_simulate always don't match the index of alternatives. It's not clear which data in the dataset is incorrect. The number of zones is reduced to 2 but still got issue.

Can anyone help me with this?

Regards, Huy

dhensle commented 1 week ago

@HuyLeDinhGia Can you please verify that all locations (workplace, school, home zone id, tour & trip OD) are assigned to "valid" zones, i.e. exist in the landuse file, have non-zero size terms if applicable, and also exist in the skim matrices.