Skip to main content
`Ctrl`+`K`

# aequilibrae.project.network.Periods

class aequilibrae.project.network.Periods(net)

  Access to the API resources to manipulate the periods table in the network

      >>> project = create_example(project_path, "coquimbo")

      >>> all_periods = project.network.periods

      # We can just get one link in specific
      >>> period = all_periods.get(1)

      # We can save changes for all periods we have edited so far
      >>> all_periods.save()

  __init__(net)

  Methods

  `__init__`(net) |
  `extent`() | Queries the extent of the layer included in the model
  `get`(period_id) | Get a period from the network by its period_id
  `new_period`(period_id, start, end[, description]) | Creates a new period with a given ID
  `refresh`() | Refreshes all the periods in memory
  `refresh_fields`() | After adding a field one needs to refresh all the fields recognized by the software
  `save`() |

  Attributes

  `data` | Returns all periods data as a Pandas DataFrame
  `default_period` |
  `fields` | Returns a FieldEditor class instance to edit the zones table fields and their metadata
  `sql` | Query sql for retrieving periods

  extent()

    Queries the extent of the layer included in the model

    Returns:

      model extent (`Polygon`): Shapely polygon with the bounding box of the layer.

  get(period_id: int) → Period

    Get a period from the network by its period_id

    It raises an error if period_id does not exist

    Arguments:

      period_id (`int`): Id of a period to retrieve

    Returns:

      period (`Period`): Period object for requested period_id

  new_period(period_id: int, start: int, end: int, description: str | None = None) → Period

    Creates a new period with a given ID

    Arguments:

      period_id (`int`): Id of the centroid to be created

      start (`int`): Start time of the period to be created

      end (`int`): End time of the period to be created

      description (`str`): Optional human readable description of the time period e.g. ‘1pm - 5pm’

  refresh()

    Refreshes all the periods in memory

  refresh_fields() → None

    After adding a field one needs to refresh all the fields recognized by the software

  save()
  property data: DataFrame

    Returns all periods data as a Pandas DataFrame

    Returns:

      table (`DataFrame`): Pandas DataFrame with all the periods

  property default_period: Period
  property fields: FieldEditor

    Returns a FieldEditor class instance to edit the zones table fields and their metadata

  sql = ''

    Query sql for retrieving periods