Source Documentation#

otter.Otter#

class otter.Otter(url: str = 'https://otter.idies.jhu.edu/api', username: str = 'user-guest', password: str = 'test', gen_summary: bool = False, datadir: str = None, debug: bool = False, **kwargs)#

This is the primary class for users to access the otter backend database

Parameters:
  • url (str) – The url where the database api endpoints are located

  • username (str) – The username to log into the database with

  • password (str) – The password to log into the database with

  • gen_summary (bool) – Generate a local summary table, this should generally be left as False!

  • datadir (str) – Path to the data directory with the otter data. If not provided will default to a “.otter” directory in the CWD where you call this class from.

  • debug (bool) – If we should just debug and not do anything serious.

Returns:

An Otter object that is connected to the otter database

Performs a cone search of the catalog over the given coords and radius.

Parameters:
  • coords (SkyCoord) – An astropy SkyCoord object with coordinates to match to

  • radius (float) – The radius of the cone in arcseconds, default is 0.05”

  • raw (bool) – If False (the default) return an astropy table of the metadata for matching objects. Otherwise, return the raw json dicts

Returns:

The metadata for the transients in coords+radius. Will return an astropy Table if raw is False, otherwise a dict.

static from_csvs(metafile: str, photfile: str = None, local_outpath: str | None = '/home/docs/checkouts/readthedocs.org/user_builds/astro-otter/checkouts/latest/docs/private-data', db: Otter = None) Otter#

Converts private metadata and photometry csvs to an Otter object stored locally so you don’t need to worry about accidentally uploading them to the real Otter database.

Parameters:
  • metafile (str) – String filepath or string io csv object of the csv metadata

  • photfile (str) – String filepath or string io csv object of the csv photometry

  • local_outpath (str) – The outpath to write the OTTER json files to

  • db (Otter) – An Otter instance to add the local_outpath to for querying. This keyword can be useful if you have special permission for the otter database and want to upload your private data

Returns:

An Otter object where the json files are stored locally

generate_summary_table(save=False) DataFrame#

Generate a summary table for the JSON files in self.DATADIR

Parameters:

save (bool) – if True, save the summary file to “summary.csv” in self.DATADIR. Default is False and is just returned.

Returns:

pandas.DataFrame of the summary meta information of the transients

get_meta(**kwargs) Table#

Get the metadata of the objects matching the arguments

Parameters:

**kwargs – Arguments to pass to Otter.query(). See that documentation with help(otter.Otter.query).

Returns:

The metadata for the transients that match the arguments. Will be an astropy Table by default, if raw=True will be a dictionary.

get_phot(flux_unit='mag(AB)', date_unit='MJD', return_type='astropy', obs_type=None, keep_raw=False, wave_unit='nm', freq_unit='GHz', deduplicate=None, clean_photometry_kwargs={}, **kwargs) Table#

Get the photometry of the objects matching the arguments. This will do the unit conversion for you!

