Skip to main content
`Ctrl`+`K`

# aequilibrae.project.Matrices

class aequilibrae.project.Matrices(project)

  Gateway into the matrices available/recorded in the model

  __init__(project)

  Methods

  `__init__`(project) |
  `check_exists`(name) | Checks whether a matrix with a given name exists
  `clear_database`() | Removes records from the matrices database that do not exist in disk
  `delete_record`(matrix_name) | Deletes a Matrix Record from the model and attempts to remove from disk
  `get_matrix`(matrix_name) | Returns an AequilibraE matrix available in the project
  `get_record`(matrix_name) | Returns a model Matrix Record for manipulation in memory
  `list`() | List of all matrices available
  `new_record`(name, file_name[, matrix]) | Creates a new record for a matrix in disk, but does not save it
  `reload`() | Discards all memory matrices in memory and loads recreate them
  `update_database`() | Adds records to the matrices database for matrix files found on disk

  check_exists(name: str) → bool

    Checks whether a matrix with a given name exists

    Returns:

      exists (`bool`): Does the matrix exist?

  clear_database() → None

    Removes records from the matrices database that do not exist in disk

  delete_record(matrix_name: str) → None

    Deletes a Matrix Record from the model and attempts to remove from disk

  get_matrix(matrix_name: str) → AequilibraeMatrix

    Returns an AequilibraE matrix available in the project

    Raises an error if matrix does not exist

    Arguments:

      matrix_name (`str`): Name of the matrix to be loaded

    Returns:

      matrix (`AequilibraeMatrix`): Matrix object

  get_record(matrix_name: str) → MatrixRecord

    Returns a model Matrix Record for manipulation in memory

  list() → DataFrame

    List of all matrices available

    Returns:

      df (`pd.DataFrame`): Pandas DataFrame listing all matrices available in the model

  new_record(name: str, file_name: str, matrix=None) → MatrixRecord

    Creates a new record for a matrix in disk, but does not save it

    If the matrix file is not already on disk, it will fail

    Arguments:

      name (`str`): Name of the matrix

      file_name (`str`): Name of the file on disk

    Returns:

      matrix_record (`MatrixRecord`): A matrix record that can be manipulated in memory before saving

  reload()

    Discards all memory matrices in memory and loads recreate them

  update_database() → None

    Adds records to the matrices database for matrix files found on disk