astrocats.catalog package

Submodules

astrocats.catalog.catalog module

Overarching catalog object for all open catalogs.

class astrocats.catalog.catalog.Catalog(args={}, log=<logging.Logger object>, git_clone=False)

Bases: object

Object to hold the main catalog dictionary and other catalog globals.

OSC_BIBCODE OSC_NAME OSC_URL ADS_BIB_URL TRAVIS_QUERY_LIMIT COMPRESS_ABOVE_FILESIZE

ADS_BIB_URL = 'http://cdsads.u-strasbg.fr/cgi-bin/nph-abs_connect?db_key=ALL&version=1&bibcode='
COMPRESS_ABOVE_FILESIZE = 90000000.0
OSC_BIBCODE = '2017ApJ...835...64G'
OSC_NAME = 'The Open Supernova Catalog'
OSC_URL = 'https://sne.space'
class PATHS(catalog)

Bases: object

Store and control catalog file-structure information.

Individual catalogs must provide the below file structure. - repos.json - tasks.json

catalog : astrocats.catalog.catalog.Catalog (sub)class object catalog_dir : str tasks_dir : str PATH_BASE : str PATH_INPUT : str PATH_OUTPUT : str REPOS_LIST : str TASK_LIST : str repos_dict : dict

Dictionary of ‘repo-types: repo-lists’ key-value pairs. Loaded from REPOS_LIST file.

get_all_repo_folders : get a list of paths for all data repositories get_repo_boneyard : get the path of the boneyard repository get_repo_input_folders : get the paths of all input data repositories get_repo_output_file_list : get the paths of all files in output repos get_repo_output_folders : get the paths of all input data repositories

get_all_repo_folders(boneyard=True, private=False)

Get the full paths of all data repositories.

get_repo_boneyard()
get_repo_input_folders(private=False)

Get the full paths of the input data repositories.

get_repo_output_file_list(normal=True, bones=True)

Get a list of all existing output files.

These are the files deleted in the delete_old_entry_files task.

get_repo_output_folders(bones=True)

Get the full paths of the output data repositories.

class SCHEMA
HASH = ''
URL = ''
TRAVIS_QUERY_LIMIT = 10
add_entry(name, load=True, delete=True)

Find an existing entry in, or add a new one to, the entries dict.

FIX: rename to create_entry???

entries : OrderedDict of Entry objects newname : str

Name of matching entry found in entries, or new entry added to entries
clean_entry_name(name)

Template method to clean/sanitize an entry name before setting it.

Should be overridden appropriately in subclassed Catalog objects.

copy_entry_to_entry(fromentry, destentry, check_for_dupes=True, compare_to_existing=True)

Used by merge_duplicates

copy_to_entry_in_catalog(fromname, destname)
count()
delete_old_entry_files()
download_url(url, timeout, fail=False, post=None, verify=True)

Download text from the given url.

Returns None on failure.

self url : str

URL web address to download.
timeout : int
Duration after which URL request should terminate.
fail : bool
If True, then an error will be raised on failure. If False, then ‘None’ is returned on failure.
post : dict
List of arguments to post to URL when requesting it.
verify : bool
Whether to check for valid SSL cert when downloading
url_txt : str or None
On success the text of the url is returned. On failure None is returned.
entry_exists(name)
entry_filename(entry)
find_entry_name_of_alias(alias)

Return the first entry name with the given ‘alias’ included in its list of aliases.

name of matching entry (str) or ‘None’ if no matches

get_current_task_repo()

Get the data repository corresponding to the currently active task.

get_current_task_str()

Get a string describing the current task the catalog is working on.

get_preferred_name(name)
import_data()

Run all of the import tasks.

This is executed by the ‘scripts.main.py’ when the module is run as an executable. This can also be run as a method, in which case default arguments are loaded, but can be overriden using **kwargs.

journal_entries(clear=True, gz=False, bury=False, write_stubs=False, final=False)

Write all entries in entries to files, and clear. Depending on arguments and tasks.

Iterates over all elements of entries, saving (possibly ‘burying’) and deleting. - If clear == True, then each element of entries is deleted,

and a stubs entry is added
load_cached_url(url, filepath, timeout=120, write=True, failhard=False, jsonsort='')
load_entry_from_name(name, delete=True, merge=True)
load_stubs(log_mem=False)

