6.1.3.2.1. aequilibrae.project.network.Modes¶
-
class
aequilibrae.project.network.Modes(net)¶ Bases:
objectAccess to the API resources to manipulate the modes table in the network
from aequilibrae import Project p = Project() p.open('path/to/project/folder') modes = p.network.modes # We can get a dictionary of all modes in the model all_modes = modes.all_modes() #And do a bulk change and save it for mode_id, mode_obj in all_modes.items(): mode_obj.beta = 1 mode_obj.save() # or just get one mode in specific car_mode = modes.get('c') # or just get this same mode by name car_mode = modes.get_by_name('c') # We can change the description of the mode car_mode.description = 'personal autos only' # Let's say we are using alpha to store the PCE for a future year with much smaller cars car_mode.alpha = 0.95 # To save this mode we can simply car_mode.save() # We can also create a completely new mode and add to the model new_mode = modes.new('k') new_mode.mode_name = 'flying_car' # Only ASCII letters and *_* allowed # other fields are not mandatory # We then explicitly add it to the network modes.add(new_mode) # we can even keep editing and save it directly once we have added it to the project new_mode.description = 'this is my new description' new_mode.save()-
__init__(net)¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__(net)Initialize self.
add(mode)We add a mode to the project
all_modes()Returns a dictionary with all mode objects available in the model.
delete(mode_id)Removes the mode with mode_id from the project
fields()Returns a FieldEditor class instance to edit the Modes table fields and their metadata
get(mode_id)Get a mode from the network by its mode_id
get_by_name(mode)Get a mode from the network by its mode_name
new(mode_id)Returns a new mode with mode_id that can be added to the model later
-
__init__(net)¶ Initialize self. See help(type(self)) for accurate signature.
-