GWLandscape class¶
The GWLandscape class is a link to the GWLandscape service, being primarily used as a means by which to manipulate publications, models and datasets.
- class gwlandscape_python.gwlandscape.GWLandscape(token='', auth_endpoint='https://gwlandscape.org.au/auth/graphql', endpoint='https://gwlandscape.org.au/compas/graphql')¶
Bases:
objectGWLandscape class provides an API for interacting with COMPAS, allowing jobs to be submitted and acquired.
- Parameters
- client¶
Handles a lot of the underlying logic surrounding the queries
- Type
GWDC
- create_dataset(publication, model, datafile)¶
Creates a new dataset object with the specified publication and model. Datasets must contain exactly one hdf5 file, and should either be a hdf5 file or a tarfile containing the hdf5 file.
- Parameters
publication (Publication) – The Publication this dataset is for
model (Model) – The model this dataset is for
datafile (str or Path) – Local path to the COMPAS h5 file or tarfile
- Returns
Created Dataset
- Return type
- create_keyword(tag)¶
Creates a new keyword object with the specified tag.
- create_model(name, summary=None, description=None)¶
Creates a new model object with the specified parameters.
- create_publication(author, title, arxiv_id, published=None, year=None, journal=None, journal_doi=None, dataset_doi=None, description=None, public=None, download_link=None, keywords=None)¶
Creates a new keyword object with the specified tag.
- Parameters
author (str) – The author of the publication
title (str) – The title of the publication
arxiv_id (str) – The arxiv id of the publication
published (bool, optional) – If the publication was published in a journal/arXiv, by default None
year (int, optional) – The year of the publication, by default None
journal (str, optional) – The name of the journal, by default None
journal_doi (str, optional) – The DOI of the publication, by default None
dataset_doi (str, optional) – The DOI of the dataset, by default None
description (str, optional) – A description of the publication, by default None
public (bool, optional) – If the publication has been made public (visible to the public), by default None
download_link (str, optional) – A link to download the publication/dataset, by default None
keywords (list, optional) – A list of str or
Keywordobjects for the publication, by default None
- Returns
Created Publication
- Return type
- get_datasets(publication=None, model=None, _id=None)¶
Fetch all dataset models with publication/model matching the provided parameters. Also allows fetching models by the provided ID
At most, only one of (publication, model) or _id must be provided. If no parameter is provided, all dataset models are returned.
- Parameters
publication (Publication, optional) – Match all dataset models with this publication, by default None
model (Model, optional) – Match all dataset models with this publication, by default None
_id (str, optional) – Match model by the provided ID, by default None
- Returns
A list of Dataset instances
- Return type
- get_files_by_reference(file_references)¶
Obtains file data when provided a
FileReferenceList- Parameters
file_references (FileReferenceList) – Contains the
FileReferenceobjects for which to download the contents- Returns
List of tuples containing the file path and file contents as a byte string
- Return type
- get_keywords(exact=None, contains=None, _id=None)¶
Fetch all keywords matching exactly the provided parameter, any keywords with tags containing the term in the contains parameter, or the keyword with the specified id.
At most, only one of exact, contains, or _id must be provided. If neither the exact, contains, or _id parameter is supplied, then all keywords are returned.
- Parameters
- Returns
A list of
Keywordinstances- Return type
- get_models(name=None, summary=None, description=None, _id=None)¶
Fetch all models with name/summary/description containing the values specified. Also allows fetching models by the provided ID
At most, only one of (name, summary, description) or _id must be provided. If no parameter is provided, all models are returned.
- Parameters
name (str, optional) – Match model name containing this value (case-insensitive), by default None
summary (str, optional) – Match model summary contains this value (case-insensitive), by default None
description (str, optional) – Match model description contains this value (case-insensitive), by default None
_id (str, optional) – Match model by the provided ID, by default None
- Returns
A list of
Modelinstances- Return type
- get_publications(author=None, title=None, _id=None)¶
Fetch all publications with author/title/arxiv id containing the values specified. Also allows fetching publication by the provided ID
At most, only one of (author, title) or _id must be provided. If no parameter is provided, all publications are returned.
- Parameters
- Returns
A list of
Publicationinstances- Return type
- save_files_by_reference(file_references, root_path)¶
Save files when provided a
FileReferenceListand a root path- Parameters
file_references (FileReferenceList) – Contains the
FileReferenceobjects for which to save the associated filesroot_path (str or Path) – Directory into which to save the files
preserve_directory_structure (bool, optional) – Remove any directory structure for the downloaded files, by default True