forked from pybamm-team/PyBaMM
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request pybamm-team#931 from pybamm-team/develop
Version 0.2.1 develop -> master
- Loading branch information
Showing
327 changed files
with
8,649 additions
and
4,031 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# PyBaMM Code of Conduct | ||
|
||
## Our Pledge | ||
|
||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. | ||
|
||
## Our Standards | ||
|
||
Examples of behavior that contributes to creating a positive environment include: | ||
|
||
* Using welcoming and inclusive language | ||
* Being respectful of differing viewpoints and experiences | ||
* Gracefully accepting constructive criticism | ||
* Focusing on what is best for the community | ||
* Showing empathy towards other community members | ||
|
||
Examples of unacceptable behavior by participants include: | ||
|
||
* The use of sexualized language or imagery and unwelcome sexual attention or advances | ||
* Trolling, insulting/derogatory comments, and personal or political attacks | ||
* Public or private harassment | ||
* Publishing others' private information, such as a physical or electronic address, without explicit permission | ||
* Other conduct which could reasonably be considered inappropriate in a professional setting | ||
|
||
## Our Responsibilities | ||
|
||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. | ||
|
||
Project maintainers 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, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. | ||
|
||
## Scope | ||
|
||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. | ||
|
||
## Enforcement | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. | ||
|
||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. | ||
|
||
## Attribution | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] | ||
|
||
[homepage]: http://contributor-covenant.org | ||
[version]: http://contributor-covenant.org/version/1/4/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
We recommend the use of Windows Subsystem for Linux (WSL) to install PyBaMM, see the | ||
instructions below to get PyBaMM working using Windows, WSL and VSCode. | ||
|
||
## Install WSL | ||
|
||
Follow the instructions from Microsoft | ||
[here](https://docs.microsoft.com/en-us/windows/wsl/install-win10). When given the | ||
option, choose the Ubuntu 18.04 LTS distribution to install. Don't forget to initialise | ||
the Ubuntu installation using the instructions given | ||
[here](https://docs.microsoft.com/en-us/windows/wsl/initialize-distro). | ||
|
||
## Install PyBaMM | ||
|
||
Open a terminal window in your installed Ubuntu distribution by selecting "Ubuntu" from | ||
the start menu. This should give you a bash prompt in your home directory. | ||
|
||
To download the PyBaMM source code, you first need to install git, which you can do by | ||
typing | ||
|
||
```bash | ||
sudo apt install git-core | ||
``` | ||
|
||
For easier integration with WSL, we recommend that you install PyBaMM in your *Windows* | ||
Documents folder, for example by first navigating to | ||
|
||
```bash | ||
$ cd /mnt/c/Users/USER_NAME/Documents | ||
``` | ||
|
||
where USER_NAME is your username. Exact path to Windows documents may vary. Now use git to clone the PyBaMM repository: | ||
|
||
```bash | ||
git clone https://github.com/pybamm-team/PyBaMM.git | ||
``` | ||
|
||
This will create a new directly called `PyBaMM`, you can move to this directory in bash | ||
using the `cd` command: | ||
|
||
```bash | ||
cd PyBaMM | ||
``` | ||
|
||
If you are unfamiliar with the linux command line, you might find it useful to work through this | ||
[tutorial](https://tutorials.ubuntu.com/tutorial/command-line-for-beginners) provided by Ubuntu. | ||
|
||
Now head over and follow the installation instructions for PyBaMM for linux | ||
[here](INSTALL-LINUX-MAC.md). | ||
|
||
## Use Visual Studio Code to run PyBaMM | ||
|
||
You will probably want to use a native Windows IDE such as Visual Studio Code or the | ||
full Microsoft Visual Studio IDE. Both of these packages can connect to WSL so that you | ||
can write python code in a native windows environment, while at the same time using WSL | ||
to run the code using your installed Ubuntu distribution. The following instructions | ||
assume that you are using Visual Studio Code. | ||
|
||
First, setup VSCode to run within the `PyBaMM` directory that you created above, using | ||
the instructions provided [here](https://code.visualstudio.com/docs/remote/wsl). | ||
|
||
Once you have opened the `PyBaMM` folder in vscode, use the `Extensions` panel to | ||
install the `Python` extension from Microsoft. Note that extensions are either installed | ||
on the Windows (Local) or on in WSL (WSL:Ubuntu), so even if you have used VSCode | ||
previously with the Python extension, you probably haven't installed it in WSL. Make | ||
sure to reload after installing the Python extension so that it is available. | ||
|
||
If you have installed PyBaMM into the virtual environment `env` as in the PyBaMM linux | ||
install guide, then VSCode should automatically start using this environment and you | ||
should see something similar to "Python 3.6.8 64-bit ('env': venv)" in the bottom bar. | ||
|
||
To test that vscode can run a PyBaMM script, navigate to the `examples/scripts` folder | ||
and right click on the `create-model.py` script. Select "Run current file in Python | ||
Interactive Window". This should run the script, which sets up and solves a model of SEI | ||
thickness using PyBaMM. You should see a plot of SEI thickness versus time pop up in the | ||
interactive window. | ||
|
||
The Python Interactive Window in VSCode can be used to view plots, but is restricted in | ||
functionality and cannot, for example, launch separate windows to show plot. To setup an | ||
xserver on windows and use this to launch windows for plotting, follow these | ||
instructions: | ||
|
||
1. Install VcXsrv from [here](https://sourceforge.net/projects/vcxsrv/). | ||
1. Set the display port in the WSL command-line: `echo "export DISPLAY=localhost:0.0" >> | ||
~/.bashrc` | ||
1. Install python3-tk in WSL: `sudo apt-get install python3-tk` | ||
1. Set the matplotlib backend to TKAgg in WSL: `echo "backend : TKAgg" >> | ||
~/.config/matplotlib/matplotlibrc` | ||
1. Before running the code, just launch XLaunch (with the default settings) from within | ||
Windows. Then the code works as usual. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,54 @@ | ||
We recommend the use of Windows Subsystem for Linux (WSL) to install PyBaMM, see the | ||
instructions below to get PyBaMM working using Windows, WSL and VSCode. | ||
## Prerequisites | ||
|
||
## Install WSL | ||
To use and/or contribute to PyBaMM, you must have Python 3.6 or 3.7 installed (note that 3.8 is not yet supported). | ||
|
||
Follow the instructions from Microsoft | ||
[here](https://docs.microsoft.com/en-us/windows/wsl/install-win10). When given the | ||
option, choose the Ubuntu 18.04 LTS distribution to install. Don't forget to initialise | ||
the Ubuntu installation using the instructions given | ||
[here](https://docs.microsoft.com/en-us/windows/wsl/initialize-distro). | ||
To install Python 3 download the installation files from [Python's website](https://www.python.org/downloads/windows/). Make sure | ||
to tick the box on `Add Python 3.X to PATH`. For more detailed instructions please see the | ||
[official Python on Windows guide](https://docs.python.org/3.7/using/windows.html). | ||
|
||
## Install PyBaMM | ||
|
||
Open a terminal window in your installed Ubuntu distribution by selecting "Ubuntu" from | ||
the start menu. This should give you a bash prompt in your home directory. | ||
### User install | ||
Launch the Command Prompt and go to the directory where you want to install PyBaMM. You can find a reminder of how to | ||
navigate the terminal [here](http://www.cs.columbia.edu/~sedwards/classes/2015/1102-fall/Command%20Prompt%20Cheatsheet.pdf). | ||
|
||
To download the PyBaMM source code, you first need to install git, which you can do by | ||
typing | ||
We recommend to install PyBaMM within a virtual environment, in order not | ||
to alter any distribution python files. | ||
|
||
```bash | ||
sudo apt install git-core | ||
``` | ||
|
||
For easier integration with WSL, we recommend that you install PyBaMM in your *Windows* | ||
Documents folder, for example by first navigating to | ||
To create a virtual environment `env` within your current directory type: | ||
|
||
```bash | ||
$ cd /mnt/c/Users/USER_NAME/Documents | ||
python -m venv env | ||
``` | ||
|
||
where USER_NAME is your username. Exact path to Windows documents may vary. Now use git to clone the PyBaMM repository: | ||
You can then "activate" the environment using: | ||
|
||
```bash | ||
git clone https://github.com/pybamm-team/PyBaMM.git | ||
env\Scripts\activate.bat | ||
``` | ||
Now all the calls to pip described below will install PyBaMM and its dependencies into | ||
the environment `env`. When you are ready to exit the environment and go back to your | ||
original system, just type: | ||
|
||
This will create a new directly called `PyBaMM`, you can move to this directory in bash | ||
using the `cd` command: | ||
|
||
```bash | ||
cd PyBaMM | ||
```bash | ||
deactivate | ||
``` | ||
|
||
If you are unfamiliar with the linux command line, you might find it useful to work through this | ||
[tutorial](https://tutorials.ubuntu.com/tutorial/command-line-for-beginners) provided by Ubuntu. | ||
|
||
Now head over and follow the installation instructions for PyBaMM for linux | ||
[here](INSTALL-LINUX-MAC.md). | ||
|
||
## Use Visual Studio Code to run PyBaMM | ||
|
||
You will probably want to use a native Windows IDE such as Visual Studio Code or the | ||
full Microsoft Visual Studio IDE. Both of these packages can connect to WSL so that you | ||
can write python code in a native windows environment, while at the same time using WSL | ||
to run the code using your installed Ubuntu distribution. The following instructions | ||
assume that you are using Visual Studio Code. | ||
|
||
First, setup VSCode to run within the `PyBaMM` directory that you created above, using | ||
the instructions provided [here](https://code.visualstudio.com/docs/remote/wsl). | ||
|
||
Once you have opened the `PyBaMM` folder in vscode, use the `Extensions` panel to | ||
install the `Python` extension from Microsoft. Note that extensions are either installed | ||
on the Windows (Local) or on in WSL (WSL:Ubuntu), so even if you have used VSCode | ||
previously with the Python extension, you probably haven't installed it in WSL. Make | ||
sure to reload after installing the Python extension so that it is available. | ||
PyBaMM can be installed via pip: | ||
```bash | ||
pip install pybamm | ||
``` | ||
|
||
If you have installed PyBaMM into the virtual environment `env` as in the PyBaMM linux | ||
install guide, then VSCode should automatically start using this environment and you | ||
should see something similar to "Python 3.6.8 64-bit ('env': venv)" in the bottom bar. | ||
PyBaMM's dependencies (such as `numpy`, `scipy`, etc) will be installed automatically when you install PyBaMM using `pip`. | ||
|
||
To test that vscode can run a PyBaMM script, navigate to the `examples/scripts` folder | ||
and right click on the `create-model.py` script. Select "Run current file in Python | ||
Interactive Window". This should run the script, which sets up and solves a model of SEI | ||
thickness using PyBaMM. You should see a plot of SEI thickness versus time pop up in the | ||
interactive window. | ||
For an introduction to virtual environments, see (https://realpython.com/python-virtual-environments-a-primer/). | ||
|
||
The Python Interactive Window in VSCode can be used to view plots, but is restricted in | ||
functionality and cannot, for example, launch separate windows to show plot. To setup an | ||
xserver on windows and use this to launch windows for plotting, follow these | ||
instructions: | ||
## Uninstall PyBaMM | ||
PyBaMM can be uninstalled by running | ||
```bash | ||
pip uninstall pybamm | ||
``` | ||
in your virtual environment. | ||
|
||
1. Install VcXsrv from [here](https://sourceforge.net/projects/vcxsrv/). | ||
1. Set the display port in the WSL command-line: `echo "export DISPLAY=localhost:0.0" >> | ||
~/.bashrc` | ||
1. Install python3-tk in WSL: `sudo apt-get install python3-tk` | ||
1. Set the matplotlib backend to TKAgg in WSL: `echo "backend : TKAgg" >> | ||
~/.config/matplotlib/matplotlibrc` | ||
1. Before running the code, just launch XLaunch (with the default settings) from within | ||
Windows. Then the code works as usual. | ||
## Installation using WSL | ||
If you want to install the optional PyBaMM solvers, you have to use the Windows Subsystem for Linux (WSL). You can find | ||
the installation instructions [here](INSTALL-WINDOWS-WSL.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.