Load all events in their stub (name, alias, etc only) form.

Used in update mode.

load_task_list()

Load the list of tasks in this catalog’s ‘input/tasks.json’ file.

A Task object is created for each entry, with the parameters filled in. These are placed in an OrderedDict, sorted by the priority parameter, with positive values and then negative values,

e.g. [0, 2, 10, -10, -1].
load_url(url, fname, repo=None, timeout=120, post=None, fail=False, write=True, json_sort=None, cache_only=False, archived_mode=None, archived_task=None, update_mode=None, verify=False)

Load the given URL, or a cached-version.

Load page from url or cached file, depending on the current settings. ‘archived’ mode applies when args.archived is true (from –archived CL argument), and when this task has Task.archived also set to True.

‘archived’ mode:
  • Try to load from cached file.
  • If cache does not exist, try to load from web.
  • If neither works, raise an error if fail == True, otherwise return None
non-‘archived’ mode:
  • Try to load from url, save to cache file.
  • If url fails, try to load existing cache file.
  • If neither works, raise an error if fail == True, otherwise return None
‘update’ mode:
  • In update mode, try to compare URL to cached file.
  • If URL fails, return None (cannot update)
  • If URL data matches cached data, return None (dont need to update)
  • If URL is different from data, return url data (proceed with update)

self url : str

URL to download.
fname : str
Filename to which to save/load cached file. Inludes suffix. NOTE: in general, this should be the source’s BIBCODE.
repo : str or None
The full path of the data-repository the cached file should be saved/loaded from. If ‘None’, then the current task is used to determine the repo.
timeout : int
Time (in seconds) after which a URL query should exit.
post : dict
List of arguments to post to URL when requesting it.
archived : bool
Load a previously archived version of the file.
fail : bool
If the file/url cannot be loaded, raise an error.
write : bool
Save a new copy of the cached file.
json_sort : str or None
If data is being saved to a json file, sort first by this str.
quiet : bool
Whether to emit error messages upon being unable to find files.
verify : bool
Whether to check for valid SSL cert when downloading
merge_duplicates()

Merge and remove duplicate entries.

Compares each entry (‘name’) in stubs to all later entries to check for duplicates in name or alias. If a duplicate is found, they are merged and written to file.

new_entry(name, load=True, delete=True, loadifempty=True, srcname='', reference='', url='', bibcode='', arxivid='', secondary=False, private=False, acknowledgment='')
sanitize()
save_caches()
set_preferred_names()

Choose between each entries given name and its possible aliases for the best one.

should_bury(name)

astrocats.catalog.catdict module

Class defitions for CatDict and CatDictError, data storage classes.

class astrocats.catalog.catdict.CatDict(parent, key=None, **kwargs)

Bases: collections.OrderedDict

General data storage super-class used throughout catalogs.

In general, CatDict subclasses are used to manage/store data which ends up in the lowest-level dictionaries saved to output json files. For example, and individual Source or Photometry entry.

These attributes should be overridden in subclasses as needed: _KEYS : KeyCollection object

Contains the Key strings and associated specifications which makeup the keys for data in this object. For example: PHOTOMETRY for the Photometry CatDict subclass.
_ALLOW_UNKNOWN_KEYS : bool

Whether data with keys not in the _KEYS object are allowed. ‘True’: additional keyword arguments passed to the constructor are

add without validation or sanitization.
‘False’: keyword arguments passed to the constructor which are not in
ENTRY will produce errors.
_REQ_KEY_SETS : list of lists
Which elements of the associated _KEYS are required for each instance of this class. The structure of this variable is a list of lists, where each inner list contains a set of ‘Key’s, at least one of which are required for validity. For example, if _REQ_KEY_SETS = [[_KEYS.ONE, _KEYS.TWO], [_KEYS.THREE]] then either _KEYS.ONE or _KEYS.TWO is required, and _KEYS.THREE if also required.
  • Invalid data and Errors If, for any reason, the CatDict being constructed looks invalid in a not unexpected way (e.g. required arguments are missing), then a CatDictError exception should be raised. The method in the parent class (e.g. Supernova) which tries to construct the CatDict (e.g. add_photometry) should catch those errors specifically and deal with them appropriately.
append_sources_from(other)

Merge the source alias lists of two CatDicts.

