-
Notifications
You must be signed in to change notification settings - Fork 2
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
refactor: Improve code readability and reducing code duplications #127
Conversation
- Using tuples to reperesent the non-diagonal elements via dictionary
Changed Files
|
Reviewer's Guide by SourceryThe pull request refactors matrix construction in ligand field theory calculations by introducing a new helper method Class diagram for LigandFieldTheory refactorclassDiagram
class LigandFieldTheory {
+Dq: float
+B: float
+C: float
+solver() Dict~str, Float64Array~
+construct_matrix(diag_elements: List~float~, off_diag_elements: Dict~Tuple~int, int~, float~) Float64Array
}
class d2 {
+A_1_1_states() Float64Array
+E_1_states() Float64Array
+T_1_2_states() Float64Array
+T_3_1_states() Float64Array
+solver() Dict~str, Float64Array~
}
LigandFieldTheory <|-- d2
note for LigandFieldTheory "Added construct_matrix method to centralize matrix creation"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @Anselmoo - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
@@ -65,6 +65,20 @@ def solver(self) -> Dict[str, Float64Array]: | |||
msg = "Subclasses should implement this method." | |||
raise NotImplementedError(msg) | |||
|
|||
def construct_matrix( |
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.
suggestion: Document the symmetry assumption and consider skipping zero elements
The docstring should mention that the method assumes off_diag_elements contains values for a symmetric matrix. Also, consider skipping zero values in off_diag_elements to avoid unnecessary operations.
…w tests for LigandFieldTheory
…unimplemented functionality
…ns in matrices.py
Summary by Sourcery
Enhancements: