# SimFire Fire Simulator
<p align="center">
<img src="https://raw.githubusercontent.com/mitrefireline/simfire/main/assets/icons/rl_logo_horizontal.png">
</p>
## Introduction
SimFire uses [PyGame](https://www.pygame.org/wiki/about) to display and simulate different fire spread models, including the Rothermel Surface fire spread model described in [this](https://www.fs.usda.gov/rm/pubs_series/rmrs/gtr/rmrs_gtr371.pdf) paper.
For more comprehensive documentation, go to our [docs page](https://mitrefireline.github.io/simfire).
## Running the Simulation
<figure>
<p align="center">
<img src="https://raw.githubusercontent.com/mitrefireline/simfire/main/assets/gifs/simulation_33.06N_116.58W.gif" width="225" />
<img src="https://raw.githubusercontent.com/mitrefireline/simfire/main/assets/gifs/simulation_39.67N_119.80W.gif" width="225" />
<br><b>Left: Fire simulated near Julian, CA. Right: Fire simulated near Reno, NV.
<br>Both fires have winds from the east at 20mph<b>
</p>
</figure>
Install `simfire` by following the [installation instructions](#installing-the-package). Then run the `run_game.py` script:
```shell
python run_game.py
```
### Running as a Python Module
```python
from simfire.sim.simulation import FireSimulation
from simfire.utils.config import Config
config = Config("configs/operational_config.yml")
sim = FireSimulation(config)
# Run a 1 hour simulation
sim.run("1h")
# Run the same simulation for 30 more minutes
sim.run("30m")
# Render the next 2 hours of simulation
sim.rendering = True
sim.run("2h")
# Now save a GIF and fire spread graph from the last 2 hours of simulation
sim.save_gif()
sim.save_spread_graph()
# Saved to the location specified in the config: simulation.sf_home
# Update agents for display
# (x, y, agent_id)
agent_0 = (5, 5, 0)
agent_1 = (5, 5, 1)
agents = [agent_0, agent_1]
# Create the agents on the display
sim.update_agent_positions(agents)
# Loop through to move agents
for i in range(5):
agent_0 = (5 + i, 5 + i, 0)
agent_1 = (5 + i, 5 + i, 1)
# Update the agent positions on the simulation
sim.update_agent_positions([agent_0, agent_1])
# Run for 1 update step
sim.run(1)
# Turn off rendering so the display disappears and the simulation continues to run in the
# background
sim.rendering = False
```
## Installing the Package
```shell
pip install simfire
```
## Contributing
For contributing, see the [Contribution Page](https://mitrefireline.github.io/simfire/contributing.html) in our [docs](https://mitrefireline.github.io/simfire).
## Citation
To cite this software, use the “Cite this repository” link built into GitHub on the right.
### Copyright
Copyright ©2023 The MITRE Corporation. ALL RIGHTS RESERVED. Approved for Public Release; Distribution Unlimited. Public Release Case Number 22-3261.
Raw data
{
"_id": null,
"home_page": "https://github.com/mitrefireline/simfire",
"name": "simfire",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.10,>=3.9",
"maintainer_email": null,
"keywords": "python, reinforcement learning, simulation, fire",
"author": "Tim Welsh",
"author_email": "twelsh@mitre.org",
"download_url": "https://files.pythonhosted.org/packages/1c/7d/5909cdcc6a117b46cd0ff01f10a21ad330ffe1a29451597440a4b0caef35/simfire-1.5.9.tar.gz",
"platform": null,
"description": "# SimFire Fire Simulator\n\n<p align=\"center\">\n <img src=\"https://raw.githubusercontent.com/mitrefireline/simfire/main/assets/icons/rl_logo_horizontal.png\">\n</p>\n\n## Introduction\n\nSimFire uses [PyGame](https://www.pygame.org/wiki/about) to display and simulate different fire spread models, including the Rothermel Surface fire spread model described in [this](https://www.fs.usda.gov/rm/pubs_series/rmrs/gtr/rmrs_gtr371.pdf) paper.\n\nFor more comprehensive documentation, go to our [docs page](https://mitrefireline.github.io/simfire).\n\n\n## Running the Simulation\n<figure>\n <p align=\"center\">\n <img src=\"https://raw.githubusercontent.com/mitrefireline/simfire/main/assets/gifs/simulation_33.06N_116.58W.gif\" width=\"225\" />\n <img src=\"https://raw.githubusercontent.com/mitrefireline/simfire/main/assets/gifs/simulation_39.67N_119.80W.gif\" width=\"225\" />\n <br><b>Left: Fire simulated near Julian, CA. Right: Fire simulated near Reno, NV.\n <br>Both fires have winds from the east at 20mph<b>\n </p>\n </figure>\n\nInstall `simfire` by following the [installation instructions](#installing-the-package). Then run the `run_game.py` script:\n\n```shell\npython run_game.py\n```\n\n### Running as a Python Module\n\n```python\nfrom simfire.sim.simulation import FireSimulation\nfrom simfire.utils.config import Config\n\nconfig = Config(\"configs/operational_config.yml\")\nsim = FireSimulation(config)\n\n# Run a 1 hour simulation\nsim.run(\"1h\")\n\n# Run the same simulation for 30 more minutes\nsim.run(\"30m\")\n\n# Render the next 2 hours of simulation\nsim.rendering = True\nsim.run(\"2h\")\n\n# Now save a GIF and fire spread graph from the last 2 hours of simulation\nsim.save_gif()\nsim.save_spread_graph()\n# Saved to the location specified in the config: simulation.sf_home\n\n# Update agents for display\n# (x, y, agent_id)\nagent_0 = (5, 5, 0)\nagent_1 = (5, 5, 1)\n\nagents = [agent_0, agent_1]\n\n# Create the agents on the display\nsim.update_agent_positions(agents)\n\n# Loop through to move agents\nfor i in range(5):\n agent_0 = (5 + i, 5 + i, 0)\n agent_1 = (5 + i, 5 + i, 1)\n # Update the agent positions on the simulation\n sim.update_agent_positions([agent_0, agent_1])\n # Run for 1 update step\n sim.run(1)\n\n# Turn off rendering so the display disappears and the simulation continues to run in the\n# background\nsim.rendering = False\n```\n\n## Installing the Package\n\n```shell\npip install simfire\n```\n\n## Contributing\n\nFor contributing, see the [Contribution Page](https://mitrefireline.github.io/simfire/contributing.html) in our [docs](https://mitrefireline.github.io/simfire).\n\n## Citation\n\nTo cite this software, use the \u201cCite this repository\u201d link built into GitHub on the right.\n\n### Copyright\nCopyright \u00a92023 The MITRE Corporation. ALL RIGHTS RESERVED. Approved for Public Release; Distribution Unlimited. Public Release Case Number 22-3261.\n",
"bugtrack_url": null,
"license": null,
"summary": "Fire simulator built in Python",
"version": "1.5.9",
"project_urls": {
"Documentation": "https://mitrefireline.github.io/simfire/",
"Homepage": "https://github.com/mitrefireline/simfire",
"Repository": "https://github.com/mitrefireline/simfire"
},
"split_keywords": [
"python",
" reinforcement learning",
" simulation",
" fire"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "86725d968a833cc4af4104bda41c4da25d6a917dc379e6ce61a503badc097f9c",
"md5": "fa27de81acc0ac9b700a326cdd8b0b35",
"sha256": "6dad9e943f6a333d3b23c906d5ce34d6fb7658145862ee7e76a0b773b4893ca7"
},
"downloads": -1,
"filename": "simfire-1.5.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fa27de81acc0ac9b700a326cdd8b0b35",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.10,>=3.9",
"size": 449280,
"upload_time": "2024-04-29T23:39:10",
"upload_time_iso_8601": "2024-04-29T23:39:10.356971Z",
"url": "https://files.pythonhosted.org/packages/86/72/5d968a833cc4af4104bda41c4da25d6a917dc379e6ce61a503badc097f9c/simfire-1.5.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1c7d5909cdcc6a117b46cd0ff01f10a21ad330ffe1a29451597440a4b0caef35",
"md5": "1ffc5fc96251e6aa32e50e75ae72001d",
"sha256": "cbd4dc5960e0a668c6ff4c3dd449a0bab9fb80317de3bbd357cfda129a0cf2c5"
},
"downloads": -1,
"filename": "simfire-1.5.9.tar.gz",
"has_sig": false,
"md5_digest": "1ffc5fc96251e6aa32e50e75ae72001d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.10,>=3.9",
"size": 434135,
"upload_time": "2024-04-29T23:39:12",
"upload_time_iso_8601": "2024-04-29T23:39:12.559153Z",
"url": "https://files.pythonhosted.org/packages/1c/7d/5909cdcc6a117b46cd0ff01f10a21ad330ffe1a29451597440a4b0caef35/simfire-1.5.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-29 23:39:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mitrefireline",
"github_project": "simfire",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "simfire"
}