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

Optics registry #232

Merged
merged 24 commits into from Oct 27, 2022
Merged

Optics registry #232

merged 24 commits into from Oct 27, 2022

Conversation

dalonsoa
Copy link
Collaborator

Following #231, this PR creates a registry of the optics methods, refactoring the function methods to make them more readable and explicit on their inputs. It also refactors solar_cell_solver.py to make use of this registry.

Must be reviewed after #231, as it builds on top of it.

@codecov
Copy link

codecov bot commented Oct 20, 2022

Codecov Report

Merging #232 (4c74d9a) into develop (a5e0dae) will increase coverage by 0.26%.
The diff coverage is 72.50%.

@@             Coverage Diff             @@
##           develop     #232      +/-   ##
===========================================
+ Coverage    45.76%   46.03%   +0.26%     
===========================================
  Files           84       85       +1     
  Lines         9096     9120      +24     
===========================================
+ Hits          4163     4198      +35     
+ Misses        4933     4922      -11     
Impacted Files Coverage Δ
solcore/optics/rcwa.py 31.50% <46.66%> (+7.62%) ⬆️
solcore/optics/beer_lambert.py 50.35% <54.05%> (+0.35%) ⬆️
solcore/optics/external_optics.py 34.78% <60.00%> (+10.97%) ⬆️
solcore/solar_cell_solver.py 71.06% <71.42%> (+4.60%) ⬆️
solcore/optics/__init__.py 87.50% <87.50%> (+25.00%) ⬆️
solcore/optics/tmm.py 89.33% <97.05%> (-2.03%) ⬇️
solcore/registries.py 100.00% <100.00%> (ø)

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

else:
ASC.absorptance_detailed_balance(solar_cell[j])
w = layer_object.width

def alf(x):
return -1 / w * np.log(np.maximum(1 - layer_object.absorptance(x), 1e-3))
return (
Copy link
Member

Choose a reason for hiding this comment

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

This is very minor and I guess it was done by black, I am fine with it, but the return here ooks a bit weird/harder to read than before? Anyway, if black will just keep changing it back then it will be pointless to do anything about it!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In that particular case, I think it makes sense to use some intermediate variables to make the code more readable. Solved!

@dalonsoa dalonsoa merged commit 3ad170d into develop Oct 27, 2022
@dalonsoa dalonsoa deleted the optics_registry branch October 27, 2022 12:48
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