cafe package¶
Submodules¶
cafe.fakeData module¶
cafe.farm module¶
- class cafe.farm.Config(species: str, name: str = '', output_per_crop: float = 1.0, unit: str = 'cuerdas')[source]¶
Bases:
object
Stores information about crop yields per species / varietal name
- class cafe.farm.Event(name: str, impact: Optional[Union[float, Callable]] = 1.0, scope: Optional[Union[bool, Dict]] = <factory>, start: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None)[source]¶
Bases:
cafe.farm.Event
Stores information about events which impact harvest expectations.
- age(current_time=datetime.datetime(2021, 8, 16, 6, 25, 2, 277660)) datetime.timedelta ¶
- end = None¶
- start = None¶
- property year_planted¶
- class cafe.farm.Farm(plot_list: List[cafe.farm.Plot] = <factory>)[source]¶
Bases:
object
Container class for a collection of
Plot
objects.- property ids: List[str]¶
- plot_list: List[cafe.farm.Plot]¶
- property plots: List[cafe.farm.Plot]¶
- property size: float¶
- class cafe.farm.Plot(num: int = 1, area: float = 1.0, plot_id: int = 0, species: str = <factory>, unit: str = 'cuerdas', start: Optional[datetime.datetime] = None, end: Optional[datetime.datetime] = None)[source]¶
Bases:
cafe.farm.Plot
Stores information about a farmer’s plot.
What is planted, how much, where, to whom does it belong? etc.
- age(current_time=datetime.datetime(2021, 8, 16, 6, 25, 2, 276423)) datetime.timedelta ¶
- end = None¶
- start = None¶
- property year_planted¶
- cafe.farm.find_config(name: str, configs: Tuple[cafe.farm.Config]) cafe.farm.Config [source]¶
Looks up a varietal by name in a collection of Configs. If name not found, will return config for the species instead, but throw an error if missing.
- cafe.farm.guate_harvest_function(lifespan: float = 30, mature: float = 5, retire: Optional[float] = None) Callable [source]¶
Defines piecewise-linear function which approximates the growth patterns of coffee trees according to the coffee cooperative for which this simulation was first written.
- cafe.farm.predict_yield_for_farm(farm: cafe.farm.Farm, configs: List[cafe.farm.Config], events: Optional[List[cafe.farm.Event]] = None, time: datetime.datetime = datetime.datetime(2020, 1, 1, 0, 0)) List[float] [source]¶
- cafe.farm.predict_yield_for_plot(plot: cafe.farm.Plot, config: cafe.farm.Config, events: Optional[List[cafe.farm.Event]] = None, time: datetime.datetime = datetime.datetime(2020, 1, 1, 0, 0)) float [source]¶
Predicts yields for a given plot, set of events, and collection of configs at a specified time.
- cafe.farm.total_impact(plot: cafe.farm.Plot, time: datetime.datetime, events: List[cafe.farm.Event]) float [source]¶
Determines which events are relevant and multiplies all the associated impacts together in order to define the “total impact” of these events on a particular plot.