Parameters:
  • flux_unit (astropy.unit.Unit) – Either a valid string to convert or an astropy.unit.Unit, this can be either flux, flux density, or magnitude unit. This supports any base units supported by synphot (https://synphot.readthedocs.io/en/latest/synphot/units.html#flux-units).

  • date_unit (astropy.unit.Unit) – Either a valid string to convert to a date or an astropy.unit.Unit. For supported formats see https://docs.astropy.org/en/stable/time/index.html#time-format

  • return_type (str) – Either ‘astropy’ or ‘pandas’. If astropy, returns an astropy Table. If pandas, returns a pandas DataFrame. Default is ‘astropy’.

  • obs_type (str) – Either ‘radio’, ‘uvoir’, or ‘xray’. Will only return that type of photometry if not None. Default is None and will return any type of photometry.

  • keep_raw (bool) – If True, keep the raw flux/date/freq/wave associated with the dataset. Else, just keep the converted data. Default is False.

  • wave_unit (str) – The astropy wavelength unit to return with. Must have base units of length.

  • freq_unit (str) – The astropy frequency unit to return with. Must have base units of 1/time.

  • deduplicate (Callable|None|False) – if we should deduplicate the dataset using the deduplicate Callable. Set to False if you don’t want this to happen. None defaults to Transient.deduplicate_photometry

  • clean_photometry_kwargs (dict) – Other keyword arguments to be passed to Transient.clean_photometry

  • **kwargs

    Arguments to pass to Otter.query(). Can be:

    names (list[str]): A list of names to get the metadata for
    coords (SkyCoord): An astropy SkyCoord object with coordinates
                       to match to
    radius (float): The radius in arcseconds for a cone search,
                    default is 0.05"
    minZ (float): The minimum redshift to search for
    maxZ (float): The maximum redshift to search for
    refs (list[str]): A list of ads bibcodes to match to. Will only
                      return metadata for transients that have this
                      as a reference.
    hasSpec (bool): if True, only return events that have spectra.
    

Returns:

The photometry for the requested transients that match the arguments. Will be an astropy Table sorted by transient default name.

Raises:
load_file(filename: str) dict#

Loads an otter JSON file

Parameters:

filename (str) – The path to the OTTER JSON file to load

Returns:

dictionary with the otter JSON file contents

query(names: list[str] = None, coords: SkyCoord = None, radius: float = 5, minz: float = None, maxz: float = None, mindec: float = -90, maxdec: float = 90, refs: list[str] = None, hasphot: bool = False, has_radio_phot: bool = False, has_uvoir_phot: bool = False, has_xray_phot: bool = False, hasspec: bool = False, spec_classed: bool = False, unambiguous: bool = False, classification: str = None, class_confidence_threshold: float = 0, has_det: bool = False, wave_det: str = None, query_private=False, **kwargs) dict#

Searches the arango database table and reads relevant JSON files

WARNING! This does not do any conversions for you! This is how it differs from the get_meta method. Users should prefer to use get_meta, and get_phot independently because it is a better workflow and can return the data in an astropy table with everything in the same units.

Parameters:
  • names (list[str]) – A list of names to get the metadata for

  • coords (SkyCoord) – An astropy SkyCoord object with coordinates to match to

  • radius (float) – The radius in arcseconds for a cone search, default is 0.05”

  • minz (float) – The minimum redshift to search for

  • maxz (float) – The maximum redshift to search for

  • mindec (float) – The minimum declination in degrees

  • maxdec (float) – The maximum declination in degrees

  • refs (list[str]) – A list of ads bibcodes to match to. Will only return metadata for transients that have this as a reference.

  • hasphot (bool) – if True, only returns transients which have photometry.

  • has_radio_phot (bool) – if True, only returns transients with radio phot.

  • has_uvoir_phot (bool) – if True, only returns transients with uvoir phot.

  • has_xray_phot (bool) – if True, only returns transients with X-ray phot.

  • hasspec (bool) – NOT IMPLEMENTED! Will return False for all targets!

  • spec_classed (bool) – If True, only returns transients that have been specotroscopically classified/confirmed

  • unambiguous (bool) – If True, only returns transients that only have a single published classification in OTTER. If classifications disagree for a transient, it will be filtered out.

  • classification (str) – A classification string to search for

  • class_confidence_threshold (float) – classification confidence cutoff. Default is 0. Any classifications with a confiedence less than this value will be ignored. In general, (1) C = 0 means this classification is unverified, (2) C = 1 means this classification is based only on photometry, (3) C = 2 means this classification is based on a TNS (not peer-reviewed) spectrum, (4) C >= 3 means this classification is based on at least one peer-reviewed optical spectrum. Setting this flag to 3 should produce the most pure sample, but might miss some events that are very confidently classified based on photometry (e.g., X-ray observations).

  • has_det (bool) – This can be set to true to only search for transients that have a detection in their photometry. It can be used in conjunction with e.g., has_radio_phot=True to search for transients that have a radio detection. Default is False.

  • wave_det (str) – Set this to the wavelength regime that you want to check for detections in. Either “uvoir”, “radio”, “xray”. Default is None, which doesn’t filter on the wavelength regime before checking for detections.

  • query_private (bool) – Set to True if you would like to also query the dataset located at whatever you set datadir to

  • **kwargs – Other keyword arguments passed to self.AQLQuery. Note that the default batch size it 5000 transients, if your query returns anything more than that it will take significantly longer and you should consider additional passing additional filters. If you really need all of the data, a batch size of 5000 should allow you to get all of it, just slightly slower.

Returns:

Get all of the raw (unconverted!) data for objects that match the criteria.

save(schema: list[dict], testing=False) None#

Upload all the data in the given list of schemas.

Parameters:
  • schema (list[dict]) – A list of json dictionaries

  • testing (bool) – Should we just enter test mode? Default is False

Raises:

OtterLimitationError – If some objects in OTTER are within 5” we can’t figure out which ones to merge with which ones.

upload(json_data, collection='vetting', testing=False) Document#

Upload json_data to collection WITHOUT deduplication!

Parameters:
  • [dict] (json_data) – A dictionary of the json data to upload to Otter

  • [str] (collection) – The collection to upload to

  • [bool] (testing) – Default is False

Returns:

The pyArango document that was uplaoded

upload_private(collection='vetting', testing=False) None#

Upload the local/private data stored in self.DATADIR to the vetting collection (like a SQL table) in the central arangodb document database.

WARNING! This will make any data in self.DATADIR public! Please double check before using this method!

Parameters:
  • collection (str) – The collection to add the documents to. Default is “vetting” where the documents will then be vetted by our team.

  • testing (bool) – True if don’t actually upload, False is default

Returns:

If testing is false (the default), returns the arangodb upload result. If testing is true, returns the list of merged dictionaries that would get uploaded.

Raises:

OtterLimitationError – If some objects in OTTER are within 5” we can’t figure out which ones to merge with which ones.

otter.Transient#

class otter.Transient(d={}, name=None)#
clean_photometry(flux_unit: Unit = 'mag(AB)', date_unit: Unit = 'MJD', freq_unit: Unit = 'GHz', wave_unit: Unit = 'nm', obs_type: str = None, deduplicate: Callable | None = None, correct_for_mw_dust: bool = True, cleanup_uvoir_filternames: bool = True, drop_no_host_subtract: bool = False, drop_unclear_host_subtract: bool = False, snr_threshold: float = 3) DataFrame#

Ensure the photometry associated with this transient is all in the same units/system/etc

Parameters:
  • flux_unit (astropy.unit.Unit) – Either a valid string to convert or an astropy.unit.Unit, this can be either flux, flux density, or magnitude unit. This supports any base units supported by synphot (https://synphot.readthedocs.io/en/latest/synphot/units.html#flux-units).

  • date_unit (str) – Valid astropy date format string. See https://docs.astropy.org/en/stable/time/index.html#time-format

  • freq_unit (astropy.unit.Unit) – The astropy unit or string representation of an astropy unit to convert and return the frequency as. Must have a base unit of 1/time (Hz).

  • wave_unit (astropy.unit.Unit) – The astropy unit or string representation of an astropy unit to convert and return the wavelength as. Must have a base unit of length.

  • obs_type (str) – “radio”, “xray”, or “uvoir”. If provided, it only returns data taken within that range of wavelengths/frequencies. Default is None which will return all of the data.

  • deduplicate (Callable|None) – A function to be used to remove duplicate reductions of the same data that produces different flux values. The default is the otter.deduplicate_photometry method, but you can pass any callable that takes the output pandas dataframe as input. Set this to False if you don’t want deduplication to occur.

  • correct_for_mw_dust (bool) – If True we will automatically correct photometry for MW dust extinction using the SFD dustmaps and the Gordon+23 extinction curve assuming R_V=3.1. Note that this will only correct photometry in the range 0.0912 - 32 um!

  • cleanup_uvoir_filternames (bool) – If True (the default) we will try to cleanup the UV/Optical/IR filter names to make them more standard.

  • drop_no_host_subtract (bool) – If True this will remove rows in the cleaned up photometry dataframe that have corr_host set to False. Default is drop_no_host_subtract = False.

  • drop_unclear_host_subtract (bool) – Same as drop_no_host_subtract, but for when corr_host is NaN (which is set for unclear host subtraction). Default is drop_unclear_host_subtract = False.

  • snr_threshold (float) – The signal-to-noise ratio to consider for upperlimits. Any flux measurement below (or above for magnitudes) this SNR will be flagged as an upperlimit. IMPORTANT: This does not re-compute the upperlimit boolean for literature values that were flagged as limits (because we trust the people that published the data to make a proper determination if this is a detection or not).

Returns:

A pandas DataFrame of the cleaned up photometry in the requested units

clear() None.  Remove all items from D.#
classmethod deduplicate_photometry(phot: DataFrame, date_tol: int | float = 1)#

This deduplicates a pandas dataframe of photometry that could potentially have rows/datasets that are the result of different reductions of the same data. This is especially relevant for X-ray and UV observations where different reductions can produce different flux values from the same observation.

The algorithm used here first finds duplicates by normalizing the telescope names, then grouping the dataframe by transient name, norm telescope name, filter_key, and the obs_type. It then assumes that data from the same reference will not produce duplicated data. Finally, it finds the overlapping regions within date +/- date_tol (or between date_min and date_max for binned data), and uses any data within that region as duplicated. From there, it first tries to choose the reduction that is host subtracted (if only one is host subtracted), then if neither or more than one of the datasets are host subtracted then it just takes the most recent reduction.

Parameters:
  • phot (pd.DataFrame) – A pandas dataframe of the photometry with keys defined by the OTTER schema

  • date_tol (int|float) – The default tolerance (or “uncertainty”) to use on the dates in the “date” column of phot. In days. Defaults to 1 day.

get(k[, d]) D[k] if k in D, else d.  d defaults to None.#
get_classification()#

Get the default classification of this Transient. This normally corresponds to the highest confidence classification that we have stored for the transient.

Returns:

The default object class as a string, the confidence level in that class, and a list of the bibcodes corresponding to that classification. Or, None if there is no classification.

get_discovery_date() Time#

Get the default discovery date for this Transient

Returns:

astropy.time.Time of the default discovery date

get_ebv()#

Get the E(B-V) for this transient from SFD.

Returns:

The SFD E(B-V) for the MW along this line of sight to the transient.

get_host(max_hosts=3, search=False, **kwargs) list#

Gets the default host information of this Transient. This returns an otter.Host object. If search=True, it will also check the BLAST host association database for the best match and return it as well. Note that if search is True then this has the potential to return max_hosts + 1, if BLAST also returns a result. The BLAST result will always be the last value in the returned list.

Parameters:
  • [int] (max_hosts) – The maximum number of hosts to return, default is 3

  • **kwargs – keyword arguments to be passed to getGHOST

Returns:

A list of otter.Host objects. This is useful becuase the Host objects have useful methods for querying public catalogs for data of the host.

get_meta(keys=None) Self#

Get the metadata (no photometry or spectra)

This essentially just wraps on __getitem__ but with some checks

Parameters:

keys (list[str]) – list of keys to get the metadata for from the transient

Returns:

A Transient object of just the meta data

get_redshift() float#

Get the default redshift of this Transient

Returns:

Float value of the default redshift

get_skycoord(coord_format='icrs') SkyCoord#

Convert the coordinates to an astropy SkyCoord

Parameters:

coord_format (str) – Astropy coordinate format to convert the SkyCoord to defaults to icrs.

Returns:

Astropy.coordinates.SkyCoord of the default coordinate for the transient

get_wiserep_spec(**kwargs) dict#

Check WISeREP for spectra of this object. Note that this object must have a matching IAU name stored in OTTER!

Parameters:

**kwargs – Keyword arguments to be passed to DataFinder.query_wiserep.

Returns:

a tuple. First output is a metadata dataframe for the spectra. the second is a dictionary of pandas dataframes. The keys are the indices of the metadata dataframe. The dataframes will have a wave column and a flux column.

items() a set-like object providing a view on D's items#
keys() a set-like object providing a view on D's keys#
pop(k[, d]) v, remove specified key and return the corresponding value.#

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair#

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D#
update([E, ]**F) None.  Update D from mapping/iterable E and F.#

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values#

otter.Host#

otter.DataFinder#

otter.plotter.plotter#

otter.plotter.otter_plotter.OtterPlotter#

class otter.plotter.otter_plotter.OtterPlotter(backend)#

Handles the backend for the “plotter” module

Parameters:

backend (string) – a string of the module name to import and use as the backend. Currently supported are “matplotlib”, “matplotlib.pyplot”, “plotly”, and “plotly.graph_objects”

otter.util#

Some constants, mappings, and functions to be used across the software

otter.util.BASEDIR = '/home/docs/checkouts/readthedocs.org/user_builds/astro-otter/envs/latest/lib/python3.11'#

Base directory for the OTTER API software package

otter.util.DATADIR = '/home/docs/checkouts/readthedocs.org/user_builds/astro-otter/envs/latest/lib/python3.11/data/base'#

Deprecated database directory that IS NOT always constant anymore

otter.util.FILTER_MAP_FREQ = {'0': 601.5655810567023, '1': 1236.8527545450256, '2': 1531.4976984760474, 'B': 688.8500955332158, 'B_S': 696.7876979144597, 'C': 601.5655810567023, 'Clear': 629.637672549936, 'DLT40': 629.637672549936, 'F070W': 431.04176743403116, 'F090W': 336.17431986268366, 'F1000W': 30.349460503852665, 'F1130W': 26.53952983680919, 'F115W': 262.87628654288676, 'F1280W': 23.59741975845449, 'F1500W': 20.08679352819493, 'F150W': 201.94374815011136, 'F1800W': 16.773842151606242, 'F200W': 152.56522352568953, 'F2100W': 14.581938602646188, 'F2550W': 11.919267708332558, 'F277W': 110.05136786468209, 'F300M': 100.56915203596012, 'F335M': 89.41072625742719, 'F356W': 85.01984846997881, 'F360M': 82.9357933095218, 'F444W': 68.96667222373961, 'F475W': 648.9823425403824, 'F560W': 53.67852315133938, 'F625W': 489.2629992899134, 'F770W': 39.87175477126777, 'F775W': 402.8409598867557, 'FUV': 1975.086895569116, 'G': 518.6766845466752, 'H': 185.33613196897403, 'I': 382.7915178046724, 'Ic': 382.7915178046724, 'Itagaki': 577.0861573682259, 'J': 239.862442505934, 'K': 139.79431978859097, 'Kepler': 519.5058608954615, 'Ks': 139.79431978859097, 'LGRB': 601.5655810567023, 'M': 1360.083095675749, 'M2': 1360.083095675749, 'NUV': 1346.3548820463916, 'Open': 629.637672549936, 'R': 471.26223689126897, 'RGB': 601.5655810567023, 'R_s': 471.26223689126897, 'Rc': 471.26223689126897, 'TESS': 403.1881955125893, 'U': 858.321721875779, 'UVM2': 1360.083095675749, 'UVW1': 1236.8527545450256, 'UVW2': 1531.4976984760474, 'U_S': 875.611103788721, 'V': 548.3068934496129, 'V_S': 554.9815375506427, 'W1': 1236.8527545450256, 'W2': 1531.4976984760474, 'b': 696.7876979144597, 'bs': 696.7876979144597, 'c': 580.1132515050684, 'clear': 601.5655810567023, 'cyan': 580.1132515050684, 'g': 648.9823425403824, "g'": 648.9823425403824, 'g-DECam': 635.8015668464043, 'gp': 648.9823425403824, 'gprime': 648.9823425403824, 'griz': 601.5655810567023, 'i': 402.8409598867557, "i'": 402.8409598867557, 'i-DECam': 386.62233825433924, 'ip': 402.8409598867557, 'iprime': 402.8409598867557, 'o': 451.71177203298663, 'orange': 451.71177203298663, 'pseudobolometric': 601.5655810567023, 'r': 489.2629992899134, "r'": 489.2629992899134, 'r-DECam': 472.4459671948087, 'rp': 489.2629992899134, 'rprime': 489.2629992899134, 's': 875.611103788721, 'u': 849.2871562331687, "u'": 849.2871562331687, 'um2': 1360.083095675749, 'unfilt.': 601.5655810567023, 'up': 849.2871562331687, 'uprime': 849.2871562331687, 'us': 875.611103788721, 'uvm2': 1360.083095675749, 'uvw1': 1236.8527545450256, 'uvw2': 1531.4976984760474, 'uw1': 1236.8527545450256, 'uw2': 1531.4976984760474, 'v': 554.9815375506427, 'vs': 554.9815375506427, 'w': 520.8387777057242, 'white': 30079.243284322874, 'y': 312.24818210606065, 'y-DECam': 303.4727730182509, 'z': 337.7343708777923, "z'": 337.7343708777923, 'z-DECam': 328.753462451287, 'z_s': 346.66628641927826, 'zp': 337.7343708777923, 'zprime': 337.7343708777923, 'zs': 346.66628641927826}#

Mapping for the effective frequencies in THz for all the filters used in OTTER

otter.util.FILTER_MAP_WAVE = {'0': 616.690135, '1': 261.3713060531025, '2': 207.98754332676123, 'B': 443.0539845758355, 'B_S': 435.912081730874, 'C': 616.690135, 'Clear': 615.8130149792426, 'DLT40': 615.8130149792426, 'F070W': 705.5727879998312, 'F090W': 904.2281265089156, 'F1000W': 9968.161727011531, 'F1130W': 11310.984595876938, 'F115W': 1157.001589027877, 'F1280W': 12831.396996921212, 'F1500W': 15091.367399905488, 'F150W': 1503.9880463410511, 'F1800W': 18006.083119653664, 'F200W': 1993.3922957570885, 'F2100W': 20842.526633138932, 'F225W': 2372.81, 'F2550W': 25408.228367890282, 'F277W': 2769.332372846113, 'F300M': 2990.7606605760484, 'F335M': 3363.887076210947, 'F356W': 3576.787256375927, 'F360M': 3626.0578695682693, 'F444W': 4415.974447587756, 'F475W': 471.8872246248687, 'F560W': 5645.279496731566, 'F625W': 618.5194476741524, 'F770W': 7663.455798629626, 'F775W': 749.9704174464691, 'FUV': 153.8620701901866, 'G': 673.5412573108297, 'H': 1630.5155019191195, 'I': 788.558706467662, 'Ic': 788.558706467662, 'Itagaki': 651.0535687558726, 'J': 1255.0918319447906, 'K': 2157.3600605745955, 'Kepler': 641.6835660569259, 'Ks': 2157.3600605745955, 'LGRB': 616.690135, 'M': 225.47802478793594, 'M2': 225.47802478793594, 'NUV': 231.56631043707714, 'Open': 615.8130149792426, 'R': 646.9439215118385, 'RGB': 616.690135, 'R_s': 646.9439215118385, 'Rc': 646.9439215118385, 'TESS': 797.2360657697333, 'U': 353.10502283105023, 'UVM2': 225.47802478793594, 'UVW1': 261.3713060531025, 'UVW2': 207.98754332676123, 'U_S': 347.06360491031495, 'V': 553.7155963302753, 'V_S': 543.0131091205997, 'W1': 261.3713060531025, 'W2': 207.98754332676123, 'b': 435.912081730874, 'bs': 435.912081730874, 'c': 540.8724658332794, 'clear': 616.690135, 'cyan': 540.8724658332794, 'g': 471.8872246248687, "g'": 471.8872246248687, 'g-DECam': 482.6787274749997, 'gp': 471.8872246248687, 'gprime': 471.8872246248687, 'griz': 616.690135, 'i': 749.9704174464691, "i'": 749.9704174464691, 'i-DECam': 782.6680306208917, 'ip': 749.9704174464691, 'iprime': 749.9704174464691, 'o': 686.6260690394873, 'orange': 686.6260690394873, 'pseudobolometric': 616.690135, 'r': 618.5194476741524, "r'": 618.5194476741524, 'r-DECam': 643.2062638192127, 'rp': 618.5194476741524, 'rprime': 618.5194476741524, 's': 347.06360491031495, 'u': 356.17887353001856, "u'": 356.17887353001856, 'um2': 225.47802478793594, 'unfilt.': 616.690135, 'up': 356.17887353001856, 'uprime': 356.17887353001856, 'us': 347.06360491031495, 'uvm2': 225.47802478793594, 'uvw1': 261.3713060531025, 'uvw2': 207.98754332676123, 'uw1': 261.3713060531025, 'uw2': 207.98754332676123, 'v': 543.0131091205997, 'vs': 543.0131091205997, 'w': 638.9300625093831, 'white': 752.0, 'y': 963.3308299506817, 'y-DECam': 989.965087304703, 'z': 896.1488333992431, "z'": 896.1488333992431, 'z-DECam': 917.8949537472383, 'z_s': 867.9495480864285, 'zp': 896.1488333992431, 'zprime': 896.1488333992431, 'zs': 867.9495480864285}#

Mapping for the effective wavelength in nanometers for all filters used in the dataset.

otter.util.RADIO_BAND_MAPPING = {'C': (4, 8), 'HF': (0.003, 0.03), 'K': (18, 27), 'Ka': (27, 40), 'Ku': (12, 18), 'L': (1, 2), 'S': (2, 4), 'UHF': (0.55, 1), 'VHF': (0.03, 0.125), 'X': (8, 12), 'alma.1': (40, 50), 'alma.10': (787, 950), 'alma.3': (84, 116), 'alma.4': (116, 163), 'alma.5': (163, 211), 'alma.6': (211, 275), 'alma.7': (275, 373), 'alma.8': (373, 500), 'alma.9': (500, 720), 'gmrt.2': (0.125, 0.25), 'gmrt.3': (0.25, 0.55)}#

Mapping of common radio/mm band names to their corresponding frequency ranges. All frequencies are in GHz. The upperlimit is inclusive, that is these ranges are really (xx, yy].

otter.util.VIZIER_LARGE_CATALOGS = ['2MASS-PSC', '2MASX', 'AC2000.2', 'AKARI', 'ALLWISE', 'ASCC-2.5', 'B/DENIS', 'CMC14', 'Gaia-DR1', 'GALEX', 'GLIMPSE', 'GSC-ACT', 'GSC1.2', 'GSC2.2', 'GSC2.3', 'HIP', 'HIP2', 'IRAS', 'NOMAD1', 'NVSS', 'PanSTARRS-DR1', 'PGC', 'Planck-DR1', 'PPMX', 'PPMXL', 'SDSS-DR12', 'SDSS-DR7', 'SDSS-DR9', 'Tycho-2', 'UCAC2', 'UCAC3', 'UCAC4', 'UKIDSS', 'USNO-A2', 'USNO-B1', 'WISE']#

ViZier catalog names that we query for host information in the Host class

otter.util.XRAY_AREAS = {'chandra': <Quantity 600. cm2>, 'ep': <Quantity 600. cm2>, 'ep-fxt': <Quantity 600. cm2>, 'erosita': <Quantity 1500. cm2>, 'konus-wind': <Quantity 120. cm2>, 'maxi': <Quantity 200. cm2>, 'nustar': <Quantity 847. cm2>, 'rosat': <Quantity 400. cm2>, 'swift': <Quantity 135. cm2>, 'swift-xrt': <Quantity 135. cm2>, 'xmm': <Quantity 1500. cm2>, 'xmm pointed': <Quantity 1500. cm2>, 'xmm slew': <Quantity 1500. cm2>, 'xmm-newton': <Quantity 1500. cm2>, 'xmm-slew': <Quantity 1500. cm2>}#

X-Ray telescope areas that are used for converting from counts to other units.

NOTE: These are estimates from the following links * https://swift.gsfc.nasa.gov/about_swift/Sci_Fact_Sheet.pdf * https://heasarc.gsfc.nasa.gov/docs/rosat/ruh/handbook/node39.html#SECTION00634000000000000000 * https://www.cosmos.esa.int/web/xmm-newton/technical-details-mirrors * https://cxc.harvard.edu/cdo/about_chandra

otter.util.classification_schema = {'class_type': None, 'confidence': None, 'default': None, 'object_class': None, 'reference': None}#

Subschema to describe the attributes for the classification dictionary

otter.util.clean_schema(schema)#

Clean out Nones and empty lists from the given subschema

otter.util.coordinate_schema = {'b': None, 'b_error': None, 'b_units': None, 'computed': None, 'coord_type': None, 'dec': None, 'dec_error': None, 'dec_units': None, 'default': None, 'epoch': None, 'frame': None, 'l': None, 'l_error': None, 'l_units': None, 'lat': None, 'lat_error': None, 'lat_units': None, 'lon': None, 'lon_error': None, 'lon_units': None, 'ra': None, 'ra_error': None, 'ra_units': None, 'reference': None}#

Subschema to describe the possible attributes for the coordinate dictionary

otter.util.date_reference_schema = {'computed': None, 'date_format': None, 'date_type': None, 'reference': None, 'value': None}#

Subschema to describe the date_reference dictionary attributes

otter.util.distance_schema = {'computed': None, 'cosmology': None, 'default': None, 'distance_type': None, 'error': None, 'reference': None, 'unit': None, 'uuid': None, 'value': None}#

Subschema to describe the possible attributes for the distance dictionary

otter.util.filter_alias_schema = {'filter_key': None, 'freq_eff': None, 'freq_max': None, 'freq_min': None, 'freq_units': None, 'wave_eff': None, 'wave_max': None, 'wave_min': None, 'wave_units': None, 'zp': None, 'zp_system': None, 'zp_units': None}#

Subschema to describe the attributes in the filter_alias dictionary

otter.util.filter_to_obstype(band_name)#

Converts a band name to either ‘radio’, ‘uvoir’, ‘xray’

otter.util.freq_to_band(freq: Quantity) str#

Converts an effective frequency to the corresponding band name based on the standards listed in RADIO_BAND_MAPPING

Parameters:

freq (astropy Quantity) – Astropy Quantity of the frequency to get the band name

Returns:

string with the commonly used band name

otter.util.freq_to_obstype(freq_eff)#

Converts a frequency value to either ‘radio’, ‘uvoir’, ‘xray’

Parameters:

freq_eff (u.Quantity) – An astropy quantity in frequency space

otter.util.freqlist_to_band(freq_list: list[float], freq_unit_list: list[str], ncores=1) list[str]#

Converts a list of effective frequencies to the corresponding band names based on the standards listed in RADIO_BAND_MAPPING

Parameters:
  • freq_list (list[float]) – floats for the frequencies

  • freq_unit_list (list[str]) – List of astropy unit strings to apply to freq_list

  • ncores (int) – The number of cores to multiprocess with

Returns:

list of strings with the band names

otter.util.logger = <Logger otter.util (WARNING)>#

Helper functions first that just don’t belong anywhere else

otter.util.name_alias_schema = {'reference': None, 'value': None}#

Subschema for the name and alias dictionary

otter.util.photometry_schema = {'aperature': None, 'corr_av': None, 'corr_host': None, 'corr_hostav': None, 'corr_k': None, 'date': None, 'date_err': None, 'date_format': None, 'epoch_redshift': None, 'epoch_zeropoint': None, 'exptime': None, 'filter': None, 'filter_key': None, 'ignore': None, 'instrument': None, 'obs_type': None, 'observer': None, 'phot_type': None, 'pipeline': None, 'raw': None, 'raw_err': None, 'raw_units': None, 'reducer': None, 'sigma': None, 'sky': None, 'telescope': None, 'telescope_area': None, 'upperlimit': None, 'val_av': None, 'val_host': None, 'val_hostav': None, 'val_k': None, 'val_s': None, 'value': None, 'value_err': None, 'value_units': None}#

Subschema to describe all of the possible attributes that can be used in the photometry dictionary

otter.util.reference_alias_schema = {'human_readable_name': None, 'name': None}#

Subschema to describe the attributes for the reference alias dictionary

otter.util.schema = {'classification': {'value': []}, 'coordinate': [], 'date_reference': [], 'distance': [], 'filter_alias': [], 'name': {'alias': [], 'default_name': None}, 'photometry': [], 'reference_alias': [], 'schema_version': {'comment': 'Copied from tde.space', 'value': '0'}, 'spectra': []}#

Schema dictionary to be filled with values from the subschemas

otter.util.subschema = {'classification': {'class_type': None, 'confidence': None, 'default': None, 'object_class': None, 'reference': None}, 'coordinate': {'b': None, 'b_error': None, 'b_units': None, 'computed': None, 'coord_type': None, 'dec': None, 'dec_error': None, 'dec_units': None, 'default': None, 'epoch': None, 'frame': None, 'l': None, 'l_error': None, 'l_units': None, 'lat': None, 'lat_error': None, 'lat_units': None, 'lon': None, 'lon_error': None, 'lon_units': None, 'ra': None, 'ra_error': None, 'ra_units': None, 'reference': None}, 'date_reference': {'computed': None, 'date_format': None, 'date_type': None, 'reference': None, 'value': None}, 'distance': {'computed': None, 'cosmology': None, 'default': None, 'distance_type': None, 'error': None, 'reference': None, 'unit': None, 'uuid': None, 'value': None}, 'filter_alias': {'filter_key': None, 'freq_eff': None, 'freq_max': None, 'freq_min': None, 'freq_units': None, 'wave_eff': None, 'wave_max': None, 'wave_min': None, 'wave_units': None, 'zp': None, 'zp_system': None, 'zp_units': None}, 'name/alias': {'reference': None, 'value': None}, 'photometry': {'aperature': None, 'corr_av': None, 'corr_host': None, 'corr_hostav': None, 'corr_k': None, 'date': None, 'date_err': None, 'date_format': None, 'epoch_redshift': None, 'epoch_zeropoint': None, 'exptime': None, 'filter': None, 'filter_key': None, 'ignore': None, 'instrument': None, 'obs_type': None, 'observer': None, 'phot_type': None, 'pipeline': None, 'raw': None, 'raw_err': None, 'raw_units': None, 'reducer': None, 'sigma': None, 'sky': None, 'telescope': None, 'telescope_area': None, 'upperlimit': None, 'val_av': None, 'val_host': None, 'val_hostav': None, 'val_k': None, 'val_s': None, 'value': None, 'value_err': None, 'value_units': None}, 'reference_alias': {'human_readable_name': None, 'name': None}, 'spectra': {'airmass': None, 'aperture': None, 'corr_av': None, 'corr_flux': None, 'corr_host': None, 'corr_hostav': None, 'corr_k': None, 'corr_phot': None, 'date': None, 'date_err': None, 'date_format': None, 'disperser': None, 'exptime': None, 'filter': None, 'filter_key': None, 'flux': None, 'flux_units': None, 'fluxerr': None, 'ignore': None, 'instrument': None, 'lamp': None, 'max_wave': None, 'min_wave': None, 'observer': None, 'pipeline': None, 'raw': None, 'raw_err': None, 'reducer': None, 'resolution': None, 'resolution_units': None, 'sky': None, 'slit': None, 'spec_type': None, 'standard_name': None, 'telescope': None, 'val_av': None, 'val_host': None, 'val_hostav': None, 'val_k': None, 'wavelength': None, 'wavelength_units': None}}#

A useful variable to describe all of the subschemas that are available and can be used

otter.util.wave_to_obstype(wave_eff)#

Converts a wavelength value to either ‘radio’, ‘uvoir’, ‘xray’

Parameters:

wave_eff (u.Quantity) – An astropy quantity in wavelength space

otter.exceptions#

Custom exceptions for otter

exception otter.exceptions.FailedQueryError#

Exception thrown when the users query does not return any results.

exception otter.exceptions.IOError#

Exception thrown when the input or output argument/value is not the correct type.

exception otter.exceptions.MissingEnvVarError(v, url=None)#

Thrown when the querying code expects an Environment variable and doesn’t get one

exception otter.exceptions.OtterLimitationError(msg)#

Exception thrown when the user requests something that is currently not supported by the API.

exception otter.exceptions.OtterNotImplementedError#

Exception thrown by methods that are not yet implemented

exception otter.exceptions.TransientMergeError#

Exception thrown when the Transient objects can not be combined as expected.