Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@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
@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')
@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
@inject.injectable()
def rng_base_seed():
return 0
@inject.injectable(override=True)
def data_dir():
return os.path.join(DATA_REPO)
@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')
@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
@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
@inject.injectable(cache=True)
def cache_skim_key_values(settings):
return settings['skim_time_periods']['labels']
@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')