Skip to content
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

Migrate examples to notebooks #229

Merged
merged 75 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
75d7a9b
migrate array as sensore example
waltsims Dec 14, 2023
be12d7a
fix TODO
waltsims Dec 14, 2023
305f16d
Create README.md
waltsims Dec 16, 2023
84eef5f
Create CONTRIBUTING.md
waltsims Dec 16, 2023
7878f3a
move CONTRIBUTING.md to .github/CONTRIBUTING.md
waltsims Dec 16, 2023
dfeb967
Add array as a source example notebook
waltsims Dec 16, 2023
aad7a62
update plotting
waltsims Dec 16, 2023
4caf581
notebook for linear_array_transducer
waltsims Dec 16, 2023
aab53a0
Fix accidentally deleted section
waltsims Dec 16, 2023
d6021bb
reformat
waltsims Dec 16, 2023
a35d06c
update b-mode reconstruction example
waltsims Dec 18, 2023
8fa9098
remove unused import
waltsims Dec 18, 2023
78f4ec1
Fix filter dimensions and update b-modes
waltsims Dec 19, 2023
1c6ea64
add deprication warning of beamforming code
waltsims Dec 19, 2023
af0cca2
remove uff dependency
waltsims Dec 21, 2023
620cadf
Update sensor data hash
waltsims Dec 23, 2023
68aa16b
Add requests dependency
waltsims Jan 4, 2024
1527052
Merge branch 'master' into migrate-examples-to-notebooks
waltsims Jan 4, 2024
8b41d86
Update examples readme
waltsims Jan 4, 2024
c16bd00
Update readme instructions and add readmes
waltsims Jan 4, 2024
99615dd
fix typo
waltsims Jan 4, 2024
87690cb
fix another typo
waltsims Jan 4, 2024
5f11841
Add colab badges
waltsims Jan 4, 2024
ad8a203
update filenames
waltsims Jan 4, 2024
a94b6d1
rename files
waltsims Jan 4, 2024
ffed9ac
fix typo
waltsims Jan 4, 2024
4491a3e
update example to close plts on windows CI machines
waltsims Jan 4, 2024
a1a9e25
Merge branch 'migrate-examples-to-notebooks' of github.com:waltsims/k…
waltsims Jan 4, 2024
bb07bff
try interactive mode
waltsims Jan 4, 2024
2cc919e
clean up import
waltsims Jan 4, 2024
c1f984b
restructure and update bmode example
waltsims Jan 4, 2024
b5a6d88
add processing step plot
waltsims Jan 4, 2024
5bc9e2b
update readme
waltsims Jan 4, 2024
ac7d78b
comment out unused variables
waltsims Jan 4, 2024
86fbeb7
cleanup
waltsims Jan 4, 2024
0eb4bc3
ruff fix
waltsims Jan 4, 2024
5ad794c
fix x-axis
waltsims Jan 4, 2024
c0eb377
bugfix
waltsims Jan 4, 2024
3a67c71
add us-bmode notebook
waltsims Jan 4, 2024
57576c7
fix-typo
waltsims Jan 4, 2024
1675bca
rename readmes
waltsims Jan 4, 2024
4990fda
quiet k-wave-python install and extra outputs
waltsims Jan 4, 2024
e5546ac
delete extra cell
waltsims Jan 4, 2024
b01ac3f
fix indentation
waltsims Jan 4, 2024
6051456
missed one
waltsims Jan 4, 2024
d787550
update setup cell
waltsims Jan 4, 2024
38d4dc1
Add pre-commit config to repo to automatically clean notebook outputs…
waltsims Jan 9, 2024
991c891
Merge branch 'master' into migrate-examples-to-notebooks
waltsims Jan 9, 2024
b4a6c3c
add space
waltsims Jan 10, 2024
c3742e2
remove line break
waltsims Jan 10, 2024
8d820f2
update colorbar
waltsims Jan 10, 2024
5f0ed6b
remove commented code
waltsims Jan 10, 2024
84f5d5b
update colorbar in .py file
waltsims Jan 10, 2024
10ba946
formatting updates
waltsims Jan 10, 2024
8a54ae9
capture make time
waltsims Jan 10, 2024
bbe79cc
replace &> /dev/null with %%capture
waltsims Jan 10, 2024
0b6768b
Update README.md
waltsims Jan 11, 2024
fc597e2
update hyperlink
waltsims Jan 11, 2024
a649610
Merge branch 'master' into migrate-examples-to-notebooks
waltsims Jan 14, 2024
affd51d
Merge branch 'master' of github.com:waltsims/k-wave-python into migra…
waltsims Jan 14, 2024
653d062
bugfix
waltsims Jan 14, 2024
31f9c1b
bug fix
waltsims Jan 15, 2024
1184384
add comments
waltsims Jan 15, 2024
f314c18
increase rc.embed_limit
waltsims Jan 15, 2024
97b162a
fix x's rendering
waltsims Jan 15, 2024
c50c5cd
add difference plot
waltsims Jan 15, 2024
ccc3d3a
fix import
waltsims Jan 15, 2024
d7a9974
update example figure
waltsims Jan 15, 2024
eae575a
update example path in readme
waltsims Jan 15, 2024
59d9013
Update README.md
waltsims Jan 15, 2024
1a41eda
move photoacoustic example
waltsims Jan 15, 2024
76af1a7
rename files
waltsims Jan 15, 2024
726265d
fix photoacoustic notebook
waltsims Jan 15, 2024
0d7505d
Merge branch 'master' into migrate-examples-to-notebooks
waltsims Jan 15, 2024
eb3788f
Merge branch 'master' into migrate-examples-to-notebooks
waltsims Jan 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Contributing Guidelines

