Skip to content

Create mesh visualization - just for CI #185

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

Closed
wants to merge 56 commits into from

Conversation

jan-janssen
Copy link
Member

@jan-janssen jan-janssen commented May 17, 2024

Summary by CodeRabbit

  • New Features

    • Introduced create_mesh function for generating mesh grids based on atomic structures.
    • Added plot_isosurface function for creating customizable mesh plots using Plotly.
  • Tests

    • Added unit tests for the create_mesh function to ensure reliable mesh generation with various parameters.

Copy link

coderabbitai bot commented May 17, 2024

Important

Review Skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The updates to the structuretoolkit package introduce new functionalities for mesh generation and visualization. Key additions include the create_mesh function for generating meshes based on atomic structures and the plot_isosurface function for visualizing these meshes. These enhancements are complemented by corresponding unit tests to ensure functionality and reliability.

Changes

File Path Change Summary
structuretoolkit/__init__.py Added create_mesh to exports and included plot_isosurface from visualize.
structuretoolkit/build/__init__.py Added import statement for create_mesh from structuretoolkit.build.mesh.
structuretoolkit/build/mesh.py Introduced create_mesh function for generating mesh grids using NumPy and ASE libraries.
structuretoolkit/visualize.py Added plot_isosurface function for customizable mesh plotting using Plotly.
tests/test_mesh.py Added unit tests for create_mesh function, validating mesh creation with various parameters.

In the toolkit's realm, new tools arise,
Meshes form where atoms lie.
Visual plots with colors bright,
Show the structures in the light.
Tests ensure the code stays true,
A rabbit's joy in what we do.
🌟✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@jan-janssen jan-janssen marked this pull request as draft May 17, 2024 17:00
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Out of diff range and nitpick comments (2)
structuretoolkit/build/__init__.py (1)

Line range hint 2-10: Many imports are flagged as unused. If these are intended for external use, consider adding them to __all__ to clarify their purpose.

+ __all__ = ['grainboundary', 'get_grainboundary_info', 'B2', 'C14', 'C15', 'C36', 'D03', 'pyxtal', 'sqs_structures', 'high_index_surface', 'get_high_index_surface_info', 'create_mesh']
structuretoolkit/__init__.py (1)

Line range hint 5-54: Many imports are flagged as unused. If these are intended for external use, consider adding them to __all__ to clarify their purpose.

+ __all__ = ['find_mic', 'find_solids', 'get_adaptive_cna_descriptors', 'get_average_of_unique_labels', 'get_centro_symmetry_descriptors', 'get_cluster_positions', 'get_delaunay_neighbors', 'get_diamond_structure_descriptors', 'get_distances_array', 'get_equivalent_atoms', 'get_interstitials', 'get_layers', 'get_mean_positions', 'get_neighborhood', 'get_neighbors', 'get_steinhardt_parameters', 'get_strain', 'get_symmetry', 'get_voronoi_neighbors', 'get_voronoi_vertices', 'get_voronoi_volumes', 'B2', 'C14', 'C15', 'C36', 'D03', 'get_grainboundary_info', 'get_high_index_surface_info', 'grainboundary', 'high_index_surface', 'sqs_structures', 'create_mesh', 'SymmetryError', 'apply_strain', 'ase_to_pymatgen', 'ase_to_pyscal', 'center_coordinates_in_unit_cell', 'get_extended_positions', 'get_vertical_length', 'get_wrapped_coordinates', 'pymatgen_to_ase', 'select_index', 'plot3d', 'plot_isosurface']
Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 696fd52 and 63fb47a.
Files selected for processing (5)
  • structuretoolkit/init.py (2 hunks)
  • structuretoolkit/build/init.py (1 hunks)
  • structuretoolkit/build/mesh.py (1 hunks)
  • structuretoolkit/visualize.py (1 hunks)
  • tests/test_mesh.py (1 hunks)
Additional Context Used
Ruff (69)
structuretoolkit/__init__.py (56)

5-5: structuretoolkit.analyse.find_mic imported but unused; consider removing, adding to __all__, or using a redundant alias


6-6: structuretoolkit.analyse.find_solids imported but unused; consider removing, adding to __all__, or using a redundant alias


7-7: structuretoolkit.analyse.get_adaptive_cna_descriptors imported but unused; consider removing, adding to __all__, or using a redundant alias


8-8: structuretoolkit.analyse.get_average_of_unique_labels imported but unused; consider removing, adding to __all__, or using a redundant alias


9-9: structuretoolkit.analyse.get_centro_symmetry_descriptors imported but unused; consider removing, adding to __all__, or using a redundant alias


10-10: structuretoolkit.analyse.get_cluster_positions imported but unused; consider removing, adding to __all__, or using a redundant alias


