aequilibrae.project.network.Modes#
- class aequilibrae.project.network.Modes(net)[source]#
Access to the API resources to manipulate the modes table in the network
>>> project = create_example(project_path) >>> modes = project.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('car') # 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()
Methods
__init__
(net)add
(mode)We add a mode to the project
Returns a dictionary with all mode objects available in the model.
delete
(mode_id)Removes the mode with mode_id from the project
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
Attributes
Returns a FieldEditor class instance to edit the Modes table fields and their metadata
- all_modes() dict [source]#
Returns a dictionary with all mode objects available in the model. mode_id as key
- new(mode_id: str) Mode [source]#
Returns a new mode with mode_id that can be added to the model later
- property fields: FieldEditor#
Returns a FieldEditor class instance to edit the Modes table fields and their metadata