def cdap_indiv_spec(configs_dir): """ spec to compute the activity utilities for each individual hh member with no interactions with other household members taken into account """ f = os.path.join(configs_dir, 'cdap_indiv_and_hhsize1.csv') return asim.read_model_spec(f).fillna(0)
def test_read_model_spec(spec_name, desc_name, expr_name): spec = asim.read_model_spec( spec_name, description_name=desc_name, expression_name=expr_name) assert len(spec) == 4 assert spec.index.name == 'expression' assert list(spec.columns) == ['alt0', 'alt1'] npt.assert_array_equal( spec.as_matrix(), [[1.1, 11], [2.2, 22], [3.3, 33], [4.4, 44]])
def cdap_fixed_relative_proportions(configs_dir): """ spec to compute/specify the relative proportions of each activity (M, N, H) that should be used to choose activities for additional household members not handled by CDAP This spec is handled much like an activitysim logit utility spec, EXCEPT that the values computed are relative proportions, not utilities (i.e. values are not exponentiated before being normalized to probabilities summing to 1.0) """ f = os.path.join(configs_dir, 'cdap_fixed_relative_proportions.csv') return asim.read_model_spec(f).fillna(0)
def cdap_3_person_spec(configs_dir): f = os.path.join(configs_dir, 'configs', "cdap_3_person.csv") return asim.read_model_spec(f).fillna(0)
def mandatory_tour_frequency_spec(configs_dir): f = os.path.join(configs_dir, 'configs', "mandatory_tour_frequency.csv") return asim.read_model_spec(f).fillna(0)
def mode_choice_spec_df(configs_dir): with open(os.path.join(configs_dir, "configs", "tour_mode_choice.csv")) as f: return asim.read_model_spec(f)
def trip_mode_choice_spec_df(configs_dir): with open(os.path.join(configs_dir, "configs", "trip_mode_choice.csv")) as f: return asim.read_model_spec(f)
def school_location_spec(configs_dir): f = os.path.join(configs_dir, 'configs', "school_location.csv") return asim.read_model_spec(f).fillna(0)
def tdd_non_mandatory_spec(configs_dir): f = os.path.join(configs_dir, 'configs', 'tour_departure_and_duration_nonmandatory.csv') return asim.read_model_spec(f).fillna(0)
def non_mandatory_tour_frequency_spec(configs_dir): f = os.path.join(configs_dir, 'configs', "non_mandatory_tour_frequency.csv") return asim.read_model_spec(f).fillna(0)
def mode_choice_spec(configs_dir, mode_choice_coefficients): f = os.path.join(configs_dir, 'configs', "mode_choice_work.csv") df = asim.read_model_spec(f) df['work'] = evaluate_expression_list(df['work'], mode_choice_coefficients.to_dict()) return df.set_index('Alternative', append=True)
def auto_ownership_spec(configs_dir): f = os.path.join(configs_dir, 'configs', "auto_ownership.csv") return asim.read_model_spec(f).fillna(0)
def pet_spec(configs_dir): f = os.path.join(configs_dir, 'configs', "pet_activity.csv") return asim.read_model_spec(f).fillna(0)
def cdap_final_rules(configs_dir): f = os.path.join(configs_dir, 'configs', "cdap_final_rules.csv") return asim.read_model_spec(f).fillna(0)
def trip_mode_choice_spec_df(configs_dir): with open(os.path.join(configs_dir, 'trip_mode_choice.csv')) as f: return asim.read_model_spec(f)
def tdd_school_spec(configs_dir): f = os.path.join(configs_dir, 'configs', 'tour_departure_and_duration_school.csv') return asim.read_model_spec(f).fillna(0)
def cdap_all_people(configs_dir): f = os.path.join(configs_dir, 'configs', "cdap_all_people.csv") return asim.read_model_spec(f).fillna(0)
def destination_choice_spec(configs_dir): f = os.path.join(configs_dir, 'configs', 'destination_choice.csv') return asim.read_model_spec(f).fillna(0)
def workplace_location_spec(configs_dir): f = os.path.join(configs_dir, 'configs', "workplace_location.csv") return asim.read_model_spec(f).fillna(0)
def cdap_3_person_spec(configs_dir): f = os.path.join(configs_dir, "configs", "cdap_3_person.csv") return asim.read_model_spec(f).fillna(0)
def cdap_final_rules(configs_dir): f = os.path.join(configs_dir, "configs", "cdap_final_rules.csv") return asim.read_model_spec(f).fillna(0)
def cdap_all_people(configs_dir): f = os.path.join(configs_dir, "configs", "cdap_all_people.csv") return asim.read_model_spec(f).fillna(0)
def destination_choice_spec(configs_dir): f = os.path.join(configs_dir, 'destination_choice.csv') return asim.read_model_spec(f).fillna(0)
def spec(spec_name, desc_name, expr_name): return asim.read_model_spec( spec_name, description_name=desc_name, expression_name=expr_name)