Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/USEPA/pybeepop
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreyMinucci committed Dec 23, 2024
2 parents 38d13c1 + 0fbf837 commit 1019c0f
Show file tree
Hide file tree
Showing 10 changed files with 240 additions and 327 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/draft-pdf.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
example_beepop_results.csv

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# pybeepop+ :honeybee:
Python-based wrapper for the USDA/EPA's honey bee colony model **BeePop+**.
Python-based interface for the USDA/EPA's honey bee colony model **BeePop+**.

For more information about **BeePop+** see [Garber *et al.* 2022](https://doi.org/10.3390/ecologies3030022).

Expand All @@ -17,14 +17,15 @@ Developed by: Jeffrey Minucci
## Requirements

* Supported platforms:
* Windows 64-bit (x64)
* Linux
* Windows 64-bit
* Linux 64-bit
* For **Windows**: [Microsoft Visual C++ Redistributable 2015-2022](https://www.microsoft.com/en-us/download/details.aspx?id=48145)
* For **Linux**, the bundled BeePop+ library was compiled for the **manylinux/musllinux** standards (musllinux via wheel only).
If you encounter errors loading the library, you can try compiling BeePop+ yourself from source. Instructions for compiling BeePop+
for Linux are [below](#compiling-beepop-on-linux). Source code is available on [the project's GitHub page](https://github.com/quanted/vpoplib).
* Python version 3.8 or above.
* pandas installed in your Python environment.
* pandas > 2.0.0
* matplotlib > 3.1.0


## Quick Start Guide
Expand Down Expand Up @@ -113,6 +114,14 @@ for Linux are [below](#compiling-beepop-on-linux). Source code is available on [
my_parameters = beepop.get_parameters()
print(my_parameters)
10. To plot the last output as a time series:
ax = beepop.plot_output() # default columns
cols_to_plot = ["Dead Worker Adults", "Dead Foragers"]
ax = beepop.plot_output(cols_to_plot) # custom columns
## Example notebook
A Jupyter notebook with a working example of using `pybeepop+` is available [here](https://github.com/USEPA/pybeepop/blob/main/pybeepop_example.ipynb).
Expand All @@ -128,7 +137,7 @@ Documentation of the pybeepop+ API can be found at: https://usepa.github.io/pybe
### Requirements for compilation
* cmake > 3.2
* gcc and g++ compilers
* gcc or g++
### Compiling BeePop+ from source on Linux
Expand Down
162 changes: 0 additions & 162 deletions paper/paper.bib

This file was deleted.

87 changes: 0 additions & 87 deletions paper/paper.md

This file was deleted.

35 changes: 35 additions & 0 deletions pybeepop/plots.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""
plots.py - Plotting Functions for PyBeePop+
"""

import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdates


def plot_timeseries(output=None, columns=[]):
"""Function to plot a BeePop+ output as a time series.
Args:
output (DatFrame, optional): DataFrame of pybeepop+ model run output. Defaults to None.
columns (list, optional): List of column names to plot (as strings). Defaults to ["Colony Size", "Adult Workers", "Capped Worker Brood", "Worker Larvae", "Worker Eggs"].
Returns:
Matplotlib Axes object: A Matploitlib Axes object for further customization.
"""
if (output is not None) and columns:
output_trimmed = output.iloc[1:, :].set_index("Date") # drop 'Initial' row
output_trimmed.index = pd.DatetimeIndex(
output_trimmed.index
) # convert Date column to DateTimeIndex
fig, ax = plt.subplots()
for column in columns:
ax.plot(
output_trimmed.index.to_numpy(), output_trimmed[column].to_numpy(), label=column
)
ax.legend()
ax.xaxis.set_major_formatter(
mdates.ConciseDateFormatter(ax.xaxis.get_major_locator())
) # format date axis
plt.show()
return ax
Loading

0 comments on commit 1019c0f

Please sign in to comment.