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

Implementing new API for NDK #122

Merged
merged 46 commits into from
Aug 9, 2023
Merged

Implementing new API for NDK #122

merged 46 commits into from
Aug 9, 2023

Conversation

NewtonSander
Copy link
Collaborator

@NewtonSander NewtonSander commented Jul 19, 2023

Introduction

This PR brings a suggested new API for NDK, the main goals are:

  • to remove the need of defining a subclass of Scenario and implement abstract methods when creating a new scenario.
  • to allow the scenario components to be added and changed procedurally, easily accommodating a GUI for user input
  • to ease the customization of scenario components
  • to remove chunks of code that were not reachable

The scenarios NDK already supported were slightly changed in order to conform to the new API

An example of how the procedural API can be used is the Full Scenario Example

@codecov-commenter
Copy link

codecov-commenter commented Jul 31, 2023

Codecov Report

Patch coverage: 83.47% and project coverage change: +0.66% 🎉

Comparison is base (6e53d78) 73.15% compared to head (c7283ea) 73.81%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #122      +/-   ##
==========================================
+ Coverage   73.15%   73.81%   +0.66%     
==========================================
  Files          27       30       +3     
  Lines        2097     2074      -23     
==========================================
- Hits         1534     1531       -3     
+ Misses        563      543      -20     
Files Changed Coverage Δ
src/neurotechdevkit/materials.py 95.23% <ø> (ø)
src/neurotechdevkit/rendering/napari.py 33.33% <0.00%> (ø)
src/neurotechdevkit/scenarios/_resources.py 98.33% <ø> (ø)
src/neurotechdevkit/scenarios/_utils.py 96.22% <ø> (+0.62%) ⬆️
src/neurotechdevkit/results/_results.py 60.47% <50.00%> (+1.28%) ⬆️
.../neurotechdevkit/scenarios/built_in/_scenario_2.py 57.89% <72.72%> (ø)
src/neurotechdevkit/scenarios/_base.py 77.30% <77.03%> (-1.43%) ⬇️
src/neurotechdevkit/grid.py 92.85% <92.85%> (ø)
.../neurotechdevkit/scenarios/built_in/_scenario_1.py 98.43% <98.43%> (ø)
src/neurotechdevkit/__init__.py 100.00% <100.00%> (+7.14%) ⬆️
... and 8 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@NewtonSander
Copy link
Collaborator Author

@charlesincharge I've addressed all your suggestions and also made some other changes, could you have another look?

Copy link
Contributor

@charlesbmi charlesbmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Awesome job, and looking forward to / already using this new API.

docs/examples/plot_phased_array_source.py Outdated Show resolved Hide resolved
src/neurotechdevkit/sources.py Outdated Show resolved Hide resolved
tests/neurotechdevkit/scenarios/test_problem.py Outdated Show resolved Hide resolved
src/neurotechdevkit/scenarios/_base.py Outdated Show resolved Hide resolved
src/neurotechdevkit/scenarios/_base.py Show resolved Hide resolved
@d-lucena d-lucena merged commit 7696119 into main Aug 9, 2023
14 checks passed
@d-lucena d-lucena deleted the implementing_procedural_api branch August 9, 2023 16:20
NewtonSander added a commit that referenced this pull request Jul 26, 2024
* Implementing new API for NDK

* Updating gallery examples to use the new API

* Updating 3d scenario result

* Cleaning up scenario __init__

* Updating api docs

* Compiling problem explicitly

* Small fixes to plot full scenario

* Creating NDK's own Problem class

* Removing 'scenario_id' attribute

* Cleaning up

* Fixing docs

* Decoupling render layout from compile problem

* Moving grid creation to its own class

* Moving center_frequency to the scenario root

* Cleaning up

* Cleaning up code. Invalidating grid and compiled problem when center_frequency is changed

* Adapting documentation

* Updating plot full scenario to use the procedural approach

* Updating API docs adding the Grid and Problem pages

* Fixing bug with 3D example

* Improving docs, updating hash of 3d results file

* Improving docs

* Small improvements to notebook

* Addressing review suggestion: replacing enum with subdirectory containing the built in scenarios

* Update src/neurotechdevkit/grid.py

Co-authored-by: charles <[email protected]>

* Addressing review suggestion

* Fixing issue with commited PR suggestion

* Fixing bug

* Removing layer_ids from problem creation. Removing need of creating material_layers, using material_masks keys instead

* Fixing print

* Replacing numpy arrays with plain lists for simple attributes like position, origin and direction

* Refactoring

* Refactoring

* Fixing hash of results file

* Simplifying API

* Setting center_frequency in built_in scenarios

* Adding SliceAxis to spellcheck's whitelist

* Adding unit tests and cleaning up code

* Adding predefined target options

* Fix typo

* Showing how the predefined targt options can be used

* Improving plot full scenario masks creation

* Addressing review suggestions

* Fixing spellchecking error by removing unnecessary types from docstrings

* Updating 3d file hash

* update docstrings

---------

Co-authored-by: charles <[email protected]>
Co-authored-by: d-lucena <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants