matador.query package¶
The query module provides the DBQuery class that implements all database queries, either for individual compositions/formulae, or for matching calculations at the same accuracy to create phase diagrams.
-
class
matador.query.
DBQuery
(client=False, collections=False, subcmd='query', debug=False, quiet=False, mongo_settings=None, **kwargs)[source]¶ Bases:
object
Class that implements queries to MongoDB structure database.
-
cursor
¶ list or cursor of structures matching query.
- Type
list of dict or
pymongo.Cursor
-
args
¶ contains all keyword arguments used to construct the query (see matador query –help) for list.
- Type
-
calc_dict
¶ if performing a matching query (e.g. self.args[‘subcmd’] = ‘hull’), this dictionary contains the parameters used to match to other structures
- Type
-
repo
¶ the pymongo collection that is being queried.
- Type
pymongo.collection.Collection
-
cursor_min_limit
¶ if a query returns more structures than this, do not implicitly convert to a list.
- Type
Parse arguments from matador or API call before calling query.
- Keyword Arguments
client (pm.MongoClient) – the MongoClient to connect to.
collections (dict of pm.collections.Collection) – dictionary of pymongo Collections.
subcmd (str) – either ‘query’ or ‘hull’, ‘voltage’, ‘hulldiff’. These will decide whether calcuation accuracies are matched in the final results.
-
cursor_min_limit
= 1000¶
-
perform_hull_query
()[source]¶ Perform the multiple queries necessary to find possible calculation sets to create a convex hull from.
- Raises
SystemExit – if no structures are found for hull.
-
perform_id_query
()[source]¶ Query the text_id field for the ID provided in the args for a calc_match or hull/voltage query. Use the results of the text_id query to match to other entries that have the same calculation parameters. Sets self.query_dict and self.calc_dict.
- Raises
RuntimeError – if no structures are found.
Alias for private function of the same name.
-
Submodules¶
matador.query.query module¶
This file implements all queries to the database, including parsing user inputs, displaying results and calling other functionality.
-
class
matador.query.query.
DBQuery
(client=False, collections=False, subcmd='query', debug=False, quiet=False, mongo_settings=None, **kwargs)[source]¶ Bases:
object
Class that implements queries to MongoDB structure database.
-
cursor
¶ list or cursor of structures matching query.
- Type
list of dict or
pymongo.Cursor
-
args
¶ contains all keyword arguments used to construct the query (see matador query –help) for list.
- Type
-
calc_dict
¶ if performing a matching query (e.g. self.args[‘subcmd’] = ‘hull’), this dictionary contains the parameters used to match to other structures
- Type
-
repo
¶ the pymongo collection that is being queried.
- Type
pymongo.collection.Collection
-
cursor_min_limit
¶ if a query returns more structures than this, do not implicitly convert to a list.
- Type
Parse arguments from matador or API call before calling query.
- Keyword Arguments
client (pm.MongoClient) – the MongoClient to connect to.
collections (dict of pm.collections.Collection) – dictionary of pymongo Collections.
subcmd (str) – either ‘query’ or ‘hull’, ‘voltage’, ‘hulldiff’. These will decide whether calcuation accuracies are matched in the final results.
-
cursor_min_limit
= 1000¶
-
perform_hull_query
()[source]¶ Perform the multiple queries necessary to find possible calculation sets to create a convex hull from.
- Raises
SystemExit – if no structures are found for hull.
-
perform_id_query
()[source]¶ Query the text_id field for the ID provided in the args for a calc_match or hull/voltage query. Use the results of the text_id query to match to other entries that have the same calculation parameters. Sets self.query_dict and self.calc_dict.
- Raises
RuntimeError – if no structures are found.
Alias for private function of the same name.
-