is_duplicate_of(other)
pretty()
sort_func(key)
exception astrocats.catalog.catdict.CatDictError(*args, **kwargs)

Bases: exceptions.Exception

Special Error class for non-fatal errors raised in CatDict.

astrocats.catalog.entry module

Definitions related to the Entry class for catalog entries.

class astrocats.catalog.entry.ENTRY

Bases: astrocats.catalog.key.KeyCollection

General CatDict keys which should be relevant for all catalogs.

ALIAS = 'alias'
AV_CIRCUM = 'avcircum'
COMOVING_DIST = 'comovingdist'
DEC = 'dec'
DISCOVERER = 'discoverer'
DISCOVER_DATE = 'discoverdate'
DISTINCT_FROM = 'distinctfrom'
EBV = 'ebv'
ERRORS = 'errors'
HOST = 'host'
HOST_COMOVING_DIST = 'hostcomovingdist'
HOST_DEC = 'hostdec'
HOST_LUM_DIST = 'hostlumdist'
HOST_OFFSET_ANG = 'hostoffsetang'
HOST_OFFSET_DIST = 'hostoffsetdist'
HOST_RA = 'hostra'
HOST_REDSHIFT = 'hostredshift'
HOST_VELOCITY = 'hostvelocity'
LUM_DIST = 'lumdist'
MAX_ABS_MAG = 'maxabsmag'
MAX_APP_MAG = 'maxappmag'
MAX_BAND = 'maxband'
MAX_DATE = 'maxdate'
MODELS = 'models'
NAME = 'name'
PHOTOMETRY = 'photometry'
RA = 'ra'
REDSHIFT = 'redshift'
SCHEMA = 'schema'
SOURCES = 'sources'
SPECTRA = 'spectra'
VELOCITY = 'velocity'
class astrocats.catalog.entry.Entry(catalog=None, name=None, stub=False)

Bases: collections.OrderedDict

Class representing an individual element of each Catalog.

For example, a single supernova in the supernova catalog, this object handles and manages the addition of data for this Entry, using different CatDict instances (e.g. Photometry).

  • Stubs: a stub is the most minimal entry, containing an entry’s ‘name’ and possible aliases. These instances are used to represent entries which are known to exist (e.g. have already been saved) for cross referencing and duplicate removal. + The Entry.get_stub method returns the ‘stub’ corresponding to the

    Entry instance. i.e. it returns a new object with only the name and aliases copied over.

catalog : astrocats.catalog.catalog.Catalog object
Pointer to the parent catalog object of which this entry is a member.
filename : str or ‘None’
If this entry is loaded from a file, its (full path and) filename.
_log : logging.Logger object
Pointer to the logger from the parent catalog.
_stub : bool
Whether this instance represents a ‘stub’ (see above).
_KEYS : astrocats.catalog.key.KeyCollection object
The associated object which contains the different dictionary keys used in this type (e.g. Supernova) entry.
add_alias(alias, source, clean=True)

Add an alias, optionally ‘cleaning’ the alias string.

Calls the parent catalog method clean_entry_name - to apply the same name-cleaning as is applied to entry names themselves.

alias : str
The stored version of the alias (cleaned or not).
add_error(value, **kwargs)

Add an Error instance to this entry.

add_model(allow_alias=False, **kwargs)

Add a Model instance to this entry.

add_photometry(compare_to_existing=True, **kwargs)

Add a Photometry instance to this entry.

add_quantity(quantities, value, source, check_for_dupes=True, compare_to_existing=True, **kwargs)

Add an Quantity instance to this entry.

add_self_source()

Add a source that refers to the catalog itself.

For now this points to the Open Supernova Catalog by default.

add_source(allow_alias=False, **kwargs)

Add a Source instance to this entry.

add_spectrum(compare_to_existing=True, **kwargs)

Add a Spectrum instance to this entry.

check()

Check that the entry has the required fields.

clean_internal(data=None)

Clean input from ‘internal’, human added data.

This is used in the ‘Entry.init_from_file’ method.

extra_aliases()

Return aliases considered when merging duplicates.

get_aliases(includename=True)

Retrieve the aliases of this object as a list of strings.

includename : bool
Include the ‘name’ parameter in the list of aliases.
get_entry_text(fname)

Retrieve the raw text from a file.

classmethod get_filename(name)

