Data
Reference data held locally: journals, affiliations and two controlled vocabularies.
Each dataset is read from the user’s cache if refresh has downloaded it, otherwise from the snapshot packaged with this library (journals and affiliations only). The Unified Astronomy Thesaurus and the planetary nomenclature gazetteer are not packaged: run refresh("uat") or refresh("planetary_features") once to use them.
Nothing is downloaded implicitly. refresh uses a plain HTTP client that never sends the SciX API token, because the sources are third-party hosts. Downloads are checked by the same parser the model uses before they replace the data in use, and are written atomically.
The packaged data files are not covered by this package’s MIT licence: the affiliation files are GPL-3.0. notices returns the details.
The cache directory is $SCIX_CACHE_DIR if set, else $XDG_CACHE_HOME/scixplorer, else ~/Library/Caches/scixplorer on macOS and ~/.cache/scixplorer elsewhere.
scixplorer.data.refresh
Written data.refresh after from scixplorer import data.
refresh(*names, transport=None, timeout=60.0)Download datasets into the cache, replacing the copies in use if the downloads are good.
With no names, every dataset with a public source is refreshed. Each download is parsed by its model before anything is written, and rejected (leaving the data in use untouched) if it does not parse, is empty, or has fewer than half as many records as the data in use. A dataset’s files are replaced together or not at all. One dataset failing does not stop the others: check ok on each result.
Requests carry only a generic User-Agent; the SciX API token is never sent.
Parameters
transport: anhttpxtransport, e.g. for testing or a proxy setup.timeout: seconds allowed for each request.
scixplorer.data.status
Written data.status after from scixplorer import data.
status()Which copy of each dataset is in use, where it is, when it was modified and its size.
scixplorer.data.clear
Written data.clear after from scixplorer import data.
clear(*names)Delete the cached copies of datasets (all if no names); packaged snapshots are kept.
Models then read their packaged snapshot, or raise exceptions.DataNotAvailable if there is none.
scixplorer.data.notices
Written data.notices after from scixplorer import data.
notices()The licence notice for the data files packaged with this library (NOTICE.md).
It says where each file comes from and under which licence; the packaged data is not covered by the package’s MIT licence. The GPL-3.0 text it refers to is the package resource LICENSE-GPL-3.0.txt beside it.
scixplorer.data.cache_dir
Written data.cache_dir after from scixplorer import data.
cache_dir()The directory holding downloaded data. It is created only when something is written.
scixplorer.data.read_text
Written data.read_text after from scixplorer import data.
read_text(dataset, filename)The text of one file of a dataset: the cached copy if every file of the dataset is cached (as load and status decide), else the packaged one.
Raises exceptions.DataNotAvailable if neither exists. The text is not checked; load checks it and falls back if it is bad.
scixplorer.data.RefreshResult
Written data.RefreshResult after from scixplorer import data.
RefreshResult(name, ok, files, message)class
The outcome of refreshing one dataset. files are the cache files written.
scixplorer.data.DatasetStatus
Written data.DatasetStatus after from scixplorer import data.
DatasetStatus(name, source, paths, modified, size)class
Which copy of a dataset is in use.
source is "cache" (downloaded by refresh), "packaged" or "missing". modified (UTC) and size (bytes) cover all the files in paths; they are None when nothing can be inspected. The cached files are not parsed here, so an unreadable cache still shows as "cache" (the models then fall back to the packaged snapshot, with a exceptions.DataWarning).
scixplorer.data.Dataset
Written data.Dataset after from scixplorer import data.
Dataset(name, files, packaged, licence, description)class
A collection of reference data and where it comes from.
files is empty if there is no public source to refresh it from. packaged says whether a snapshot ships with this library. licence is the data’s licence, as notices states it.
scixplorer.data.RemoteFile
Written data.RemoteFile after from scixplorer import data.
RemoteFile(url, filename, convert=None)class
One file of a dataset: where it is published and its name in the cache.
The cached file always has the packaged format. convert, if given, turns the published text into that format.
scixplorer.data.DATASETS
The datasets, by name: a read-only mapping of Dataset.
| Name | Packaged | Licence | Downloaded from |
|---|---|---|---|
journals | yes | No licence stated (ADS bibliographic code list) | https://adsabs.harvard.edu/abs_doc/journals.html |
affiliations | yes | GPL-3.0 (adsabs/CanonicalAffiliations) | https://raw.githubusercontent.com/adsabs/CanonicalAffiliations/master/parent_child.tsv https://raw.githubusercontent.com/adsabs/CanonicalAffiliations/master/country_parent_child.tsv |
uat | no | CC BY-SA 3.0 (American Astronomical Society) | https://raw.githubusercontent.com/astrothesaurus/UAT/master/UAT_list.json |
planetary_features | no | Public domain (USGS Gazetteer of Planetary Nomenclature), via an MIT-licensed adsabs repository | https://raw.githubusercontent.com/adsabs/ADSPlanetaryNamesPipeline/main/docs/Gazetteer_of_Planetary_Nomenclature_Exported_Nov_7_2024.csv |
For model authors
Models use these to read their data; you do not need them to use scixplorer.
scixplorer.data.register
Written data.register after from scixplorer import data.
register(name, parse, reset)Register how a model reads dataset name; models call this when imported.
Parameters
parse: builds the model’s records from aReader; it raises on malformed data.loadandrefreshboth use it.reset: forgets everything the model has cached from the data, so the next query reads it again. Called afterrefreshorclear.
scixplorer.data.load
Written data.load after from scixplorer import data.
load(name, parse)Parse dataset name with parse: the cached copy if usable, else the packaged one.
An unusable cached copy is skipped with a exceptions.DataWarning. Raises exceptions.DataNotAvailable if there is no usable copy and nothing is packaged.