Skip to content

Commit

Permalink
Merge pull request #580 from camsys/small-fixes
Browse files Browse the repository at this point in the history
Small fixes
  • Loading branch information
jpn-- committed Aug 11, 2022
2 parents 3b7e551 + e4910e5 commit 0412a0b
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 107 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.0.4
current_version = 1.1.0
commit = True
tag = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>.*))?
Expand Down
2 changes: 1 addition & 1 deletion activitysim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# See full license in LICENSE.txt.


__version__ = "1.0.4"
__version__ = "1.1.0"
__doc__ = "Activity-Based Travel Modeling"
2 changes: 1 addition & 1 deletion activitysim/abm/models/tour_mode_choice.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def tour_mode_choice_simulate(
# mtctm1 school tour_type includes univ, which has different coefficients from elementary and HS
# we should either add this column when tours created or add univ to tour_types
not_university = (primary_tours_merged.tour_type != "school") | ~(
primary_tours_merged.is_university
primary_tours_merged.is_university.astype(bool)
if "is_university" in primary_tours_merged.columns
else False
)
Expand Down
7 changes: 0 additions & 7 deletions activitysim/abm/test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,6 @@ def initialize_pipeline(
net_los.load_data()
orca.add_injectable("network_los", net_los)

# Add an output directory in current working directory if it's not already there
try:
os.makedirs("output")
except FileExistsError:
# directory already exists
pass

# Add the dataframes to the pipeline
pipeline.open_pipeline()
pipeline.add_checkpoint(module)
Expand Down
2 changes: 2 additions & 0 deletions activitysim/cli/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ def download_asset(url, target_path, sha256=None):
f" expected checksum {sha256}\n"
f" computed checksum {computed_sha256}"
)
elif not sha256:
print(f" computed checksum {computed_sha256}")


def sha256_checksum(filename, block_size=65536):
Expand Down
21 changes: 14 additions & 7 deletions activitysim/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import glob
import logging
import os
import sys
import struct
import time
import warnings

import yaml
Expand Down Expand Up @@ -340,13 +341,19 @@ def trace_file_path(file_name):

output_dir = inject.get_injectable("output_dir")

# - check for optional trace subfolder
if os.path.exists(os.path.join(output_dir, "trace")):
output_dir = os.path.join(output_dir, "trace")
else:
file_name = "trace.%s" % (file_name,)
# - check for trace subfolder, create it if missing
trace_dir = os.path.join(output_dir, "trace")
if not os.path.exists(trace_dir):
os.makedirs(trace_dir)

file_path = os.path.join(output_dir, file_name)
# construct a unique tail string from the time
# this is a convenience for opening multiple similarly named trace files
tail = hex(struct.unpack("<Q", struct.pack("<d", time.time()))[0])[-6:]

file_parts = file_name.split(".")

file_path = os.path.join(trace_dir, *file_parts[:-1]) + f"-{tail}.{file_parts[-1]}"
os.makedirs(os.path.dirname(file_path), exist_ok=True)
return file_path


Expand Down
28 changes: 19 additions & 9 deletions activitysim/examples/example_manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -858,29 +858,39 @@
- prototype_sandag_xborder/simulation.py
- https://raw.githubusercontent.com/ActivitySim/activitysim_resources/master/sandag_xborder/households_xborder.csv
data/households_xborder.csv
d5eacdab200955de06bd70761c648624734740a05738e9ab387502654283acdd
- https://media.githubusercontent.com/media/activitysim/activitysim_resources/master/sandag_xborder/maz_maz_walk.csv
data/maz_maz_walk.csv
data/maz_maz_walk.csv
027bb92325cd3d19a68c0608d8f909b075a857d4a2793dd6b75a183d371bc1e0
- https://raw.githubusercontent.com/activitysim/activitysim_resources/master/sandag_xborder/maz_tap_walk.csv
data/maz_tap_walk.csv
data/maz_tap_walk.csv
a5ba44307843ed3dd73448abe61b585d3c4f6a795414f4035cb14f2606a89c8b
- https://raw.githubusercontent.com/activitysim/activitysim_resources/master/sandag_xborder/mazs_xborder.csv
data/mazs_xborder.csv
- https://raw.githubusercontent.com/activitysim/activitysim_resources/master/sandag_xborder/persons_xborder.csv
data/persons_xborder.csv
data/mazs_xborder.csv
2d481ec20f69204fc02a259d2d7c4e3d955d6a83b13d7bae920c9c7f8e28c517
- prototype_sandag_xborder/data/persons_xborder.csv # this matches the local tours_xborder, see below
- https://raw.githubusercontent.com/activitysim/activitysim_resources/master/sandag_xborder/tap_lines.csv
data/tap_lines.csv
750745a33f39963f0c3e4efa6135ff89fb7dd49f58f17cdbd90d62e7057fea01
- https://raw.githubusercontent.com/activitysim/activitysim_resources/master/sandag_xborder/taps.csv
data/taps.csv
- https://media.githubusercontent.com/media/activitysim/activitysim_resources/master/sandag_xborder/tours_xborder.csv
data/tours_xborder.csv
data/taps.csv
9a6a29eb17079583e0c235525a58d301ab93f2b3a3bce537b142c85a0ad46606
- prototype_sandag_xborder/data/tours_xborder.csv # the file on activitysim_resources is not consistent with this model
- https://media.githubusercontent.com/media/activitysim/activitysim_resources/master/sandag_xborder/transit_skims_xborder.omx
data/transit_skims_xborder.omx
8d5544cc6b543c6b45e77968efca8d62b7ec8b03bd30bdc5e46cd291b4e6b8d3
- https://media.githubusercontent.com/media/activitysim/activitysim_resources/master/sandag_xborder/traffic_skims_xborder_AM.omx
data/traffic_skims_xborder_AM.omx
b7f675e78d0d5f214b9ee4d5a4bb91a66692be1776f474381b8a024e3fcbf4a5
- https://media.githubusercontent.com/media/activitysim/activitysim_resources/master/sandag_xborder/traffic_skims_xborder_EA.omx
data/traffic_skims_xborder_EA.omx
3d4978cba03c1fe5013bcc624b75e90456fe2ac723ca031ce0a1a50c758c3a92
- https://media.githubusercontent.com/media/activitysim/activitysim_resources/master/sandag_xborder/traffic_skims_xborder_EV.omx
data/traffic_skims_xborder_EV.omx
3826807fbbf5a62b97a70022ea6979cd9d16129e326e5570159221db1cbc4584
- https://media.githubusercontent.com/media/activitysim/activitysim_resources/master/sandag_xborder/traffic_skims_xborder_MD.omx
data/traffic_skims_xborder_MD.omx
9a83cf893e459019328aab726c4bd0fdcd38a2b5ecb88e0aa4a880b6104bbd3a
- https://media.githubusercontent.com/media/activitysim/activitysim_resources/master/sandag_xborder/traffic_skims_xborder_PM.omx
data/traffic_skims_xborder_PM.omx
data/traffic_skims_xborder_PM.omx
87544b59488c4ca654ae8d9756dfb3a8226b85faa21e631339d86fae5dc60feb
29 changes: 1 addition & 28 deletions activitysim/examples/prototype_arc/configs/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,11 @@ input_table_list:
np: hhsize
nwrkrs_esr: num_workers
keep_columns:
#- household_id
- home_zone_id
- hhsize
- num_workers
- hincp
#- hhincAdj
#- adjinc
#- veh
- hht
#- bld
#- type
- tablename: persons
filename: persons.csv
# The index column is set before keep_columns,
Expand All @@ -30,56 +24,35 @@ input_table_list:
maz: home_zone_id
sporder: PNUM
keep_columns:
#- person_id
- household_id
- home_zone_id
- PNUM
- agep
#- employed
- pecasOcc
- sex
- esr
- wkw
- wkhp
#-mil
- schg
#-schl
#-indp02
#-indp07
#-occp02
#-occp10
#-n
- tablename: land_use
filename: land_use.csv
# The index column is set before keep_columns,
# so don't put index in keep columns
index_col: zone_id
# rename_columns:
#
keep_columns:
#- TAZ
# - construc
# - manufac
# - TCU
# - wholesl
- retail
# - FIRE
- service
# - private
# - govt
- emp
- pop
- hshld
- univ
- acres
# - otherEmp
# - district
- PARKTOT
- PARKLNG
- PROPFREE
- PARKRATE
- areatype
# - county
- county
- CBDFlag
- N11
- N21
Expand Down
80 changes: 27 additions & 53 deletions activitysim/examples/prototype_arc/configs/settings_mp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,80 +6,53 @@ input_table_list:
# so don't put index in keep columns
index_col: household_id
rename_columns:
maz: zone_id
maz: home_zone_id
np: hhsize
nwrkrs_esr: num_workers
keep_columns:
#- household_id
- zone_id
- home_zone_id
- hhsize
- num_workers
- hincp
#- hhincAdj
#- adjinc
#- veh
- hht
#- bld
#- type
- tablename: persons
filename: persons.csv
# The index column is set before keep_columns,
# so don't put index in keep columns
index_col: person_id
rename_columns:
maz: zone_id
maz: home_zone_id
sporder: PNUM
keep_columns:
#- person_id
- household_id
- zone_id
- home_zone_id
- PNUM
- agep
#- employed
- pecasOcc
- sex
- esr
- wkw
- wkhp
#-mil
- schg
#-schl
#-indp02
#-indp07
#-occp02
#-occp10
#-n
- tablename: land_use
filename: land_use.csv
# The index column is set before keep_columns,
# so don't put index in keep columns
index_col: zone_id
# rename_columns:
#
keep_columns:
#- TAZ
# - construc
# - manufac
# - TCU
# - wholesl
- retail
# - FIRE
- service
# - private
# - govt
- emp
- pop
- hshld
- univ
- acres
# - otherEmp
# - district
- PARKTOT
- PARKLNG
- PROPFREE
- PARKRATE
- areatype
# - county
- county
- CBDFlag
- N11
- N21
Expand Down Expand Up @@ -108,10 +81,11 @@ input_table_list:
- I_PCT20TO40
- I_PCTGT40
- RetailEmp30
- PARKING_ZONE

#input data store and skims
#input_store: arc_asim.h5
skims_file: skims.omx
#skims_file: skims.omx

# - shadow pricing global switches

Expand Down Expand Up @@ -164,7 +138,7 @@ models:
# - track_skim_usage
# - write_trip_matrices
- write_tables

#resume_after: trip_mode_choice

multiprocess: True
Expand All @@ -188,7 +162,7 @@ multiprocess_steps:
- persons
- name: mp_summarize
begin: write_tables

output_tables:
h5_store: False
action: include
Expand All @@ -202,25 +176,25 @@ output_tables:
- tours
- trips
- joint_tour_participants


skim_time_periods:
period_minutes: 30
periods:
- 0
- 6
- 12
- 20
- 30
- 38
- 48
labels:
- EV
- EA
- AM
- MD
- PM
- EV

#skim_time_periods:
# period_minutes: 30
# periods:
# - 0
# - 6
# - 12
# - 20
# - 30
# - 38
# - 48
# labels:
# - EV
# - EA
# - AM
# - MD
# - PM
# - EV

min_value_of_time: 1
max_value_of_time: 50
Expand Down

0 comments on commit 0412a0b

Please sign in to comment.