Convert from an Entry name into an appropriate filename.

get_hash(keys=[])

Return a unique hash associated with the listed keys.

get_source_by_alias(alias)

Given an alias, find the corresponding source in this entry.

If the given alias doesn’t exist (e.g. there are no sources), then a ValueError is raised.

alias : str
The str-integer (e.g. ‘8’) of the target source.
source : astrocats.catalog.source.Source object
The source object corresponding to the passed alias.
get_stub()

Get a new Entry which contains the ‘stub’ of this one.

The ‘stub’ is only the name and aliases.

To convert a normal entry into a stub (for example), overwrite the entry in place, i.e. >>> entries[name] = entries[name].get_stub()

stub : astrocats.catalog.entry.Entry subclass object
The type of the returned object is this instance’s type.
classmethod init_from_file(catalog, name=None, path=None, clean=False, merge=True, pop_schema=True, ignore_keys=[], compare_to_existing=True, try_gzip=False, filter_on={})

Construct a new Entry instance from an input file.

The input file can be given explicitly by path, or a path will be constructed appropriately if possible.

catalog : astrocats.catalog.catalog.Catalog instance
The parent catalog object of which this entry belongs.
name : str or ‘None’
The name of this entry, e.g. SN1987A for a Supernova entry. If no path is given, a path is constructed by trying to find a file in one of the ‘output’ repositories with this name. note: either name or path must be provided.
path : str or ‘None’
The absolutely path of the input file. note: either name or path must be provided.
clean : bool
Whether special sanitization processing should be done on the input data. This is mostly for input files from the ‘internal’ repositories.
is_erroneous(field, sources)

Check if attribute has been marked as being erroneous.

is_private(key, sources)

Check if attribute is private.

merge_dupes()

Merge two entries that correspond to the same entry.

name()

Return own name.

num_models()

Return the current number of models stored in this instance.

len : int
The integer number of existing models.
num_sources()

Return the current number of sources stored in this instance.

len : int
The integer number of existing sources.
priority_prefixes()

Return prefixes to given priority when merging duplicate entries.

sanitize()

Sanitize the data (sort it, etc.) before writing it to disk.

Template method that can be overridden in each catalog’s subclassed Entry object.

save(bury=False, final=False)

Write entry to JSON file in the proper location.

bury : bool

final : bool
If this is the ‘final’ save, perform additional sanitization and cleaning operations.
set_preferred_name()

Set a preferred name for the entry.

sort_func(key)

Used to sort keys when writing Entry to JSON format.

Should be supplemented/overridden by inheriting classes.

astrocats.catalog.key module

class astrocats.catalog.key.KEY_TYPES

Bases: astrocats.catalog.key.KeyCollection

ANY = None
BOOL = 'bool'
DICT = 'dict'
LIST = 'list'
NUMERIC = 'numeric'
STRING = 'string'
TIME = 'time'
class astrocats.catalog.key.Key(name, type=None, no_source=False, listable=False, compare=True, priority=0, kind_preference=[], replace_better=False, **kwargs)

Bases: str

Class to act as a ‘key’ (with metadata) to a CatDict dictionary.

Used in KeyCollection subclasses, for example PHOTOMETRY. The most basic function is to contain the str ‘key’ for a CatDict (or other) dictionary, but can also contain (and manage) additional specifictions and metadata. For example, if a type parameter is specified (from KEY_TYPES), then the builtin check() method will ensure that a value is consistent with that type. Arbitrary additional attributes can also be stored.

name : str
The str used as a key for the corresponding dictionary.
type : str or None (one of KEY_TYPES)
Specification of variable type for the value corresponding to this key. ‘None’ means any type is valid. NOTE: if type == None, then the listable check is disabled. note: if type is not one of KEY_TYPES, a ValueError is raised.
listable : bool
Whether the value corresponding to this key is allowed to be a list. NOTE: this is only enforced if type is not ‘None’.
compare : bool
Whether the value corresponding to this key should be compared to that of other dictionaries when looking for duplicate entries. i.e. is equality of the value corresponding to this key requisite for a different dictionary to be considered a duplicate.
check(val)

Make sure given value is consistent with this Key specification.

NOTE: if type is ‘None’, then listable also is not checked.

pretty()

Return a ‘pretty’ string representation of this Key.

