How to use the activitysim.core.inject.injectable function in activitysim

To help you get started, we’ve selected a few activitysim examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ActivitySim / activitysim / activitysim / abm / tables / table_dict.py View on Github external
@inject.injectable()
def traceable_tables():

    # names of all traceable tables ordered by dependency on household_id
    # e.g. 'persons' has to be registered AFTER 'households'

    return TRACEABLE_TABLES
github ActivitySim / activitysim / activitysim / abm / models / mode_choice.py View on Github external
@inject.injectable()
def tour_mode_choice_spec(tour_mode_choice_spec_df,
                          tour_mode_choice_coeffs,
                          tour_mode_choice_settings,
                          trace_hh_id):
    return _mode_choice_spec(tour_mode_choice_spec_df,
                             tour_mode_choice_coeffs,
                             tour_mode_choice_settings,
                             trace_spec=trace_hh_id,
                             trace_label='tour_mode_choice')
github ActivitySim / activitysim / activitysim / abm / misc.py View on Github external
@inject.injectable(cache=True)
def trace_od(settings):

    od = settings.get('trace_od', None)

    if od and not (isinstance(od, list) and len(od) == 2 and all(isinstance(x, int) for x in od)):
        logger.warning("setting trace_od should be a list of length 2, but was %s" % od)
        od = None

    return od
github ActivitySim / activitysim / activitysim / core / config.py View on Github external
@inject.injectable()
def rng_base_seed():
    return 0
github ActivitySim / activitysim / example_multi / simulation.py View on Github external
@inject.injectable(override=True)
def data_dir():
    return os.path.join(DATA_REPO)
github ActivitySim / activitysim / activitysim / abm / tables / size_terms.py View on Github external
@inject.injectable(cache=True)
def size_terms():
    f = config.config_file_path('destination_choice_size_terms.csv')
    return pd.read_csv(f, comment='#', index_col='segment')
github ActivitySim / activitysim / activitysim / abm / models / stop_frequency.py View on Github external
@inject.injectable()
def stop_frequency_alts():
    # alt file for building trips even though simulation is simple_simulate not interaction_simulate
    file_path = config.config_file_path('stop_frequency_alternatives.csv')
    df = pd.read_csv(file_path, comment='#')
    df.set_index('alt', inplace=True)
    return df
github ActivitySim / activitysim / activitysim / abm / tables / time_window.py View on Github external
@inject.injectable(cache=True)
def tdd_intersects(tdd_windows):

    intersects = \
        (tdd_windows == I_MIDDLE) * ~I_EMPTY + \
        (tdd_windows == I_START) * ~I_END + \
        (tdd_windows == I_END) * ~I_START + \
        (tdd_windows == I_START_END) * ~I_START_END

    return intersects
github ActivitySim / activitysim / example_multiple_zone / extensions / skims.py View on Github external
@inject.injectable(cache=True)
def cache_skim_key_values(settings):
    return settings['skim_time_periods']['labels']
github ActivitySim / activitysim / activitysim / abm / models / mode_choice.py View on Github external
@inject.injectable()
def trip_mode_choice_spec(trip_mode_choice_spec_df,
                          trip_mode_choice_coeffs,
                          trip_mode_choice_settings,
                          trace_hh_id):
    return _mode_choice_spec(trip_mode_choice_spec_df,
                             trip_mode_choice_coeffs,
                             trip_mode_choice_settings,
                             trace_spec=trace_hh_id,
                             trace_label='trip_mode_choice')