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

Registry #231

Merged
merged 6 commits into from Oct 27, 2022
Merged

Registry #231

merged 6 commits into from Oct 27, 2022

Conversation

dalonsoa
Copy link
Collaborator

@dalonsoa dalonsoa commented Oct 20, 2022

This PR starts the refactoring of the code in solar_cell_solver.py such that it uses registered functions within a set of registries to execute different calculations rather than hardcoding the functionality.

Among other things, using registries enables:

  • Checking externally what options are available (eg. by tools like sunglass)
  • Expanding the existing functionality with new one without editing Solcore's source code.
  • Overwriting existing functionality with custom versions of it to try alternative implementations, again without modifying the source code.

This PR concerns the implementation of the top level ACTIONS of the solar cell solver. PRs for the optical, IV, QE, etc. solvers will follow.

There seems to be lot's of changes because the solar_cell_solver.py file got reformatted by black, but the only important bit in that file is the function solve_solar_cell.

@codecov
Copy link

codecov bot commented Oct 20, 2022

Codecov Report

Merging #231 (1b6fa61) into develop (a5e0dae) will increase coverage by 0.12%.
The diff coverage is 73.91%.

@@             Coverage Diff             @@
##           develop     #231      +/-   ##
===========================================
+ Coverage    45.76%   45.88%   +0.12%     
===========================================
  Files           84       85       +1     
  Lines         9096     9109      +13     
===========================================
+ Hits          4163     4180      +17     
+ Misses        4933     4929       -4     
Impacted Files Coverage Δ
solcore/solar_cell_solver.py 69.04% <68.42%> (+2.58%) ⬆️
solcore/registries.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@dalonsoa dalonsoa mentioned this pull request Oct 20, 2022
@phoebe-p
Copy link
Member

This is great, I did not know this existed! Following this example, hopefully I can also help converting the rest of Solcore to use registries.

@phoebe-p phoebe-p merged commit c9a10ba into develop Oct 27, 2022
@dalonsoa dalonsoa deleted the registry branch December 12, 2022 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants