Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
HuyLeDinhGia opened this issue Jul 22, 2024 · 1 comment
Labels
Bug Something isn't working/bug f

Comments

@HuyLeDinhGia
Copy link

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
    choices_df
    , 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

@HuyLeDinhGia HuyLeDinhGia added the Bug Something isn't working/bug f label Jul 22, 2024
@dhensle
Copy link
Contributor

dhensle commented Oct 1, 2024

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working/bug f
Projects
None yet
Development

No branches or pull requests

2 participants