Skip to content

Commit

Permalink
Update database.py
Browse files Browse the repository at this point in the history
Updated doc string
  • Loading branch information
aakhiltayal authored and matthewcarbone committed Apr 2, 2024
1 parent eb0d0af commit ac025d7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lightshow/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def _get_api_key(api_key):
return api_key

def _get_method(method, mpr):
"""Get all the available search methods; if the given method is not present, the search will be performed using mpr.materials.search"""
methods = [methods for methods in dir(mpr.materials) if methods is not callable and not methods.startswith('_')]

if method is None:
Expand Down Expand Up @@ -148,7 +149,12 @@ def from_materials_project(cls, **kwargs):
api_key : None, optional
API key which can either be provided directly or is read from
the MP_API_KEY environment variable.
method : None, optional, str
Keyword to get different information about materials'
for e.g. 'thermo', 'xas', 'summary' etc. fetch information on
thermodynamic properties, computed XAS data, large amount of amalgated data
about the material, respectively. https://api.materialsproject.org/docs
Returns
-------
Database
Expand All @@ -165,7 +171,7 @@ def from_materials_project(cls, **kwargs):
method = _get_method(kwargs.get("method"), mpr=mpr)
try:
kwargs.pop("method")
else:
except:
pass
if method is not None:
searched = getattr(mpr.materials, method).search(**kwargs)
Expand Down

0 comments on commit ac025d7

Please sign in to comment.