note: do not override the builtin __str__ or __repr__ methods!

class astrocats.catalog.key.KeyCollection

Bases: object

General container class with methods to list attribute names and values.

Used mostly by different CatDict subclasses to contain the ‘keys’ to their internal dictionaries.

classmethod compare_vals(sort=True)

Return this class’s attribute values (those not stating with ‘_’), but only for attributes with compare set to True.

_compare_vals : list of objects
List of values of internal attributes to use when comparing CatDict objects. Order sorted by Key priority, followed by alphabetical.
classmethod get_key_by_name(name)
classmethod keys()

Return this class’s attribute names (those not stating with ‘_’).

Also retrieves the attributes from base classes, e.g. For: ENTRY(KeyCollection), ENTRY.keys() gives just the

attributes of ENTRY (KeyCollection has no keys).
For: SUPERNOVA(ENTRY), SUPERNOVA.keys() gives both the
attributes of SUPERNOVAE itself, and of ENTRY.
_keys : list of str
List of names of internal attributes. Order is effectiely random.
classmethod vals()

Return this class’s attribute values (those not stating with ‘_’).

_vals : list of objects
List of values of internal attributes. Order is effectiely random.

astrocats.catalog.photometry module

Class for representing photometric data.

class astrocats.catalog.photometry.PHOTOMETRY

Bases: astrocats.catalog.key.KeyCollection

Keys for the Photometry class.

AIRMASS = 'airmass'
BAND = 'band'
BAND_SET = 'bandset'
COUNT_RATE = 'countrate'
DESCRIPTION = 'description'
ENERGY = 'energy'
EXPOSURE_TIME = 'exposuretime'
EXTRACTION_RADIUS = 'extractionradius'
E_COUNT_RATE = 'e_countrate'
E_FLUX = 'e_flux'
E_FLUX_DENSITY = 'e_fluxdensity'
E_LOWER_COUNT_RATE = 'e_lower_countrate'
E_LOWER_FLUX = 'e_lower_flux'
E_LOWER_FLUX_DENSITY = 'e_lower_fluxdensity'
E_LOWER_LUMINOSITY = 'e_lower_luminosity'
E_LOWER_MAGNITUDE = 'e_lower_magnitude'
E_LOWER_TIME = 'e_lower_time'
E_LOWER_UNABSORBED_FLUX = 'e_lower_unabsorbedflux'
E_LUMINOSITY = 'e_luminosity'
E_MAGNITUDE = 'e_magnitude'
E_TIME = 'e_time'
E_UNABSORBED_FLUX = 'e_unabsorbedflux'
E_UPPER_COUNT_RATE = 'e_upper_countrate'
E_UPPER_FLUX = 'e_upper_flux'
E_UPPER_FLUX_DENSITY = 'e_upper_fluxdensity'
E_UPPER_LUMINOSITY = 'e_upper_luminosity'
E_UPPER_MAGNITUDE = 'e_upper_magnitude'
E_UPPER_TIME = 'e_upper_time'
E_UPPER_UNABSORBED_FLUX = 'e_upper_unabsorbedflux'
FLUX = 'flux'
FLUX_DENSITY = 'fluxdensity'
FREQUENCY = 'frequency'
HOST = 'host'
HOST_NH_CORR = 'hostnhcorr'
INCLUDES_HOST = 'includeshost'
INSTRUMENT = 'instrument'
KCORRECTED = 'kcorrected'
LOWER_LIMIT = 'lowerlimit'
LUMINOSITY = 'luminosity'
MAGNITUDE = 'magnitude'
MCORRECTED = 'mcorrected'
MODE = 'mode'
MODEL = 'model'
NHMW = 'nhmw'
OBSERVATORY = 'observatory'
OBSERVER = 'observer'
OFF_AXIS_ANGLE = 'offaxisangle'
PHOTON_INDEX = 'photonindex'
REALIZATION = 'realization'
REST_FRAME = 'restframe'
SCORRECTED = 'scorrected'
SIMULATED = 'simulated'
SOURCE = 'source'
SURVEY = 'survey'
SYNTHETIC = 'synthetic'
SYSTEM = 'system'
TELESCOPE = 'telescope'
TIME = 'time'
UNABSORBED_FLUX = 'unabsorbedflux'
UPPER_LIMIT = 'upperlimit'
UPPER_LIMIT_SIGMA = 'upperlimitsigma'
U_COUNT_RATE = 'u_countrate'
U_ENERGY = 'u_energy'
U_EXPOSURE_TIME = 'u_exposuretime'
U_EXTRACTION_RADIUS = 'u_extractionradius'
U_FLUX = 'u_flux'
U_FLUX_DENSITY = 'u_fluxdensity'
U_FREQUENCY = 'u_frequency'
U_LUMINOSITY = 'u_luminosity'
U_OFF_AXIS_ANGLE = 'u_offaxisangle'
U_TIME = 'u_time'
U_WAVELENGTH = 'u_wavelength'
WAVELENGTH = 'wavelength'
ZERO_POINT = 'zeropoint'
class astrocats.catalog.photometry.Photometry(parent, **kwargs)

