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

Magpie data updates #289

Merged
merged 4 commits into from
Jul 12, 2024
Merged

Magpie data updates #289

merged 4 commits into from
Jul 12, 2024

Conversation

AntObi
Copy link
Collaborator

@AntObi AntObi commented Jul 12, 2024

Pull Request Template

Description

  • Access new properties for the Element class

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

Test Configuration:

  • Python version: 3.10
  • Operating System: macOS

Reviewers

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Summary by CodeRabbit

  • New Features
    • Introduced new attributes to the Element class, including Mendeleev number, atomic weight, melting temperature, and number of valence electrons.
    • Added a function to retrieve element data from the Magpie dataset based on atomic symbols.

Copy link
Contributor

coderabbitai bot commented Jul 12, 2024

Walkthrough

The recent changes introduce new attributes to the Element class in the smact module, such as mendeleev, AtomicWeight, MeltingT, and num_valence. Additionally, a new function lookup_element_magpie_data has been added to smact/data_loader.py for retrieving element data from the Magpie representation. These changes enhance the ability to access and utilise detailed elemental properties within the smact module.

Changes

Files Change Summary
smact/init.py Introduced new attributes to the Element class: mendeleev, AtomicWeight, MeltingT, and num_valence, enhancing the available elemental properties.
smact/data_loader.py Added lookup_element_magpie_data function to fetch element data from Magpie representation and import pandas as pd for handling data.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Element
    participant DataLoader
    participant MagpieCSV
    
    User ->> Element: Create Element instance
    Element ->> DataLoader: Call lookup_element_magpie_data(symbol)
    DataLoader ->> MagpieCSV: Load CSV data
    MagpieCSV -->> DataLoader: Return element data
    DataLoader -->> Element: Populate attributes with data
    Element -->> User: Return Element instance with attributes
Loading

Poem

In the realm of code so bright,
Elements gain new attributes' light,
With mendeleev, weight so clear,
Melting points and valence near.
Data Loader's magic spell,
From Magpie's depths, new tales to tell.
🐇✨ Code evolves, a wondrous sight!


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.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @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.

Copy link

codecov bot commented Jul 12, 2024

Codecov Report

Attention: Patch coverage is 96.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 74.90%. Comparing base (7d89173) to head (b563be1).
Report is 65 commits behind head on develop.

Files with missing lines Patch % Lines
smact/data_loader.py 93.33% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #289      +/-   ##
===========================================
+ Coverage    74.65%   74.90%   +0.25%     
===========================================
  Files           24       24              
  Lines         2099     2124      +25     
===========================================
+ Hits          1567     1591      +24     
- Misses         532      533       +1     

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

Copy link
Contributor

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7d89173 and 0f3355f.

Files ignored due to path filters (1)
  • smact/data/magpie.csv is excluded by !**/*.csv
Files selected for processing (2)
  • smact/init.py (3 hunks)
  • smact/data_loader.py (2 hunks)
Additional context used
Ruff
smact/data_loader.py

868-868: Loop control variable index not used within loop body

Rename unused index to _index

(B007)

GitHub Check: codecov/patch
smact/data_loader.py

[warning] 901-901: smact/data_loader.py#L901
Added line #L901 was not covered by tests

Additional comments not posted (8)
smact/__init__.py (6)

76-76: Attribute mendeleev correctly added.

The attribute mendeleev has been correctly integrated and initialized in the Element class.


78-78: Attribute AtomicWeight correctly added.

The attribute AtomicWeight has been correctly integrated and initialized in the Element class.


80-80: Attribute MeltingT correctly added.

The attribute MeltingT has been correctly integrated and initialized in the Element class.


82-82: Attribute num_valence correctly added.

The attribute num_valence has been correctly integrated and initialized in the Element class.


153-163: New attributes correctly initialized in __init__ method.

The new attributes mendeleev, AtomicWeight, MeltingT, and num_valence are correctly initialized using magpie_data. The fallback to None if magpie_data is not available is appropriate.


199-202: Attributes correctly set in __init__ method.

The new attributes mendeleev, AtomicWeight, MeltingT, and num_valence are correctly set in the __init__ method. Ensure that there are corresponding tests for these attributes.

smact/data_loader.py (2)

16-16: pandas import correctly added.

The pandas library is correctly imported to facilitate data handling in the new function lookup_element_magpie_data.


832-899: Function lookup_element_magpie_data correctly implemented.

The function lookup_element_magpie_data effectively retrieves element data from a CSV file and returns a dictionary containing various properties for the specified atomic symbol. The use of pandas is appropriate for data handling.

Tools
Ruff

868-868: Loop control variable index not used within loop body

Rename unused index to _index

(B007)

smact/data_loader.py Outdated Show resolved Hide resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0f3355f and b563be1.

Files selected for processing (1)
  • smact/data_loader.py (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • smact/data_loader.py

@AntObi AntObi merged commit 22bd955 into WMD-group:develop Jul 12, 2024
18 checks passed
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.

1 participant