simfire


Namesimfire JSON
Version 2.0.1 PyPI version JSON
download
home_pagehttps://github.com/mitrefireline/simfire
SummaryFire simulator built in Python
upload_time2024-07-09 21:39:44
maintainerNone
docs_urlNone
authorTim Welsh
requires_python<3.10,>=3.9
licenseNone
keywords python reinforcement learning simulation fire
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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).

This repository is part of the MITRE Fireline project and is associated with both [BurnMD](https://github.com/mitrefireline/burnmd) and [SimHarness](https://github.com/mitrefireline/simharness). BurnMD is used in the `HistoricalDataLayer` to provide historical fire data for the simulation. SimHarness is a reinforcement learning training harness that uses this simulator to train agents to fight fires.

## 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/ef/4d/6a64e95335913f84f67bc069470532fcc4db5082b3bce4b79979e6979775/simfire-2.0.1.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\nThis repository is part of the MITRE Fireline project and is associated with both [BurnMD](https://github.com/mitrefireline/burnmd) and [SimHarness](https://github.com/mitrefireline/simharness). BurnMD is used in the `HistoricalDataLayer` to provide historical fire data for the simulation. SimHarness is a reinforcement learning training harness that uses this simulator to train agents to fight fires.\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": "2.0.1",
    "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": "aab2e936302db9644a2248fa5465e96585ae7439de8beb1e223ec3f2620ed7ae",
                "md5": "c032c230721be64de808cdf81ff4c96b",
                "sha256": "695ae4155b15ec3764bba4f1cca5e2ea8815313b4ec8878baa12d14a8407b0d8"
            },
            "downloads": -1,
            "filename": "simfire-2.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c032c230721be64de808cdf81ff4c96b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.10,>=3.9",
            "size": 454498,
            "upload_time": "2024-07-09T21:39:41",
            "upload_time_iso_8601": "2024-07-09T21:39:41.847980Z",
            "url": "https://files.pythonhosted.org/packages/aa/b2/e936302db9644a2248fa5465e96585ae7439de8beb1e223ec3f2620ed7ae/simfire-2.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ef4d6a64e95335913f84f67bc069470532fcc4db5082b3bce4b79979e6979775",
                "md5": "780479f900d8ac7447e66801cb78e2bf",
                "sha256": "f751d381aab3ac02f55ccd17e5a2b84fe99826cf2dc07ed64383bcb09e7fdbdb"
            },
            "downloads": -1,
            "filename": "simfire-2.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "780479f900d8ac7447e66801cb78e2bf",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.10,>=3.9",
            "size": 439170,
            "upload_time": "2024-07-09T21:39:44",
            "upload_time_iso_8601": "2024-07-09T21:39:44.721155Z",
            "url": "https://files.pythonhosted.org/packages/ef/4d/6a64e95335913f84f67bc069470532fcc4db5082b3bce4b79979e6979775/simfire-2.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-09 21:39:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mitrefireline",
    "github_project": "simfire",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "simfire"
}
        
Elapsed time: 5.11253s