-
Notifications
You must be signed in to change notification settings - Fork 26
Packaged code for PyPI by ahmedsa #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
SyedMustafaAhmad
wants to merge
3
commits into
Simulation-Software-Engineering:main
Choose a base branch
from
SyedMustafaAhmad:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,3 @@ | ||
__pycache__ | ||
dist | ||
src/ahmedsa_diffusion2d.egg-info |
This file contains hidden or 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,19 +1,36 @@ | ||
# diffusion2D | ||
|
||
## Instructions for students | ||
|
||
Please follow the instructions in [pypi_exercise.md](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/03_building_and_packaging/pypi_exercise.md). | ||
|
||
The code used in this exercise is based on [Chapter 7 of the book "Learning Scientific Programming with Python"](https://scipython.com/book/chapter-7-matplotlib/examples/the-two-dimensional-diffusion-equation/). | ||
|
||
## Project description | ||
# Project description | ||
A 2D diffusion equation solver with visualization output that used matplotlib and numpy to plot 3 graphs. The project can take arguements for values of dx, dy and D to compute and visualize the 2D diffusion and use matplotlib to plot the figures. | ||
|
||
## Installing the package | ||
You can use pip to directly install the package or build it from source using pip from the tar.gz/.whl package from [TestPyPi](link) | ||
|
||
### Using pip3 to install from PyPI | ||
To install the package, simply run: | ||
```console | ||
pip install -i https://test.pypi.org/simple/ ahmedsa-diffusion2d | ||
``` | ||
|
||
### Required dependencies | ||
The required dependencies are: | ||
- Python (version >= 3) | ||
- pip | ||
- NumPy | ||
- Matplotlib | ||
If you plan to build from source, you also need to install the **build** pip package. | ||
|
||
## Running this package | ||
To run the package, you can use the following command: | ||
```console | ||
python3 diffusion2d.py | ||
``` | ||
Or if you prefer to pass values of dx, dy and D (respectively), you can pass them as arguements as follows: | ||
```console | ||
python3 diffusion2d.py solve <dx> <dy> <D> | ||
``` | ||
|
||
## Citing | ||
- [Chapter 7 of the book "Learning Scientific Programming with Python"](https://scipython.com/book/chapter-7-matplotlib/examples/the-two-dimensional-diffusion-equation/) | ||
- [Simulation Service Engineering Exercise](https://github.com/Simulation-Software-Engineering/diffusion2D) | ||
|
This file contains hidden or 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,20 @@ | ||
[build-system] | ||
requires = ["setuptools", "wheel", "build"] | ||
|
||
[project] | ||
name = "ahmedsa_diffusion2d" | ||
description = "A 2D diffusion equation solver with visualization output" | ||
authors = [ | ||
{ name="Syed Mustafa Ahmed", email="[email protected]" } | ||
] | ||
readme = "README.md" | ||
keywords = ["diffusion2D", "solver"] | ||
classifiers = [ | ||
"Programming Language :: Python :: 3" | ||
] | ||
dependencies = [ | ||
"matplotlib", | ||
"numpy" | ||
] | ||
requires-python = ">=3.0" | ||
version = "0.0.2" |
This file contains hidden or 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,4 @@ | ||
from setuptools import setup | ||
|
||
if __name__ == "__main__": | ||
setup() |
File renamed without changes.
Empty file.
This file contains hidden or 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 hidden or 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,15 @@ | ||
import matplotlib.pyplot as plt | ||
|
||
def create_plot(fig, u, T_cold, T_hot, dt, time_step, fig_counter): | ||
ax = fig.add_subplot(220 + fig_counter) | ||
im = ax.imshow(u, cmap=plt.get_cmap('hot'), vmin=T_cold, vmax=T_hot) | ||
ax.set_axis_off() | ||
ax.set_title(f'{time_step * dt * 1000:.1f} ms') | ||
return im | ||
|
||
def output_plots(fig, im): | ||
fig.subplots_adjust(right=0.85) | ||
cbar_ax = fig.add_axes([0.9, 0.15, 0.03, 0.7]) | ||
cbar_ax.set_xlabel('$T$ / K', labelpad=20) | ||
fig.colorbar(im, cax=cbar_ax) | ||
plt.show() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instructions to run the packaged code are expected here. Without instructions to run the packaged code, it is hard to figure out how it works.