Bases: astrocats.catalog.catdict.CatDict

Container for a single photometric point with associated metadata.

Source citation required. Photometry can be given as [magnitude, flux, flux-density, counts, luminosity].

sort_func(key)

Specify order for attributes.

astrocats.catalog.photometry.bandaliasf(code)
astrocats.catalog.photometry.bandcolorf(code)
astrocats.catalog.photometry.bandmetaf(band, field)
astrocats.catalog.photometry.bandrepf(code)
astrocats.catalog.photometry.bandshortaliasf(code)
astrocats.catalog.photometry.bandwavef(code)
astrocats.catalog.photometry.get_ul_mag(ec, zp=30.0, sig=5.0)
astrocats.catalog.photometry.instrumentrepf(code)
astrocats.catalog.photometry.radiocolorf(code)
astrocats.catalog.photometry.set_pd_mag_from_counts(photodict, c='', ec='', lec='', uec='', zp=30.0, sig=5.0)

Set photometry dictionary from a counts measurement.

astrocats.catalog.photometry.set_pd_mag_from_flux_density(photodict, fd='', efd='', lefd='', uefd='', sig=5.0)

Set photometry dictionary from a flux density measurement.

fd is assumed to be in microjanskys.

astrocats.catalog.photometry.xraycolorf(code)

astrocats.catalog.quantity module

Class for representing quantities.

class astrocats.catalog.quantity.QUANTITY

Bases: astrocats.catalog.key.KeyCollection

KeyCollection subclass for the the Quantity class.

VALUE : ANY
The actual value being stored.
E_VALUE : NUMERIC
The ‘error’ (uncertainty) associate with the measured value.
E_LOWER_VALUE : NUMERIC
The ‘error’ (uncertainty) in the lower (more negative) direction.
E_UPPER_VALUE : NUMERIC
The ‘error’ (uncertainty) in the upper (more positive) direction.

PROB : NUMERIC UPPER_LIMIT : BOOL

If this value corresponds to a measured upper-limit.
DESCRIPTION : STRING
Verbal description or notes on a quantity.
U_VALUE : STRING
Unit of measurement associated with this value.
U_E_VALUE : STRING
Unit of measurement associated with the error in the value (if different from value).

KIND : STRING SOURCE : STRING

The alias number(s) of the ‘source(s)’ (reference) for this value. NOTE: while source-aliases are integers referring to the actual source-entries, this entry is stored as a single string, where numerous souces are stored as a single, comma-separated string. e.g. Entry[QUANTITY.SOURCE] = '1, 4, 5'.
CORRELATIONS = 'correlations'
DERIVED = 'derived'
DESCRIPTION = 'description'
E_LOWER_VALUE = 'e_lower_value'
E_UPPER_VALUE = 'e_upper_value'
E_VALUE = 'e_value'
KIND = 'kind'
LOWER_LIMIT = 'lowerlimit'
MODEL = 'model'
PROB = 'probability'
REALIZATION = 'realization'
SOURCE = 'source'
UPPER_LIMIT = 'upperlimit'
U_E_VALUE = 'u_e_value'
U_VALUE = 'u_value'
VALUE = 'value'
class astrocats.catalog.quantity.Quantity(parent, **kwargs)

Bases: astrocats.catalog.catdict.CatDict

Class to store a single item of data associated with an Entry.

sort_func(key)

Sorting logic for Quantity objects.

astrocats.catalog.source module

Class for representing sources of data.

class astrocats.catalog.source.SOURCE