11-11: structuretoolkit.analyse.get_delaunay_neighbors imported but unused; consider removing, adding to __all__, or using a redundant alias


12-12: structuretoolkit.analyse.get_diamond_structure_descriptors imported but unused; consider removing, adding to __all__, or using a redundant alias


13-13: structuretoolkit.analyse.get_distances_array imported but unused; consider removing, adding to __all__, or using a redundant alias


14-14: structuretoolkit.analyse.get_equivalent_atoms imported but unused; consider removing, adding to __all__, or using a redundant alias


15-15: structuretoolkit.analyse.get_interstitials imported but unused; consider removing, adding to __all__, or using a redundant alias


16-16: structuretoolkit.analyse.get_layers imported but unused; consider removing, adding to __all__, or using a redundant alias


17-17: structuretoolkit.analyse.get_mean_positions imported but unused; consider removing, adding to __all__, or using a redundant alias


18-18: structuretoolkit.analyse.get_neighborhood imported but unused; consider removing, adding to __all__, or using a redundant alias


19-19: structuretoolkit.analyse.get_neighbors imported but unused; consider removing, adding to __all__, or using a redundant alias


20-20: structuretoolkit.analyse.get_steinhardt_parameters imported but unused; consider removing, adding to __all__, or using a redundant alias


21-21: structuretoolkit.analyse.get_strain imported but unused; consider removing, adding to __all__, or using a redundant alias


22-22: structuretoolkit.analyse.get_symmetry imported but unused; consider removing, adding to __all__, or using a redundant alias


23-23: structuretoolkit.analyse.get_voronoi_neighbors imported but unused; consider removing, adding to __all__, or using a redundant alias


24-24: structuretoolkit.analyse.get_voronoi_vertices imported but unused; consider removing, adding to __all__, or using a redundant alias


25-25: structuretoolkit.analyse.get_voronoi_volumes imported but unused; consider removing, adding to __all__, or using a redundant alias


30-30: structuretoolkit.build.B2 imported but unused; consider removing, adding to __all__, or using a redundant alias


31-31: structuretoolkit.build.C14 imported but unused; consider removing, adding to __all__, or using a redundant alias


32-32: structuretoolkit.build.C15 imported but unused; consider removing, adding to __all__, or using a redundant alias


33-33: structuretoolkit.build.C36 imported but unused; consider removing, adding to __all__, or using a redundant alias


34-34: structuretoolkit.build.D03 imported but unused; consider removing, adding to __all__, or using a redundant alias


35-35: structuretoolkit.build.get_grainboundary_info imported but unused; consider removing, adding to __all__, or using a redundant alias


36-36: structuretoolkit.build.get_high_index_surface_info imported but unused; consider removing, adding to __all__, or using a redundant alias


37-37: structuretoolkit.build.grainboundary imported but unused; consider removing, adding to __all__, or using a redundant alias


38-38: structuretoolkit.build.high_index_surface imported but unused; consider removing, adding to __all__, or using a redundant alias


39-39: structuretoolkit.build.sqs_structures imported but unused; consider removing, adding to __all__, or using a redundant alias


40-40: structuretoolkit.build.create_mesh imported but unused; consider removing, adding to __all__, or using a redundant alias


45-45: structuretoolkit.common.SymmetryError imported but unused; consider removing, adding to __all__, or using a redundant alias


46-46: structuretoolkit.common.apply_strain imported but unused; consider removing, adding to __all__, or using a redundant alias


47-47: structuretoolkit.common.ase_to_pymatgen imported but unused; consider removing, adding to __all__, or using a redundant alias


48-48: structuretoolkit.common.ase_to_pyscal imported but unused; consider removing, adding to __all__, or using a redundant alias


49-49: structuretoolkit.common.center_coordinates_in_unit_cell imported but unused; consider removing, adding to __all__, or using a redundant alias


50-50: structuretoolkit.common.get_extended_positions imported but unused; consider removing, adding to __all__, or using a redundant alias


51-51: structuretoolkit.common.get_vertical_length imported but unused; consider removing, adding to __all__, or using a redundant alias


52-52: structuretoolkit.common.get_wrapped_coordinates imported but unused; consider removing, adding to __all__, or using a redundant alias


53-53: structuretoolkit.common.pymatgen_to_ase imported but unused; consider removing, adding to __all__, or using a redundant alias


54-54: structuretoolkit.common.select_index imported but unused; consider removing, adding to __all__, or using a redundant alias


58-58: structuretoolkit.visualize.plot3d imported but unused; consider removing, adding to __all__, or using a redundant alias


58-58: structuretoolkit.visualize.plot_isosurface imported but unused; consider removing, adding to __all__, or using a redundant alias


62-62: structuretoolkit.analyse.find_solids imported but unused; consider removing, adding to __all__, or using a redundant alias


