Skip to content

Commit

Permalink
Merge pull request #694 from camsys/orca-cleanup
Browse files Browse the repository at this point in the history
orca residual cleanup
  • Loading branch information
jpn-- authored Nov 22, 2023
2 parents 460203c + d8f8fcb commit 2ff39b8
Show file tree
Hide file tree
Showing 19 changed files with 35 additions and 42 deletions.
1 change: 0 additions & 1 deletion activitysim/abm/models/tour_mode_choice.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import numpy as np
import pandas as pd
from orca import orca

from activitysim.abm.models.util import annotate, school_escort_tours_trips, trip
from activitysim.abm.models.util.mode import run_tour_mode_choice_simulate
Expand Down
12 changes: 5 additions & 7 deletions activitysim/abm/models/tour_od_choice.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,15 @@ def tour_od_choice(

Parameters
----------
tours : orca.DataFrameWrapper
tours : pd.DataFrame
lazy-loaded tours table
persons : orca.DataFrameWrapper
persons : pd.DataFrame
lazy-loaded persons table
households : orca.DataFrameWrapper
households : pd.DataFrame
lazy-loaded households table
land_use : orca.DataFrameWrapper
land_use : pd.DataFrame
lazy-loaded land use data table
stop_frequency_alts : orca.DataFrameWrapper
lazy-loaded table of stop frequency alternatives, e.g. "1out2in"
network_los : orca._InjectableFuncWrapper
network_los : los.Network_LOS
lazy-loaded activitysim.los.Network_LOS object
chunk_size
simulation chunk size, set in main settings.yaml
Expand Down
1 change: 0 additions & 1 deletion activitysim/abm/models/util/tour_od.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import numpy as np
import pandas as pd
from orca import orca

from activitysim.abm.models.util import logsums as logsum
from activitysim.abm.models.util import trip
Expand Down
13 changes: 6 additions & 7 deletions activitysim/abm/models/vehicle_allocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,12 @@ def vehicle_allocation(
Parameters
----------
state : workflow.State
persons : orca.DataFrameWrapper
households : orca.DataFrameWrapper
vehicles : orca.DataFrameWrapper
vehicles_merged : orca.DataFrameWrapper
tours : orca.DataFrameWrapper
tours_merged : orca.DataFrameWrapper
chunk_size : orca.injectable
persons : pd.DataFrame
households : pd.DataFrame
vehicles : pd.DataFrame
tours : pd.DataFrame
tours_merged : pd.DataFrame
network_los : los.Network_LOS
"""
trace_label = "vehicle_allocation"
model_settings_file_name = "vehicle_allocation.yaml"
Expand Down
8 changes: 4 additions & 4 deletions activitysim/abm/models/vehicle_type_choice.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def iterate_vehicle_type_choice(
locals_dict : dict
additional variables available when writing expressions
estimator : Estimator object
chunk_size : orca.injectable
chunk_size : int
trace_label : str

Returns
Expand Down Expand Up @@ -516,9 +516,9 @@ def vehicle_type_choice(

Parameters
----------
persons : orca.DataFrameWrapper
households : orca.DataFrameWrapper
vehicles : orca.DataFrameWrapper
persons : pd.DataFrame
households : pd.DataFrame
vehicles : pd.DataFrame
vehicles_merged : DataFrame
"""
trace_label = "vehicle_type_choice"
Expand Down
2 changes: 1 addition & 1 deletion activitysim/benchmarking/componentwise.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def run_component(state, component_name):
def teardown_component(state, component_name):
logger.info("teardown_component: %s", component_name)

# use the pipeline module to clear out all the orca tables, so
# use the pipeline module to clear out all the tables, so
# the next benchmark run has a clean slate.
# anything needed should be reloaded from the pipeline checkpoint file
pipeline_tables = state.registered_tables()
Expand Down
3 changes: 2 additions & 1 deletion activitysim/cli/benchmark.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import json
import os
import shutil
Expand Down Expand Up @@ -43,7 +45,6 @@
"pyyaml": [],
"pytables": [],
"toolz": [],
"orca": [],
"psutil": [],
"requests": [],
"numba": ["0.54"],
Expand Down
3 changes: 0 additions & 3 deletions activitysim/core/test/utils_testing.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Orca
# Copyright (C) 2016 UrbanSim Inc.
# See full license in LICENSE.
from __future__ import annotations

import numpy as np
Expand Down
4 changes: 2 additions & 2 deletions activitysim/core/workflow/checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ def load(self, checkpoint_name: str, store=None):
table_name, checkpoint_name=last_checkpoint[table_name], store=store
)
logger.info("load_checkpoint table %s %s" % (table_name, df.shape))
# register it as an orca table
# register it as an workflow table
self._obj.add_table(table_name, df)
loaded_tables[table_name] = df
if table_name == "land_use" and "_original_zone_id" in df.columns:
Expand Down Expand Up @@ -1144,7 +1144,7 @@ def load_dataframe(self, table_name, checkpoint_name=None):
Return pandas dataframe corresponding to table_name

if checkpoint_name is None, return the current (most recent) version of the table.
The table can be a checkpointed table or any registered orca table (e.g. function table)
The table can be a checkpointed table or any registered table (e.g. function table)

if checkpoint_name is specified, return table as it was at that checkpoint
(the most recently checkpointed version of the table at or before checkpoint_name)
Expand Down
2 changes: 1 addition & 1 deletion activitysim/core/workflow/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def by_name(self, model_name, **kwargs):
Parameters
----------
model_name : str
model_name is assumed to be the name of a registered orca step
model_name is assumed to be the name of a registered workflow step
"""
self.t0 = time.time()
try:
Expand Down
6 changes: 3 additions & 3 deletions activitysim/core/workflow/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ def get_table(self, table_name, checkpoint_name=None):
Return pandas dataframe corresponding to table_name

if checkpoint_name is None, return the current (most recent) version of the table.
The table can be a checkpointed table or any registered orca table (e.g. function table)
The table can be a checkpointed table or any registered table (e.g. function table)

if checkpoint_name is specified, return table as it was at that checkpoint
(the most recently checkpointed version of the table at or before checkpoint_name)
Expand Down Expand Up @@ -1058,7 +1058,7 @@ def extend_table(self, table_name, df, axis=0):
Parameters
----------
table_name : str
orca/inject table name
potentially existing table name
df : pandas DataFrame
"""
assert axis in [0, 1]
Expand Down Expand Up @@ -1095,7 +1095,7 @@ def extend_table(self, table_name, df, axis=0):

def drop_table(self, table_name):
if self.is_table(table_name):
logger.debug("drop_table dropping orca table '%s'" % table_name)
logger.debug("drop_table dropping table '%s'" % table_name)
self._context.pop(table_name, None)
self.existing_table_status.pop(table_name)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def parking_location_choice_at_university(
the tour mode is auto. Parking locations are sampled weighted by the number of parking spots.

The main interface to this model is the parking_location_choice_at_university() function.
This function is registered as an orca step in the example Pipeline.
This function is registered as a step in the example Pipeline.
"""

trace_label = "parking_location_choice_at_university"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def stop_frequency_university_parking(
and after groups of trips that are on campus zones.

The main interface to this model is the stop_frequency_university_parking() function.
This function is registered as an orca step in the example Pipeline.
This function is registered as a step in the example Pipeline.
"""

trace_label = "stop_frequency_university_parking"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def university_location_zone_override(
done to replicate the fact that university students can have classes all over campus.

The main interface to this model is the university_location_zone_override() function.
This function is registered as an orca step in the example Pipeline.
This function is registered as a step in the example Pipeline.
"""

trace_label = "university_location_zone_override"
Expand Down Expand Up @@ -171,7 +171,7 @@ def trip_destination_univ_zone_override(
already handled in university_location_zone_override.

The main interface to this model is the trip_destination_univ_zone_override() function.
This function is registered as an orca step in the example Pipeline.
This function is registered as a step in the example Pipeline.
"""

trace_label = "trip_destination_univ_zone_override"
Expand Down
2 changes: 1 addition & 1 deletion test/cdap/test_cdap.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from numpy import dot
from numpy.linalg import norm

# import models is necessary to initalize the model steps with orca
# import models is necessary to initalize the model steps
from activitysim.abm import models # noqa: F401
from activitysim.core import config, tracing, workflow
from activitysim.core.util import read_csv, to_csv
Expand Down
2 changes: 1 addition & 1 deletion test/joint_tours/test_joint_tours.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from numpy import dot
from numpy.linalg import norm

# import models is necessary to initalize the model steps with orca
# import models is necessary to initalize the model steps
from activitysim.abm import models # noqa: F401
from activitysim.core import workflow
from activitysim.core.util import read_csv, to_csv
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from numpy import dot
from numpy.linalg import norm

# import models is necessary to initalize the model steps with orca
# import models is necessary to initalize the model steps
from activitysim.abm import models # noqa: F401
from activitysim.core import config, tracing, workflow
from activitysim.core.util import read_csv, to_csv
Expand Down
4 changes: 1 addition & 3 deletions test/parking_location/test_parking_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@
from pathlib import Path

import numpy as np
import orca
import pandas as pd
import pytest
import yaml
from numpy import dot
from numpy.linalg import norm

# import models is necessary to initalize the model steps with orca
# import models is necessary to initalize the model steps
from activitysim.abm import models
from activitysim.abm.models.util import estimation
from activitysim.core import config, simulate, tracing, workflow
from activitysim.core.util import read_csv, to_csv

Expand Down
4 changes: 3 additions & 1 deletion test/summarize/test_summarize.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from __future__ import annotations

import logging
import os
from pathlib import Path

import pandas as pd
import pytest

# import models is necessary to initalize the model steps with orca
# import models is necessary to initalize the model steps
from activitysim.abm import models
from activitysim.core import los, workflow

Expand Down

0 comments on commit 2ff39b8

Please sign in to comment.