Event#
- class Event(*, impact, name=None, occurrence=None, duration=None)[source]#
Bases:
ABC
An Event object stores all information about a unique shock during simulation such as time of occurrence, duration, type of shock, amount of damages. Computation of recovery or initially requested rebuilding demand is also done in this class.
Warning
The Event class is abstract and cannot be instantiated directly. Only its non-abstract subclasses can be instantiated.
Note
Events should be constructed using
from_series()
,from_dataframe()
,from_scalar_industries()
or fromfrom_scalar_regions_sectors()
. Depending on the type of event chosen, these constructors require additional keyword arguments, that are documented for each instantiable Event subclass. For instance,EventKapitalRebuild
additionally requires rebuild_tau and rebuilding_sectors.See also
Tutorial How to define Events
Methods
__init__
(*, impact[, name, occurrence, duration])distribute_impact_industries
(impact, ...[, ...])from_scalar_regions_sectors
(impact, *, ...)Creates an Event from a scalar, a list of regions and a list of sectors affected.
Attributes
The industries affected by the event.
The array of regions affected by the event
The array of affected sectors by the event
The duration of the event.
A pandas Series with all possible industries as index, holding the impact vector of the event.
The series specifying how damages are distributed among affected industries (regions,sectors)
The series specifying how damages are distributed among affected regions
The temporal unit of occurrence of the event.
An identifying name for the event (for convenience mostly)
Store relevant information about the event
- name#
An identifying name for the event (for convenience mostly)
- event_dict#
Store relevant information about the event
- classmethod from_scalar_regions_sectors(impact, *, regions, sectors, impact_regional_distrib=None, impact_sectoral_distrib=None, occurrence=1, duration=1, name=None, **kwargs)[source]#
Creates an Event from a scalar, a list of regions and a list of sectors affected.
- Parameters:
- impactScalarImpact
The scalar impact.
- regionsRegionsList
The list of regions affected.
- sectorsSectorsList
The list of sectors affected in each region.
- impact_regional_distribOptional[npt.ArrayLike], optional
A vector of equal size to the list of regions affected, stating the share of the impact each industry should receive. Defaults to None.
- impact_sectoral_distribOptional[Union[str, npt.ArrayLike]], optional
Either:
"gdp"
, the impact is then distributed using the gross value added of each sector as a weight.A vector of equal size to the list of sectors affected, stating the share of the impact each industry should receive. Defaults to None.
- occurrenceint, optional
The ordinal of occurrence of the event (requires to be > 0). Defaults to 1.
- durationint, optional
The duration of the event (entire impact applied during this number of steps). Defaults to 1.
- nameOptional[str], optional
A possible name for the event, for convenience. Defaults to None.
- **kwargs
Keyword arguments Other keyword arguments to pass to the instantiate method (depends on the type of event)
- Returns:
- Event
An Event object or one of its subclass.
- Raises:
- ValueError
Raise if Impact is null, if len(regions) or len(sectors) < 1,
- property impact#
A pandas Series with all possible industries as index, holding the impact vector of the event. The impact is defined for each sectors in each region.
- property occurrence#
The temporal unit of occurrence of the event.
- property duration#
The duration of the event.
- property aff_industries#
The industries affected by the event.
- property aff_regions#
The array of regions affected by the event
- property aff_sectors#
The array of affected sectors by the event
- property impact_regional_distrib#
The series specifying how damages are distributed among affected regions
- property impact_industries_distrib#
The series specifying how damages are distributed among affected industries (regions,sectors)