63-63: structuretoolkit.analyse.get_adaptive_cna_descriptors imported but unused; consider removing, adding to __all__, or using a redundant alias


64-64: structuretoolkit.analyse.get_centro_symmetry_descriptors imported but unused; consider removing, adding to __all__, or using a redundant alias


65-65: structuretoolkit.analyse.get_cluster_positions imported but unused; consider removing, adding to __all__, or using a redundant alias


66-66: structuretoolkit.analyse.get_diamond_structure_descriptors imported but unused; consider removing, adding to __all__, or using a redundant alias


67-67: structuretoolkit.analyse.get_equivalent_atoms imported but unused; consider removing, adding to __all__, or using a redundant alias


68-68: structuretoolkit.analyse.get_steinhardt_parameters imported but unused; consider removing, adding to __all__, or using a redundant alias


69-69: structuretoolkit.analyse.get_voronoi_volumes imported but unused; consider removing, adding to __all__, or using a redundant alias


74-74: structuretoolkit.build.get_grainboundary_info imported but unused; consider removing, adding to __all__, or using a redundant alias


75-75: structuretoolkit.build.get_high_index_surface_info imported but unused; consider removing, adding to __all__, or using a redundant alias


76-76: structuretoolkit.build.grainboundary imported but unused; consider removing, adding to __all__, or using a redundant alias


77-77: structuretoolkit.build.sqs_structures imported but unused; consider removing, adding to __all__, or using a redundant alias

structuretoolkit/build/__init__.py (12)

2-2: structuretoolkit.build.aimsgb.grainboundary imported but unused; consider removing, adding to __all__, or using a redundant alias


3-3: structuretoolkit.build.aimsgb.get_grainboundary_info imported but unused; consider removing, adding to __all__, or using a redundant alias


5-5: structuretoolkit.build.compound.B2 imported but unused; consider removing, adding to __all__, or using a redundant alias


5-5: structuretoolkit.build.compound.C14 imported but unused; consider removing, adding to __all__, or using a redundant alias


5-5: structuretoolkit.build.compound.C15 imported but unused; consider removing, adding to __all__, or using a redundant alias


5-5: structuretoolkit.build.compound.C36 imported but unused; consider removing, adding to __all__, or using a redundant alias


5-5: structuretoolkit.build.compound.D03 imported but unused; consider removing, adding to __all__, or using a redundant alias


6-6: structuretoolkit.build.random.pyxtal imported but unused; consider removing, adding to __all__, or using a redundant alias


7-7: structuretoolkit.build.sqs.sqs_structures imported but unused; consider removing, adding to __all__, or using a redundant alias


9-9: structuretoolkit.build.surface.high_index_surface imported but unused; consider removing, adding to __all__, or using a redundant alias


10-10: structuretoolkit.build.surface.get_high_index_surface_info imported but unused; consider removing, adding to __all__, or using a redundant alias


12-12: structuretoolkit.build.mesh.create_mesh imported but unused; consider removing, adding to __all__, or using a redundant alias

tests/test_mesh.py (1)

6-6: numpy imported but unused

Additional comments not posted (5)
structuretoolkit/build/__init__.py (1)

12-12: The import of create_mesh is correctly added to enhance module capabilities.

tests/test_mesh.py (1)

11-28: Comprehensive test cases for create_mesh. Ensure edge cases and error handling are thoroughly tested.

structuretoolkit/build/mesh.py (1)

7-40: Well-implemented create_mesh function with comprehensive documentation and error handling.

structuretoolkit/__init__.py (1)

40-40: The import of create_mesh is correctly added to enhance module capabilities.

structuretoolkit/visualize.py (1)

805-872: Well-implemented plot_isosurface function with comprehensive documentation and error handling.

# Distributed under the terms of "New BSD License", see the LICENSE file.

import unittest
import numpy as np
Copy link

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The search results indicate that numpy is imported but not used in tests/test_mesh.py. Therefore, it is safe to remove the unused import.

  • tests/test_mesh.py: Remove the unused numpy import.
Analysis chain

Verify if numpy is actually unused. If it is, consider removing the import.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Check if `numpy` is used in `tests/test_mesh.py`.

# Test: Search for `numpy` usage. Expect: At least one occurrence.
rg --type python 'np' tests/test_mesh.py

Length of output: 71



Script:

#!/bin/bash
# Description: Check if `numpy` is used in `tests/test_mesh.py`.

# Test: Search for `numpy` usage. Expect: At least one occurrence.
rg --type py 'np' tests/test_mesh.py

Length of output: 55

samwaseda and others added 29 commits May 18, 2024 08:50
Co-authored-by: Liam Huber <liamhuber@greyhavensolutions.com>
Co-authored-by: Liam Huber <liamhuber@greyhavensolutions.com>
@samwaseda samwaseda closed this Jun 4, 2024
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.

3 participants