Thanks for your interest in contributing an example to k-wave-python!

## Issues

### Create a new issue

If you would like to contribute to this project, search to see if a related issue already exists. If a related issue doesn't exist, you can open a new issue using a relevant issue form.

### Solve an open issue

Have a look through our existing issues to find one that interests you.
You can narrow down the search using labels as filters.
If you find an issue to work on, you are welcome to open a PR with a fix.

## Make changes

Fork k-wave-python and make changes you would like to contribute to your fork.

## Open a Pull-Request

* Complete the "Ready for review" template so that we can review your PR. This template helps reviewers understand your changes and the purpose of your pull request.

* [Link PR to an issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) if you are solving one.

* Don't forget to click the checkbox to [allow maintainer edits](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork) so you PR can be updated before a merge.


2 changes: 1 addition & 1 deletion .github/workflows/test_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
pip install -e '.[example]'
- name: Run example script
run: |
python3 examples/bmode_reconstruction_example.py
python3 examples/us_bmode_linear_transducer/us_bmode_linear_transducer.py
- name: Upload example results
uses: actions/upload-artifact@v3
with:
Expand Down
23 changes: 23 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
repos:
- repo: https://github.com/srstevenson/nb-clean.git
rev: 3.2.0
hooks:
- id: nb-clean
name: nb-clean
entry: nb-clean clean
language: python
types_or: [jupyter]
minimum_pre_commit_version: 2.9.2
# - repo: https://github.com/pre-commit/pre-commit-hooks
# rev: v4.5.0 # Use the ref you want to point at
# hooks:
# - id: trailing-whitespace
# - repo: https://github.com/nbQA-dev/nbQA
# rev: 1.7.1
# hooks:
# - id: nbqa-ruff
# name: nbqa-ruff
# entry: nbqa ruff
# language: python
# types_or: [jupyter]
# minimum_pre_commit_version: 2.9.2
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ git clone https://github.com/waltsims/k-wave-python
cd k-wave-python
git checkout v0.3.0
pip install '.[example]'
python3 examples/bmode_reconstruction_example.py
python3 examples/us_bmode_linear_transducer/us_bmode_linear_transducer.py
```

This example file steps through the process of:
Expand Down
Binary file modified docs/_static/example_bmode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Examples

Many examples from k-wave-python are Python mirrors of the [large collection of great examples](http://www.k-wave.org/documentation/k-wave_examples.php) from the original k-wave project.
All examples are included as python files or notebooks in a subdirectory of the example directory.
Every example has a short readme.md file which briefly describes the purpose of the example.

## List of Examples

- [Array as a sensor](at_array_as_sensor/) ([original example](http://www.k-wave.org/documentation/example_at_array_as_sensor.php), [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/waltsims/k-wave-python/blob/migrate-examples-to-notebooks/examples/at_array_as_sensor/at_array_as_sensor.ipynb))
- [Array as a source](at_array_as_source/) ([original example](http://www.k-wave.org/documentation/example_at_array_as_source.php), [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/waltsims/k-wave-python/blob/migrate-examples-to-notebooks/examples/at_array_as_source/at_array_as_source.ipynb))
- [Linear array transducer](at_linear_array_transducer/)
([original example](http://www.k-wave.org/documentation/example_at_linear_array_transducer.php), [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/waltsims/k-wave-python/blob/migrate-examples-to-notebooks/examples/at_linear_array_transducer/at_linear_array_transducer.ipynb))
- [Photoacoustic Waveforms](ivp_photoacoustic_waveforms/) ([original example](http://www.k-wave.org/documentation/example_ivp_photoacoustic_waveforms.php), [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/waltsims/k-wave-python/blob/migrate-examples-to-notebooks/examples/ivp_photoacoustic_waveforms/ivp_photoacoustic_waveforms.ipynb))
- [Linear transducer B-mode](us_bmode_linear_transducer/) ([original example](http://www.k-wave.org/documentation/example_us_bmode_linear_transducer.php), [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/waltsims/k-wave-python/blob/migrate-examples-to-notebooks/examples/us_bmode_linear_transducer/us_bmode_linear_transducer.ipynb))

## Contributing new examples

When adding a new example notebook, follow these steps:

1. Search the open issues to see if a related example has already been requested. If not add an example issue and assign yourself to the issue.
3. Fork and clone the repository and create a branch for your new example.
2. Create an example sub-directory using the name from the hyperlink of the origional k-wave example if it exists (e.g. for http://www.k-wave.org/documentation/example_ivp_loading_external_image.php name the directory "ivp_loading_external_image).
3. Add your example notebook or files to your example directory.
4. Add a README.md file to your example directory briefly describing the concept or principle the example is meant to display and linking to the origonal k-wave example page if it exists.
5. Include a link in the readme.md in the examples directory to a colab notebook for your example.
6. Add a your example to the list on this readme.md and add a colab badge [using html](https://openincolab.com/) OR copy the pure markdown version above.
7. Open a pull request that [closes the open issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) from your forked example branch and name pull request "[Example] \<name of your example\>".

Thanks for contributing to k-wave-python!
5 changes: 5 additions & 0 deletions examples/at_array_as_sensor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Defining A Sensor Using An Array Transducer Example

This example provides a demonstration of using the kWaveArray class to define an array transducer with 20 arc-shaped elements which is then used as a receiver array. It builds on the Defining A Source Using An Array Transducer Example.

To read more, visit the [original example page](http://www.k-wave.org/documentation/example_at_array_as_sensor.php)
Loading
Loading