event#
Functions
|
Creates an Event from a scalar and a list of industries affected. |
|
Creates an Event from a scalar, a list of regions and a list of sectors affected. |
|
Create an event for an impact given as a pd.Series. |
Classes
|
An Event object stores all information about a unique shock during simulation such as time of occurrence, duration, type of shock, amount of damages. |
|
An EventArbitraryProd object holds an event with arbitrary impact on production capacity. |
|
EventKapitalDestroyed is an abstract class to hold events with where some capital (from industries or households) is destroyed. |
|
EventKapitalRebuild holds a |
|
EventKapitalRecover holds a |
Functions documentation
- from_scalar_industries(impact, *, event_type, affected_industries, impact_distrib, occurrence=1, duration=1, name=None, event_monetary_factor=None, recovery_tau=None, recovery_function='linear', households_impact=None, rebuild_tau=None, rebuilding_sectors=None, rebuilding_factor=1.0)[source]#
Creates an Event from a scalar and a list of industries affected.
The scalar impact is distributed evenly by default. Otherwise it can be distributed proportionnaly to the GVA of affected industries, or to a custom distribution.
- Parameters:
- impactScalarImpact
The scalar impact.
- event_type: Literal[“recovery”] | Literal[“rebuild”] | Literal[“arbitrary”]
The type of events to generate. See How to define Events.
- affected_industriesIndustriesList
The list of industries affected by the impact.
- impact_distribpd.Series | Literal[“equal”]
If “equal”, distributes the impact equally between the affected industries. If a pd.Series of industries <> value is given, then the impact is distributed proportionally to that Series.
- durationint, default 1
The duration of the event (number of steps before which the recovery starts). Defaults to 1.
- occurrenceint, default 1
The ordinal of occurrence of the event (requires to be > 0). Defaults to 1.
- nameOptional[str], default None
A possible name for the event, for convenience. Defaults to None.
- **kwargs
Keyword arguments to pass to the instantiating method (depending on the type of event).
- Returns:
- Event
An Event object or one of its subclass.
- Raises:
- ValueError
Raised if Impact is null, if len(industries) < 1 or if the sum of impact_industries_distrib differs from 1.0.
- from_scalar_regions_sectors(impact, *, event_type, affected_regions, affected_sectors, impact_regional_distrib, impact_sectoral_distrib, occurrence=1, duration=1, name=None, event_monetary_factor=None, recovery_tau=None, recovery_function='linear', households_impact=None, rebuild_tau=None, rebuilding_sectors=None, rebuilding_factor=1.0)[source]#
Creates an Event from a scalar, a list of regions and a list of sectors affected.
- Parameters:
- impactScalarImpact
The scalar impact.
- event_type: Literal[“recovery”] | Literal[“rebuild”] | Literal[“arbitrary”]
The type of events to generate. See How to define Events.
- affected_regionsRegionsList
The list of regions affected by the impact.
- affected_sectorsSectorsList
The list of regions affected by the impact.
- impact_regional_distribLiteral[“equal”] | pd.Series,
If “equal”, distributes the impact equally between the affected regions. If a pd.Series of regions : value is given, then the total impact is distributed proportionally to that Series.
- impact_sectoral_distribLiteral[“equal”] | pd.Series,
If “equal”, distributes the regional impact equally between the affected sectors. If a pd.Series of sector : value is given, then the regional impact is distributed proportionally to that Series.
- durationint, default 1
The duration of the event (number of steps before which the recovery starts). Defaults to 1.
- occurrenceint, default 1
The ordinal of occurrence of the event (requires to be > 0). Defaults to 1.
- nameOptional[str], default None
A possible name for the event, for convenience. Defaults to None.
- **kwargs
Keyword arguments to pass to the instantiating method (depending on the type of event).
- 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,
- from_series(impact, *, event_type, occurrence=1, duration=1, name=None, event_monetary_factor=None, recovery_tau=None, recovery_function='linear', households_impact=None, rebuild_tau=None, rebuilding_sectors=None, rebuilding_factor=1.0)[source]#
Create an event for an impact given as a pd.Series.
- Parameters:
- impactpd.Series
A pd.Series defining the impact per (region, sector)
- event_type: Literal[“recovery”] | Literal[“rebuild”] | Literal[“arbitrary”]
The type of events to generate. See How to define Events.
- durationint, default 1
The duration of the event (number of steps before which the recovery starts). Defaults to 1.
- occurrenceint, default 1
The ordinal of occurrence of the event (requires to be > 0). Defaults to 1.
- nameOptional[str], default None
A possible name for the event, for convenience. Defaults to None.
- **kwargs
Keyword arguments to pass to the instantiating method (depending on the type of event).
- Returns:
- Event
An Event object or one of its subclass
- Raises:
- ValueError
Raised if impact is empty of contains negative values.
Examples
>>> import pandas as pd >>> import pymrio as pym >>> from boario.simulation import Simulation >>> from boario.extended_model import ARIOPsiModel >>> import boario.event >>> >>> mriot = pym.load_test() >>> mriot.calc_all() >>> >>> impact_series = pd.Series({('reg1', 'electricity'): 100000.0, ('reg1', 'mining'): 50000.0}) >>> model = ARIOPsiModel(mriot) >>> sim = Simulation(model) >>> event = boario.event.from_series(impact_series, event_type="recovery", occurrence=5, duration=10, recovery_tau=30, name="Event 1") >>> sim.add_event(event)