Bases: astrocats.catalog.key.KeyCollection

KeyCollection for the Source class.

NAME : STRING BIBCODE : STRING URL : STRING ACKNOWLEDGMENT : STRING REFERENCE : STRING ALIAS : NUMERIC

Numerical alias (shorthand) for this entry. Saved as a string (or list of strings), despite being stored as an integer.
SECONDARY : BOOL
Whether the given source is one which collected data from another, ‘Primary’-source, from which it actually originated
ACKNOWLEDGMENT = 'acknowledgment'
ALIAS = 'alias'
ARXIVID = 'arxivid'
BIBCODE = 'bibcode'
DOI = 'doi'
NAME = 'name'
PRIVATE = 'private'
REFERENCE = 'reference'
SECONDARY = 'secondary'
URL = 'url'
class astrocats.catalog.source.Source(parent, **kwargs)

Bases: astrocats.catalog.catdict.CatDict

Representation for the source/attribution of a data element.

append_sources_from(other)

CatDict.append_sources_from should never be called in Source.

classmethod bibcode_from_url(url)

Given a URL, try to find the ADS bibcode.

Currently: only ads URLs will work, e.g.

code : str or ‘None’
The Bibcode if found, otherwise ‘None’
is_duplicate_of(other)

Check if this Source is a duplicate of another.

Unlike the function in the super class, this method will return True if either name or bibcode is the same.

sort_func(key)

astrocats.catalog.spectrum module

Class for representing spectra.

class astrocats.catalog.spectrum.SPECTRUM

Bases: astrocats.catalog.key.KeyCollection

Collection of attributes for the Spectrum class.

AIRMASS = 'airmass'
DATA = 'data'
DEREDDENED = 'dereddened'
DEREDSHIFTED = 'deredshifted'
ERRORS = 'errors'
EXCLUDE = 'exclude'
E_LOWER_TIME = 'e_lower_time'
E_TIME = 'e_time'
E_UPPER_TIME = 'e_upper_time'
FILENAME = 'filename'
FLUXES = 'fluxes'
HOST = 'host'
INCLUDES_HOST = 'includeshost'
INSTRUMENT = 'instrument'
MODEL = 'model'
OBSERVATORY = 'observatory'
OBSERVER = 'observer'
REALIZATION = 'realization'
REDSHIFT = 'redshift'
REDUCER = 'reducer'
REDUCTION = 'reduction'
SNR = 'snr'
SOURCE = 'source'
SURVEY = 'survey'
TELESCOPE = 'telescope'
TIME = 'time'
U_ERRORS = 'u_errors'
U_FLUXES = 'u_fluxes'
U_TIME = 'u_time'
U_WAVELENGTHS = 'u_wavelengths'
VACUUM_WAVELENGTHS = 'vacuumwavelengths'
WAVELENGTHS = 'wavelengths'
class astrocats.catalog.spectrum.Spectrum(parent, **kwargs)

Bases: astrocats.catalog.catdict.CatDict

Class for storing a single spectrum.

is_duplicate_of(other)

Check if spectrum is duplicate of another.

sort_func(key)

Logic for sorting keys in a Spectrum relative to one another.

astrocats.catalog.task module

Object for each ‘task’ needed to be carried out by the ‘importer’.

class astrocats.catalog.task.Task(**kwargs)

General class for individual catalog operations.

Currently only used in the import methods. Each task instance is loaded with values from the input/tasks.json file.

name : str
Proper name for this task - used when calling it from command-line
nice_name : str or None
Name for pretty printing
update : bool
Whether this task should be performed during update.
archived : bool
Use existing, archived (meta-)data for this task.
active : bool
Whether this task should be performed or not by default.
module : str or None
Module in which to find function for carrying out this task
groups : list of strings
Which task groupings this task belongs to. Allows numerous tasks to be run together.
repo : str or None
Repository in which the input-/meta- data is stored. This is not the final output directory of the entry json file.
function : str
Function to execute when carrying out this task.
priority : int
Order in which tasks should be executed
current_task(args)

Name of current action for progress-bar output.

The specific task string is depends on the configuration via args.

ctask : str
String representation of this task.
load_archive(args)

Whether previously archived data should be loaded.

Module contents

General Catalog Classes and Functions, used and subclassed by each catalog.