Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/KarrLab/de_sim
Browse files Browse the repository at this point in the history
  • Loading branch information
artgoldberg committed Jul 2, 2020
2 parents 803a288 + 9733745 commit 2ebcc5f
Show file tree
Hide file tree
Showing 75 changed files with 2,055 additions and 454 deletions.
6 changes: 6 additions & 0 deletions .karr_lab_build_utils.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ downstream_dependencies:
email_notifications:
- jonrkarr@gmail.com
- arthur.p.goldberg@mssm.edu
static_analyses:
ignore_files: []
ignore_unused_requirements:
- pympler
ignore_missing_requirements:
- configobj
123 changes: 123 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[info@karrlab.org](mailto:info@karrlab.org).
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/version/2/0/code_of_conduct.html).

The Community Impact Guidelines were inspired by [Mozilla's Code of Conduct Enforcement ladder](https://github.com/mozilla/diversity).

Answers to common questions about this code of conduct are available at
https://www.contributor-covenant.org/faq. Translations of this code of conduct are available at
https://www.contributor-covenant.org/translations.
73 changes: 73 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Contributing to `DE-Sim`

We enthusiastically welcome contributions to `DE-Sim`!

## Coordinating contributions

Before getting started, please contact the lead developers at [info@karrlab.org](mailto:info@karrlab.org) to coordinate your planned contributions with other ongoing efforts. Please also use GitHub issues to announce your plans to the community so that other developers can provide input into your plans and coordinate their own work. As the development community grows, we will institute additional infrastructure as needed such as a leadership committee and regular online meetings.

## Repository organization

`DE-Sim` follows standard Python conventions:

* `README.md`: Overview of `DE-Sim`
* `de_sim/`: Source code
* `docs/`: Documentation
* `tests/`: Unit tests
* `pytest.ini`: pytest configuration
* `setup.py`: pip installation script
* `setup.cfg`: Configuration for the pip installation
* `requirements.txt`: Dependencies
* `requirements.optional.txt`: Optional dependencies
* `manifest.in`: List of files to include in package
* `codemeta.json`: Package metadata
* `LICENSE`: License
* `CONTRIBUTING.md`: Guide to contributing to `DE-Sim` (this document)
* `CODE_OF_CONDUCT.md`: Code of conduct for developers

## Coding convention

`DE-Sim` follows standard Python style conventions:

* Class names: `UpperCamelCase`
* Function names: `lower_snake_case`
* Variable names: `lower_snake_case`

## Testing and continuous integration

We strive to have complete test coverage of `DE-Sim`. As such, all contributions to `DE-Sim` should be tested.

The tests are located in the `tests` directory. The tests can be executed by running the following command.
```
pip install pytest
python -m pytest tests
```

The coverage of the tests can be evaluated by running the following commands and then opening `/path/to/de_sim/htmlcov/index.html` with your browser.
```
pip install pytest pytest-cov coverage
python -m pytest tests --cov de_sim
coverage html
```

Upon each push to GitHub, GitHub will trigger CircleCI to execute all of the tests. The latest test results are available at [CircleCI](https://circleci.com/gh/KarrLab/de_sim). The latest coverage results are available at [Coveralls](https://coveralls.io/github/KarrLab/de_sim).

## Documentation convention

`DE-Sim` is documented using [reStructuredText](https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html) and the [napoleon Sphinx plugin](https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html). The documentation can be compiled with [Sphinx](https://www.sphinx-doc.org/) by running `sphinx-build docs docs/_build/html`. The compiled documentation is available at [https://docs.karrlab.org/de_sim/](https://docs.karrlab.org/de_sim/).

## Submitting changes

Please use GitHub pull requests to submit changes. Each request should include a brief description of the new and/or modified features.

## Releasing and deploying new versions

Contact [info@karrlab.org](mailto:info@karrlab.org) to request release and deployment of new changes.

## Reporting issues

Please use [GitHub issues]() to report any issues to the development community.

## Getting help

Please use [GitHub issues]() to post questions or contact the lead developers at [info@karrlab.org](mailto:info@karrlab.org).
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Base OS
FROM python:3.7

# Install DE-Sim
RUN pip install de_sim
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2019 Karr Lab
Copyright (c) 2019-2020 Karr Lab

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
9 changes: 6 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ include README.rst
# license
include LICENSE

# examples
recursive-include de_sim/examples *

# requirements
include requirements.txt
include requirements.optional.txt

# configuration
recursive-include de_sim/config *.cfg

# examples
recursive-include de_sim/examples *
71 changes: 56 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,87 @@
[//]: # ( [![PyPI package](https://img.shields.io/pypi/v/de_sim.svg)](https://pypi.python.org/pypi/de_sim) )
[![PyPI package](https://img.shields.io/pypi/v/de_sim.svg)](https://pypi.python.org/pypi/de_sim)
[![Documentation](https://readthedocs.org/projects/de_sim/badge/?version=latest)](https://docs.karrlab.org/de_sim)
[![Test results](https://circleci.com/gh/KarrLab/de_sim.svg?style=shield)](https://circleci.com/gh/KarrLab/de_sim)
[![Test coverage](https://coveralls.io/repos/github/KarrLab/de_sim/badge.svg)](https://coveralls.io/github/KarrLab/de_sim)
[![Code analysis](https://api.codeclimate.com/v1/badges/2fa3ece22f571fd36b12/maintainability)](https://codeclimate.com/github/KarrLab/de_sim)
[![License](https://img.shields.io/github/license/KarrLab/de_sim.svg)](LICENSE)
![Analytics](https://ga-beacon.appspot.com/UA-86759801-1/de_sim/README.md?pixel)

# de_sim
# *DE-Sim*: a Python-based object-oriented discrete-event simulation tool for complex, data-driven modeling

`de_sim` provides an object-oriented discrete event simulation
tool for Python that's similar to Simula.
Simulation logical processes are objects and they schedule
simulation events by exchanging messages.
Simulation applications are composed of multiple
subclasses of `SimulationObject`.
*DE-Sim* is an open-source, Python-based object-oriented discrete-event simulation (DES) tool that makes it easy to use large, heterogeneous datasets and high-level data science tools such as [NumPy](https://numpy.org/), [Scipy](https://scipy.org/scipylib/index.html), [pandas](https://pandas.pydata.org/), and [SQLAlchemy](https://www.sqlalchemy.org/) to build and simulate complex computational models. Similar to [Simula](http://www.simula67.info/), *DE-Sim* models are implemented by defining logical process objects which read the values of a set of shared variables and schedule events to modify their values at discrete instants in time.

To help users build and simulate complex, data-driven models, *DE-Sim* provides the following features:

* **High-level, object-oriented modeling:** *DE-Sim* makes it easy for users to use object-oriented Python programming to build models. This makes it easy to use large, heterogeneous datasets and high-level data science packages such as NumPy, pandas, SciPy, and SQLAlchemy to build complex models.
* **Powerful stop conditions:** *DE-Sim* makes it easy to implement complex stop conditions. Stop conditions can be implemented as simple Python functions that return true when the simulation state reaches the desired stop condition.
* **Simple simulation logging:** *DE-Sim* provides tools for recording the results of simulations, as well as metadata such as the start and run time of each simulation.
* **Space-time visualizations for analysis and debugging:** *DE-Sim* can generate space-time visualizations of simulation trajectories. These diagrams are valuable tools for understanding and debugging models.
* **Checkpointing for restarting and debugging:** *DE-Sim* can checkpoint the state of simulations. These checkpoints can be used to restart or debug simulations. Checkpointing is particularly helpful for using *DE-Sim* on clusters that have short time limits, or for using *DE-Sim* on spot-priced virtual machines in commercial clouds.

## Projects that use *DE-Sim*
*DE-Sim* has been used to develop [WC-Sim](https://github.com/KarrLab/wc_sim), a multi-algorithmic simulator for [whole-cell models](https://www.wholecell.org).

## Examples
* [Random walk](de_sim/examples/random_walk.py): a random one-dimensional walk which increments or decrements a variable with equal probability at each event
* [Parallel hold (PHOLD)](de_sim/examples/phold.py): model developed by Richard Fujimoto which is commonly used to benchmark DES simulators

## Tutorial
Please see [sandbox.karrlab.org](https://sandbox.karrlab.org/tree/de_sim) for interactive tutorials on creating and executing models with *DE-Sim*.

## Template for models and simulations
[`de_sim/examples/minimal_simulation.py`](de_sim/examples/minimal_simulation.py) contains a template for implementing and simulating a model with *DE-Sim*.

## Installation
1. Install dependencies

* Python
* pip
* Python >= 3.6
* pip >= 19

2. Install this package

* Install latest release from PyPI
```
de_sim
pip install de_sim
```

* Install a Docker image with the latest release from DockerHub
```
docker pull karrlab/de_sim
```

* Install latest revision from GitHub
```
pip install git+https://github.com/KarrLab/de_sim.git#egg=de_sim
```

## Documentation
Please see the [API documentation](https://docs.karrlab.org/de_sim).
## API documentation
Please see the [API documentation](https://docs.karrlab.org/de_sim/source/de_sim.html).

## Performance
Please see the [*DE-Sim* article](joss_paper/paper.md) for information about the performance of *DE-Sim*.

## Strengths and weaknesses compared to other DES tools
Please see the [*DE-Sim* article](joss_paper/paper.md) for a comparison of *DE-Sim* with other DES tools.

## License
The package is released under the [MIT license](LICENSE).

## Citing *DE-Sim*
Please use the following reference to cite *DE-Sim*:

Arthur P. Goldberg & Jonathan Karr. DE-Sim: an object-oriented discrete-event simulation tool for complex, data-driven modeling. In preparation.

## Contributing to *DE-Sim*
We enthusiastically welcome contributions to *DE-Sim*! Please see the [guide to contributing](CONTRIBUTING.md) and the [developer's code of conduct](CODE_OF_CONDUCT.md).

## Development team
This package was developed by the [Karr Lab](https://www.karrlab.org) at the Icahn School of Medicine at Mount Sinai in New York, USA.
This package was developed by the [Karr Lab](https://www.karrlab.org) at the Icahn School of Medicine at Mount Sinai in New York, USA by the following individuals:

* [Arthur Goldberg](https://www.mountsinai.org/profiles/arthur-p-goldberg)
* [Jonathan Karr](https://www.karrlab.org)

## Acknowledgements
This work was supported by National Science Foundation award 1649014, National Institutes of Health award R35GM119771, and the Icahn Institute for Data Science and Genomic Technology.

## Questions and comments
Please contact the [Karr Lab](https://www.karrlab.org) with any questions or comments.
Please submit questions and issues to [GitHub](https://github.com/KarrLab/de_sim/issues) or contact the [Karr Lab](mailto:info@karrlab.org).
50 changes: 50 additions & 0 deletions codemeta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"@context": "https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld",
"@type": "Code",
"@id": "https://pypi.org/project/de-sim/",
"name": "DE-Sim",
"description": "An ungodly union of GitHub and figshare",
"keywords": ["dynamical modeling", "simulation", "discrete-event simulation", "object-oriented simulation", "parallel discrete-event simulation", "biochemical modeling", "whole-cell modeling", "Python"],
"author": [{
"@type": "Person",
"@id": "http://orcid.org/0000-0003-2772-1484",
"givenName": "Arthur",
"familyName": "Goldberg",
"email": "arthur.p.goldberg@mssm.edu",
"affiliation": "Icahn Institute for Data Science and Genomic Technology and Department of Genetics and Genomic Sciences, Icahn School of Medicine at Mount Sinai, New York, NY 10029, USA"
},
{
"@type": "Person",
"@id": "http://orcid.org/0000-0002-2605-5080",
"givenName": "Jonathan",
"familyName": "Karr",
"email": "karr@mssm.edu",
"affiliation": "Icahn Institute for Data Science and Genomic Technology and Department of Genetics and Genomic Sciences, Icahn School of Medicine at Mount Sinai, New York, NY 10029, USA"
}
],
"citation": null,
"readme": "https://github.com/KarrLab/de_sim/blob/master/README.md",
"license": "https://spdx.org/licenses/MIT",
"isAccessibleForFree": true,
"url": "https://github.com/KarrLab/de_sim",
"installUrl": "https://pypi.org/project/de-sim/",
"downloadUrl": "https://github.com/KarrLab/de_sim/tags",
"softwareHelp": "https://docs.karrlab.org/de_sim/",
"codeRepository": "https://github.com/KarrLab/de_sim",
"contIntegration": "https://circleci.com/gh/KarrLab/de_sim",
"issueTracker": "https://github.com/KarrLab/de_sim/issues",
"version": "0.0.1",
"developmentStatus": "active",
"datePublished": "2020-07-20",
"dateCreated": "2019-01-20",
"applicationCategory": "Science and engineering",
"applicationSubCategory": "Modeling and simulation",
"isPartOf": "https://github.com/KarrLab/wc_sim",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "Python",
"version": "3.6",
"url": "https://python.org"
},
"funding": "This worked was supported by National Science Foundation award 1649014 and National Institutes of Health award R35GM119771."
}

0 comments on commit 2ebcc5f

Please sign in to comment.