SNData¶
SNData provides access to data releases published by a variety of supernova (SN) surveys. It is designed to support the development of scalable analysis pipelines that translate with minimal effort between and across data sets. A summary of accessible data is provided below. Access to additional surveys is added upon request or as needed for individual research projects undertaken by the developers. To request an additional survey / data release, please raise an issue on GitHub.
Using These Docs¶
SNData is designed to provide as consistent of an interface as possible across surveys. The Getting Started guides are intended to help you get up and running quickly and to familiarize you with the general SNData interface. Additional API documentation is provided for each individual data set to highlight any (very) minor deviations a particular survey or data release may have from the rest of the package. In general you should:
- Read the installation guide (~1 minute if you know how to use
pip
) - Read the quick start guide to learn how the package works (~5 minutes)
- Read the slow start guide for a better understanding of the available features and how they can make your life easier (~10 minutes)
- Refer to the API documentation for a given survey as you see necessary
Available Data¶
SNData provides data access for the following supernova surveys. If you are having issues downloading data for a particular survey or data release, please check the Server Status Page.
Survey Name | Data Release | Data Type |
---|---|---|
Berkeley Supernova Ia Program | Stahl et al. 2020 | Spectroscopic |
Carnegie Supernova Project | DR1 | Spectroscopic |
DR3 | Photometric | |
Dark Energy Survey | SN3YR | Photometric |
Equation of State: Supernovae Trace Cosmic Expansion | Narayan et al. 2016 | Photometric |
Joint Light-Curve Analysis | Betoule et al. 2014 | Photometric |
Lick Observatory Supernova Search | Sako et al. 2018 | Photometric |
Sako et al. 2018 | Photometric | |
Sloan Digital Sky Survey | Sako et al. 2018 | Photometric |
Sako et al. 2018 | Photometric | |
Supernova Legacy Survey | Balland et al. 2009 | Spectroscopic |
Sweetspot | Weyant et al. 2018 | Photometric |
Change Log¶
This page documents any API changes between different versions of the
sndata
package.
Development¶
- Adds data from the second data release of the BLick Observatory Supernova Search (
sndata.loss.Stahl19
). - Adds data from the second data release of the Berkely Supernova Ia Program (
sndata.bsnip.Stahl20
).
V 1.2.1¶
- Patches missing file bug for Ganeshalingam et al. 2013 release.
- Hides any benign warnings when parsing data files.
V 1.2.0¶
- Adds data from the first data release of the BLick Observatory Supernova Search (
sndata.loss.Ganeshalingam13
). - The
format
argument is added to theutils.convert_to_jd
function. - Support is added to
utils.convert_to_jd
for converting UT times to JD.
V 1.1.1¶
- Fixes bug where existing data is not skipped during download by default.
V 1.1.0¶
- Adds data from the first data release of the Sweetspot survey (
sndata.sweetsport.DR1
).
V 1.0.1¶
- For consistency with the rest of the package, time values in data tables
returned by the
sndata.sdss.Sako18Spec
class have been converted from UNIX timestamps to Julian day.
Installation and Setup¶
To install the package, please choose from one of the options below.
Note
No survey data is downloaded when installing or upgrading SNData. All data management is handled explicitly, as outlined in the Slow Start tutorial.
Using PIP (Recommended)¶
To install using the pip package manager, run:
pip install sndata
Pip will automatically install any missing dependencies in your Python environment. If you have any issues installing the package, try installing the dependencies manually and then reinstall sndata.
A list of required dependencies is provided on GitHub via a
requirements.txt
document. Dependencies can be installed by running:
# Clone the source code from GitHub
git clone http://github.com/djperrefort/SNData SNData
# Install dependencies
pip install -r SNData/requirements.txt
Using setup.py¶
If pip is unavailable on your system, the package source code is available on GitHub.
# Clone the source code from GitHub
git clone http://github.com/djperrefort/SNData SNData
# Install the package from source
cd SNData
python setup.py install --user
As in the previous method, any missing dependencies in your Python environment
should be installed automatically. If you have any issues installing the
package, install each dependency from requirements.txt
and then try again.
Configuring Data Storage¶
By default data downloaded by sndata is stored in the installation directory. This can be changed to a custom directory by specifying the value SNDATA_DIR in your environment (i.e., in you .bash_profile or .bashrc file). For example:
export SNDATA_DIR="/your/data/directory/path"
Quick Start¶
The following is provided as a short example on how to import a supernova data release, download the corresponding data, and read it into memory. For a more in depth overview, see the Slow Start.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | # All data releases are available as ``sndata.<survey name>.<release name>``
from sndata.csp import DR3
# Start by creating an instance of the data release
dr3 = DR3()
# Use ``help`` to get a description of the survey
print(help(dr3))
# Download data to your machine.
# Note: If data is already downloaded, this function call won't do anything.
dr3.download_module_data()
# Check what tables are available from the release's corresponding publication
published_tables = dr3.get_available_tables()
print(published_tables)
# Read one of those tables by referencing the table name or number
dr3_demo_table = dr3.load_table(published_tables[0])
# Check what objects are included in the data release
object_ids = dr3.get_available_ids()
print(obj_ids)
# Read in the data for an object using it's Id
demo_id = object_ids[0]
dr3.get_data_for_id(demo_id)
# Data is auto-formatted to be compatible with the SNCosmo package.
# To disable this and return data as presented on the data release,
# set ``format_table=False``.
dr3.get_data_for_id(demo_id, format_table=False)
# For convenience you can iterate over all tables
data_iterator = dr3.iter_data()
for data in data_iterator:
print('The first data table:')
print(data)
break
|
Slow Start¶
The following is provided as an in depth demonstration of the various functionality available in SNData. For more information on a specific module, please see that module’s page in the API documentation.
Importing a Survey¶
To access data from a specific survey, import it from the parent package. A
summary of each data release, including any deviations from the standard UI,
can be accessed by calling the builtin help
function. For demonstration
purposes we will be using the third data release from the Carnegie Supernova
Project.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | from sndata.csp import DR3
# At instantiation, the DR3 class determines where the data
# is located on your machine
dr3 = DR3()
# Information about the parent survey
print(dr3.survey_name)
print(dr3.survey_abbrev)
# A summary of the DR3 data set
help(dr3)
# Where to go for more information
print(dr3.survey_url)
# The type of data in this release
print(dr3.data_type)
# The primary publication(s) and NASA ADS link(s) describing the data
print(dr3.publications)
print(dr3.ads_url)
# Photometric data releases include filters
print(dr3.band_names)
|
Downloading Data¶
To minimize disk space usage, SNData does not come pre-installed with any survey data. Instead, users must manually tell SNData to download (or delete) data from their local machine.
1 2 3 4 5 6 7 8 | # Get an overview of the provided data
help(dr3)
# Download data for the given survey / data release
dr3.download_module_data()
# Delete any downloaded data for the given survey / data release
dr3.delete_module_data()
|
It is useful to note that any data has already been downloaded is skipped over
by download_module_data
, making it safe to call in an automated pipeline
environment. This behavior can be disabled by specifying the force=True
argument.
Important
Survey data is often hosted across multiple websites. As such,
it is possible the server responsible for hosting a subset of a survey’s
data (e.g. the filter transmission curves) is temporarily offline. In this
case SNData will raise a warning and continue downloading any data that
is still online. The download_module_data
function can then be re-run
once the server is back online.
Accessing Data¶
Observational data can be retrieved for individual objects as astropy tables. For convenience, the Ra, Dec, redshift, and redshift error are included in the table’s meta data when available.
1 2 3 4 5 6 7 8 9 10 | # Get a list of available objects
list_of_ids = dr3.get_available_ids()
# Get data for a given object
demo_id = list_of_ids[0]
data_table = dr3.get_data_for_id(demo_id)
print(data_table)
# Don't forget to check the meta data!
print(data_table.meta)
|
Data tables returned by SNData are formatted for use with the sncosmo
python package. In doing so, the values of the table may be manipulated from
the original file data into different units, column names, etc. To disable
this feature, specify the format_table=False
argument.
The iter_data
function is also provided for convenience to iterate over
data for all available objects.
1 2 3 | for data in dr3.iter_data():
print(data)
break
|
This function allows users to optionally select a subset of the total data
by defining a filter function. This function should accept a data table
yielded by iter_data
and return a boolean. For example, to only select
target with a redshift less than .1:
1 2 3 4 5 6 | def filter_func(data_table):
return data_table.meta['z'] < .1
for data in dr3.iter_data(filter_func=filter_func):
print(data)
break
|
Important
As iter_data
iterates over supernovae, it reads in data
from file for a given object before checking the filter function. For this
reason, filter functions should not be used in an attempt improve runtime
by reducing I/O operations as it will have no effect.
Reading Tables¶
Some surveys include summary tables in their data releases. The inclusion of tables from published papers is also common.
1 2 3 4 5 6 7 | # Check what tables are available
published_tables = dr3.get_available_tables()
print(published_tables)
# Read one of those tables by referencing the table name or number
demo_table_name = published_tables[0]
demo_table = dr3.load_table(demo_table_name)
|
Note that the load_table
function caches the returned result in memory.
This improves the speed of successive calls and means you don’t have to be
worried about I/O performance.
Registering Filters with SNCosmo¶
SNData automatically formats data for use with the SNCosmo package. To fully take advantage of this, SNData is also able to register the filter transmission curves for a given survey into the sncosmo registry (the registry is how SNCosmo keeps track of what each filter, model, etc. are called).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | import sncosmo
# The names of the bands that will be registered
print(dr3.band_names)
# Register the band-passes of the survey with SNCosmo
# You can optionally specify ``force=True`` to re-register band-passes
dr3.register_filters()
# Get data for SN 2004dt
data_table = dr3.get_data_for_id('2004dt')
print(data_table)
# Fit the data
model = sncosmo.Model('salt2')
model.set(z=data_table.meta['z'])
result, fitted_model = sncosmo.fit_lc(
data=data_table,
model=model,
vparam_names=['t0', 'x0', 'x1', 'c'])
print(result)
|
Combining Data Sets¶
SNData allows users to combine individual data releases into a single
CombinedDataset
object. The resulting object provides the same general user
interface as a single data access module but provides access to data from
multiple surveys / data releases.
Creating a Combined Data Set¶
To create a combined data set, import the data access classes for each of the
data releases you want to join and pass them to the CombinedDataset
object. For demonstration purposes we combine data from the third data
release of the Carnegie Supernova Project and the three year cosmology release
of the Dark Energy Survey:
1 2 3 | from sndata import CombinedDataset, csp, des
combined_data = CombinedDataset(csp.DR3(), des.SN3YR())
|
The resulting object provides the same user interface as the rest of the SNData package, including having the same method names:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # Download all data for the combined data releases
combined_data.download_module_data()
# Get a list of available supplementary tables
list_of_table_ids = combined_data.get_available_tables()
# Load a supplementary tables
demo_table_id = list_of_table_ids[0]
demo_sup_table = combined_data.load_table(demo_table_id)
# Get a list of available objects
list_of_ids = combined_data.get_available_ids()
# Get data for a single object
demo_id = list_of_ids[0]
data_table = combined_data.get_data_for_id(demo_id)
print(data_table)
# Iterate over data for all objects in the combined data set
for data in combined_data.iter_data():
print(data)
break
|
Important
The format of object and table Id’s for CombinedDataset
objects is slightly different than for a single data release. Please
keep reading.
Unlike the object and table Id’s for a single data release, the default Id’s
for a CombinedDataset
are tuples instead of strings. Each tuple contains
three elements including (in order) the individual object identifier, data
release name, and survey name. For example, the ID value for supernova ‘2007S’
from CSP Data Release 3 (DR3) would be ('2007S', 'DR3', 'CSP')
.
By specifying object Id’s in this way, it is ensured that objects in combined
data releases always have unique identifiers. However, in the case where
the object Id’s from two data releases are already unique (as is the case when
combining csp.DR3` and ``des.SN3YR
), CombinedDataset
objects are smart
enough to mimic the behavior of a normal / single data release and can
take object Id’s as strings. For example:
1 2 3 4 5 | # You can specify object ID's as tuples
combined_data.get_data_for_id(('2007S', 'DR3', 'CSP'))
# or if the object names across the joined surveys are unique, as a string
combined_data.get_data_for_id('2007S')
|
Joining Object Id’s¶
It is possible for two different photometric surveys to observe the same astronomical object. In this case, object Id’s from different surveys can be “joined” together so that when requesting data for a given object Id, data is returned for all Id’s that have been joined together. Accomplishing this is as simple as:
1 2 3 4 5 6 7 8 | # Note that you can join an arbitrary number of object Id's
combined_data.join_ids(obj_id_1, obj_id_2, obj_id_3, ...)
# You can also retrieve a list of joined ID values
print(combined_data.get_joined_ids())
# To undo the above joining action
combined_data.separate_ids(obj_id_1, obj_id_2, obj_id_3, ...)
|
When retrieving data for a joined ID, the returned data table is simply the collective data tables for each joined ID stacked vertically.
1 2 | data = combined_data.get_data_for_id(obj_id_1)
print(data)
|
It is worth noting that CombinedDataset
objects are aware of successive
join actions. This means that the following two examples are functionally
equivalent.
1 2 3 4 5 6 | # You can join multiple Id's at once ...
combined_data.join_ids(obj_id_1, obj_id_2, obj_id_3)
# Or join them successively
combined_data.join_ids(obj_id_1, obj_id_2)
combined_data.join_ids(obj_id_2, obj_id_3)
|
Creating Custom Data Classes¶
SNData uses an object oriented design to automate basic data management tasks and ensure a consistent user interface. Prebuilt template classes are provided to represent spectroscopic / photometric data, allowing users to create customized data access objects. In general, the steps for creating a new data access class include:
- Inherit from one of the prebuilt
SpectroscopicRelease
orPhotometricRelease
template classes - Define some meta data describing the data release
- Define a few private functions for parsing your data set
Below we work through examples for photometric and spectroscopic data. If after working through these examples you still have remaining questions, please feel free to raise an issue on GitHub.
Spectroscopic Data¶
To create a data access class for spectroscopic data, we start by inheriting
from the SpectroscopicRelease
. We then add some meta data about the
survey and data release that is being represented.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | from sndata.base_classes import SpectroscopicRelease
from sndata import utils
# Class should be named to reflect the official acronym of the data release
# or, if an acronym is not available, the publication for the data
class Smith20(SpectroscopicRelease):
"""Describe the contents of the data release here
(Source: Smith, Jhonson et al. 2020)
Deviations from the standard UI:
- None
Cuts on returned data:
- None
"""
# General metadata
survey_name = 'Demo Supernova Survey' # Full survey name
survey_abbrev = 'DSS' # Official survey abbreviation
release = 'Smith20' # Name of the data release
survey_url = 'www.url.com' # URL of the official data release
publications = ('Smith et al. 2020',) # Any relevant publications
# Link to ADS abstract of primary paper
ads_url = 'https://ui.adsabs.harvard.edu/'
|
Next we use the __init__
method to define the local paths of the data
being represented and, if desired, the remote URL’s the data should be
downloaded from. All data should be stored in a subdirectory of the
self._data_dir
, which is determined automatically by SNData.
1 2 3 4 5 6 7 8 9 10 11 12 | def __init__(self):
"""Define local and remote paths of data"""
# Call to parent class defines the self._data_dir attribute
# All data should be downloaded to / read from that directory
super().__init__()
# Local data paths. You will likely have multiple directories here
self._spectra_dir = self._data_dir / 'spectra_dir_name'
# Define urls for remote data.
self._spectra_url = 'www.my_supernova_spectra.com'
|
The logic for parsing individual data files is then added as private methods:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | def _get_available_tables(self) -> List[int]:
"""Get Ids for available vizier tables published by this data release"""
# Find available tables - for example:
# Find available tables - assume standard Vizier naming scheme
table_nums = []
for f in self._table_dir.rglob('table*.dat'):
table_number = f.stem.lstrip('table')
table_nums.append(int(table_number))
return sorted(table_nums)
def _load_table(self, table_id: int) -> Table:
"""Return a Vizier table published by this data release
Args:
table_id: The published table number or table name
"""
readme_path = self._table_dir / 'ReadMe'
table_path = self._table_dir / f'table{table_id}.dat'
# Read data from file and add meta data from the readme
data = ascii.read(str(table_path), format='cds', readme=str(readme_path))
description = utils.read_vizier_table_descriptions(readme_path)[table_id]
data.meta['description'] = description
return data
def _get_available_ids(self) -> List[str]:
"""Return a list of target object IDs for the current survey"""
# Returned object Ids should be sorted and unique.
# For example:
files = self._spectra_dir.glob('*.dat')
return sorted(set(Path(f).name for f in files))
def _get_data_for_id(self, obj_id: str, format_table: bool = True) -> Table:
"""Returns data for a given object ID
Args:
obj_id: The ID of the desired object
format_table: Format for use with ``sncosmo`` (Default: True)
Returns:
An astropy table of data for the given ID
"""
# Read in data for the object ID and return an astropy table
pass
def _download_module_data(self, force: bool = False, timeout: float = 15):
"""Download data for the current survey / data release
Args:
force: Re-Download locally available data
timeout: Seconds before timeout for individual files/archives
"""
# If you do not wish to include download functionality,
# do not include this method
# The ``utils`` module includes functions for downloading files
# See the ``utils.download_tar`` and ``download_tar.download_file``
# functions. Here is an example:
utils.download_tar(
url=self._spectra_url,
out_dir=self._data_dir,
skip_exists=self._spectra_dir,
mode='r:gz',
force=force,
timeout=timeout
)
|
Notice that there is no need to explicitly raise errors for invalid object
Id’s (InvalidObjId
) or handle errors where there is no downloaded
data (NoDownloadedData
). This is handled automatically by the
SpectroscopicRelease
class we inherited from.
Note
The formatting of Vizier tables is fairly standard, and there is a
chance your _get_available_tables
and _load_table
methods be exactly
the same as the above example. Instead of copy and pasting these two
methods from above, you can alternatively inherit the
DefaultDataParser
class.
Photometric Data¶
Photometric data is represented the same way as spectroscopic data, but with
a few differences. The first is to inherit from the PhotometricRelease
class and to include a bit of extra meta data.
1 2 3 4 5 6 7 8 | from sndata.base_classes import PhotometricRelease
class Smith20(PhotometricRelease):
# Include all of the meta data for a spectroscopic data release and also
# Specify the name and zero point of each photometric filter
band_names = tuple('u', 'g', 'r', 'i', 'z')
zero_point = tuple(25, 25, 25, 25, 25)
|
If not already using transmission filters built into sncosmo
, you will
also need to define the directory where the filter transmission curves are
stored and add some small logic for registering those filters with sncosmo.
For example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | def __init__(self):
"""Define local and remote paths of data"""
# Call to parent class defines the self._data_dir attribute
# All data should be downloaded to / read from that directory
super().__init__()
# Local paths of filter transmission curves
self._filter_dir = self.data_dir / 'filters'
def _register_filters(self, force: bool = False):
"""Register filters for this survey / data release with SNCosmo
Args:
force: Re-register a band if already registered
"""
bandpass_data = zip(self._filter_file_names, self.band_names)
for _file_name, _band_name in bandpass_data:
filter_path = self._filter_dir / _file_name
wave, transmission = np.genfromtxt(filter_path).T
band = sncosmo.Bandpass(wave, transmission)
band.name = filter_name
sncosmo.register(band, force=force)
|
Note
The _register_filters
method shown above can also be inherited
from the DefaultDataParser
class.
Berkeley Supernova Ia Program (BSNIP)¶
The bsnip
module provides access to data from the Berkeley Supernova
Ia Program (BSNIP). For the photometric compliment to this survey, see the
loss
module.
Data Release | Class name | Data Type | Publication |
---|---|---|---|
Data Release 2 | Stahl20 | Spectroscopic | Stahl et al. 2020 |
Stahl et al. 2020 (Spectroscopic)¶
-
class
sndata.bsnip.
Stahl20
[source]¶ The second data release of the the Berkeley Supernova Ia Program (BSNIP), including 637 low-redshift optical spectra collected between 2009 and 2018. Targets include 626 spectra (of 242 objects) that are unambiguously classified as belonging to Type Ia supernovae (SNe Ia). Of these, 70 spectra of 30 objects are classified as spectroscopically peculiar and 79 SNe Ia (covered by 328 spectra) have complementary photometric coverage. The median SN in the data set has one epoch of spectroscopy, a redshift of 0.0208 (with a low of 0.0007 and high of 0.1921), and is first observed spectroscopically 1.1 days after maximum light. (Source: Stahl et al. 2020)
- Deviations from the standard UI:
- Meta data such as object Ra, DEC, and redshifts ar not included in the official data release files.
- Cuts on returned data:
- None
-
delete_module_data
()¶ Delete any data for the current survey / data release
-
download_module_data
(force: bool = False, timeout: float = 15)¶ Download data for the current survey / data release
Parameters: - force – Re-Download locally available data
- timeout – Seconds before timeout for individual files/archives
-
get_available_ids
() → List[str]¶ Return a list of target object IDs for the current survey
Returns: A list of object IDs as strings
-
get_available_tables
() → List[Union[int, str]]¶ Get Ids for available vizier tables published by this data release
-
get_data_for_id
(obj_id: str, format_table: bool = True) → astropy.table.table.Table¶ Returns data for a given object ID
See
get_available_ids()
for a list of available ID values.Parameters: - obj_id – The ID of the desired object
- format_table – Format data into the
sndata
standard format
Returns: An astropy table of data for the given ID
-
iter_data
(verbose: bool = False, format_table: bool = True, filter_func: bool = None) → astropy.table.table.Table¶ Iterate through all available targets and yield data tables
An optional progress bar can be formatted by passing a dictionary of
tqdm
arguments. Outputs can be optionally filtered by passing a functionfilter_func
that accepts a data table and returns a boolean.Parameters: - verbose – Optionally display progress bar while iterating
- format_table – Format data for
SNCosmo
(Default: True) - filter_func – An optional function to filter outputs by
Yields: Astropy tables
-
load_table
(table_id: Union[int, str]) → astropy.table.table.Table¶ Return a Vizier table published by this data release
Parameters: table_id – The published table number or table name
Carnegie Supernova Project (CSP)¶
The csp
module provides access to data from the Carnegie Supernova
Project (CSP). It includes data from the first (DR1) and third (DR3) data
releases.
Data Release | Class Name | Data Type | Publication |
---|---|---|---|
Data Release 1 | DR1 | Spectroscopic | Folatelli et al. 2013 |
Data Release 3 | DR3 | Photometric | Krisciunas et al. 2017 |
Data Release 1¶
-
class
sndata.csp.
DR1
[source]¶ The
DR1
class provides access to spectra from the first release of optical spectroscopic data of low-redshift Type Ia supernovae (SNe Ia) by the Carnegie Supernova Project. It includes 604 previously unpublished spectra of 93 SNe Ia. The observations cover a range of phases from 12 days before to over 150 days after the time of B-band maximum light. (Source: Folatelli et al. 2013)Important
The DR1 spectra are both published and returned by sndata in units of rest frame wavelength.
- Deviations from the standard UI:
- None
- Cuts on returned data:
- None
-
delete_module_data
()¶ Delete any data for the current survey / data release
-
download_module_data
(force: bool = False, timeout: float = 15)¶ Download data for the current survey / data release
Parameters: - force – Re-Download locally available data
- timeout – Seconds before timeout for individual files/archives
-
get_available_ids
() → List[str]¶ Return a list of target object IDs for the current survey
Returns: A list of object IDs as strings
-
get_available_tables
() → List[Union[int, str]]¶ Get Ids for available vizier tables published by this data release
-
get_data_for_id
(obj_id: str, format_table: bool = True) → astropy.table.table.Table¶ Returns data for a given object ID
See
get_available_ids()
for a list of available ID values.Parameters: - obj_id – The ID of the desired object
- format_table – Format data into the
sndata
standard format
Returns: An astropy table of data for the given ID
-
iter_data
(verbose: bool = False, format_table: bool = True, filter_func: bool = None) → astropy.table.table.Table¶ Iterate through all available targets and yield data tables
An optional progress bar can be formatted by passing a dictionary of
tqdm
arguments. Outputs can be optionally filtered by passing a functionfilter_func
that accepts a data table and returns a boolean.Parameters: - verbose – Optionally display progress bar while iterating
- format_table – Format data for
SNCosmo
(Default: True) - filter_func – An optional function to filter outputs by
Yields: Astropy tables
-
load_table
(table_id: Union[int, str]) → astropy.table.table.Table¶ Return a Vizier table published by this data release
Parameters: table_id – The published table number or table name
Data Release 3¶
-
class
sndata.csp.
DR3
[source]¶ The
DR3
class provides access to data from the third data release of the Carnegie Supernova Project (CSP) which includes natural-system optical (ugriBV) and near-infrared (YJH) photometry of 134 supernovae (SNe) that were observed in 2004-2009 as part of the first stage of the Carnegie Supernova Project (CSP-I). The sample consists of 123 Type Ia SNe, 5 Type Iax SNe, 2 super-Chandrasekhar SN candidates, 2 Type Ia SNe interacting with circumstellar matter, and 2 SN 2006bt-like events. The redshifts of the objects range from z=0.0037 to 0.0835; the median redshift is 0.0241. For 120 (90%) of these SNe, near-infrared photometry was obtained. (Source: Krisciunas et al. 2017)- Deviations from the standard UI:
- None
- Cuts on returned data:
- None
-
delete_module_data
()¶ Delete any data for the current survey / data release
-
download_module_data
(force: bool = False, timeout: float = 15)¶ Download data for the current survey / data release
Parameters: - force – Re-Download locally available data
- timeout – Seconds before timeout for individual files/archives
-
get_available_ids
() → List[str]¶ Return a list of target object IDs for the current survey
Returns: A list of object IDs as strings
-
get_available_tables
() → List[Union[int, str]]¶ Get Ids for available vizier tables published by this data release
-
get_data_for_id
(obj_id: str, format_table: bool = True) → astropy.table.table.Table¶ Returns data for a given object ID
See
get_available_ids()
for a list of available ID values.Parameters: - obj_id – The ID of the desired object
- format_table – Format data into the
sndata
standard format
Returns: An astropy table of data for the given ID
-
classmethod
get_zp_for_band
(band: str) → str¶ Get the zeropoint for a given band name
Parameters: band – The name of the bandpass
-
iter_data
(verbose: bool = False, format_table: bool = True, filter_func: bool = None) → astropy.table.table.Table¶ Iterate through all available targets and yield data tables
An optional progress bar can be formatted by passing a dictionary of
tqdm
arguments. Outputs can be optionally filtered by passing a functionfilter_func
that accepts a data table and returns a boolean.Parameters: - verbose – Optionally display progress bar while iterating
- format_table – Format data for
SNCosmo
(Default: True) - filter_func – An optional function to filter outputs by
Yields: Astropy tables
-
load_table
(table_id: Union[int, str]) → astropy.table.table.Table¶ Return a Vizier table published by this data release
Parameters: table_id – The published table number or table name
-
register_filters
(force: bool = False)¶ Register filters for this survey / data release with SNCosmo
Parameters: force – Re-register a band if already registered
Dark Energy Survey (DES)¶
The des
module provides access to data from the Dark Energy Survey
(DES). It includes photometric data used in the cosmological analysis from the
first 3 years of spectroscopically classified supernovae (SNe).
Data Release | Class Name | Data Type | Publication |
---|---|---|---|
Third Year Cosmology Release | SN3YR | Photometric | Brout et al. 2019 |
Third Year Cosmology Release¶
-
class
sndata.des.
SN3YR
[source]¶ The
SN3YR
class provides access to data from the first public data release of the Dark Energy Survey Supernova Program, DES-SN3YR. It includes griz light curves of 251 supernovae from the first 3 years of the Dark Energy Survey Supernova Program’s (DES-SN) spectroscopically classified sample. (Source: Brout et al. 2019)- Deviations from the standard UI:
- None
- Cuts on returned data:
- None
-
delete_module_data
()¶ Delete any data for the current survey / data release
-
download_module_data
(force: bool = False, timeout: float = 15)¶ Download data for the current survey / data release
Parameters: - force – Re-Download locally available data
- timeout – Seconds before timeout for individual files/archives
-
get_available_ids
() → List[str]¶ Return a list of target object IDs for the current survey
Returns: A list of object IDs as strings
-
get_available_tables
() → List[Union[int, str]]¶ Get Ids for available vizier tables published by this data release
-
get_data_for_id
(obj_id: str, format_table: bool = True) → astropy.table.table.Table¶ Returns data for a given object ID
See
get_available_ids()
for a list of available ID values.Parameters: - obj_id – The ID of the desired object
- format_table – Format data into the
sndata
standard format
Returns: An astropy table of data for the given ID
-
classmethod
get_zp_for_band
(band: str) → str¶ Get the zeropoint for a given band name
Parameters: band – The name of the bandpass
-
iter_data
(verbose: bool = False, format_table: bool = True, filter_func: bool = None) → astropy.table.table.Table¶ Iterate through all available targets and yield data tables
An optional progress bar can be formatted by passing a dictionary of
tqdm
arguments. Outputs can be optionally filtered by passing a functionfilter_func
that accepts a data table and returns a boolean.Parameters: - verbose – Optionally display progress bar while iterating
- format_table – Format data for
SNCosmo
(Default: True) - filter_func – An optional function to filter outputs by
Yields: Astropy tables
-
load_table
(table_id: Union[int, str]) → astropy.table.table.Table¶ Return a Vizier table published by this data release
Parameters: table_id – The published table number or table name
-
register_filters
(force: bool = False)¶ Register filters for this survey / data release with SNCosmo
Parameters: force – Re-register a band if already registered
Equation of State: Supernovae trace Cosmic Expansion (ESSENCE)¶
The essence
module provides access to data from the Equation of State:
Supernovae trace Cosmic Expansion survey (ESSENCE). It includes spectroscopic
and photometric data published in Foley et al. 2009 and Narayan et al. 2016
respectively.
Data Release | Class Name | Data Type | Publication |
---|---|---|---|
Narayan et al. 2016 | Narayan16 | photometric | Narayan et al. 2016 |
Narayan et al. 2016¶
-
class
sndata.essence.
Narayan16
[source]¶ The
Narayan16
class provides access to photometric data for 213 Type Ia supernovae discovered by the ESSENCE survey at redshifts 0.1 <= z <= 0.81 between 2002 and 2008. It includes R and I band photometry measured from images obtained using the MOSAIC II camera at the CTIO Blanco telescope. (Source: Narayan et al. 2016)- Deviations from the standard UI:
- None
- Cuts on returned data:
- None
-
delete_module_data
()¶ Delete any data for the current survey / data release
-
download_module_data
(force: bool = False, timeout: float = 15)¶ Download data for the current survey / data release
Parameters: - force – Re-Download locally available data
- timeout – Seconds before timeout for individual files/archives
-
get_available_ids
() → List[str]¶ Return a list of target object IDs for the current survey
Returns: A list of object IDs as strings
-
get_available_tables
() → List[Union[int, str]]¶ Get Ids for available vizier tables published by this data release
-
get_data_for_id
(obj_id: str, format_table: bool = True) → astropy.table.table.Table¶ Returns data for a given object ID
See
get_available_ids()
for a list of available ID values.Parameters: - obj_id – The ID of the desired object
- format_table – Format data into the
sndata
standard format
Returns: An astropy table of data for the given ID
-
classmethod
get_zp_for_band
(band: str) → str¶ Get the zeropoint for a given band name
Parameters: band – The name of the bandpass
-
iter_data
(verbose: bool = False, format_table: bool = True, filter_func: bool = None) → astropy.table.table.Table¶ Iterate through all available targets and yield data tables
An optional progress bar can be formatted by passing a dictionary of
tqdm
arguments. Outputs can be optionally filtered by passing a functionfilter_func
that accepts a data table and returns a boolean.Parameters: - verbose – Optionally display progress bar while iterating
- format_table – Format data for
SNCosmo
(Default: True) - filter_func – An optional function to filter outputs by
Yields: Astropy tables
-
load_table
(table_id: Union[int, str]) → astropy.table.table.Table¶ Return a Vizier table published by this data release
Parameters: table_id – The published table number or table name
-
register_filters
(force: bool = False)¶ Register filters for this survey / data release with SNCosmo
Parameters: force – Re-register a band if already registered
Joint Light-Curve Analysis (JLA)¶
The jla
module provides access to supernova data compiled by the
Joint Light-Curve Analysis project. It includes recalibrated light-curves
of type Ia supernova (SN Ia) from the SDSS-II and SNLS collaborations.
Data Release | Class name | Data Type | Publication |
---|---|---|---|
Betoule et al. 2014 | Betoule14 | Photometric | Betoule et al. 2014 |
Betoule et al. 2014¶
-
class
sndata.jla.
Betoule14
[source]¶ The
Betoule14
module provides access to light-curves used in a joint analysis of type Ia supernova (SN Ia) observations obtained by the SDSS-II and SNLS collaborations. The data set includes several low-redshift samples (z<0.1), all 3 seasons from the SDSS-II (0.05 < z < 0.4), and 3 years from SNLS (0.2 <z < 1) and totals 740 spectroscopically confirmed type Ia supernovae with high quality light curves. (Source: Betoule et al. 2014)This data set includes observations taken in the pre 2015 MegaCam filter set used by the Canada-France-Hawaii Telescope (CFHT). These filters were measured at multiple positions by both the observing team and manufacturer. Transmission functions registered by this module represent the average transmission across the filter as reported by the manufacturer.
- Deviations from the standard UI:
- None
- Cuts on returned data:
- None
-
delete_module_data
()¶ Delete any data for the current survey / data release
-
download_module_data
(force: bool = False, timeout: float = 15)¶ Download data for the current survey / data release
Parameters: - force – Re-Download locally available data
- timeout – Seconds before timeout for individual files/archives
-
get_available_ids
() → List[str]¶ Return a list of target object IDs for the current survey
Returns: A list of object IDs as strings
-
get_available_tables
() → List[Union[int, str]]¶ Get Ids for available vizier tables published by this data release
-
get_data_for_id
(obj_id: str, format_table: bool = True) → astropy.table.table.Table¶ Returns data for a given object ID
See
get_available_ids()
for a list of available ID values.Parameters: - obj_id – The ID of the desired object
- format_table – Format data into the
sndata
standard format
Returns: An astropy table of data for the given ID
-
classmethod
get_zp_for_band
(band: str) → str¶ Get the zeropoint for a given band name
Parameters: band – The name of the bandpass
-
iter_data
(verbose: bool = False, format_table: bool = True, filter_func: bool = None) → astropy.table.table.Table¶ Iterate through all available targets and yield data tables
An optional progress bar can be formatted by passing a dictionary of
tqdm
arguments. Outputs can be optionally filtered by passing a functionfilter_func
that accepts a data table and returns a boolean.Parameters: - verbose – Optionally display progress bar while iterating
- format_table – Format data for
SNCosmo
(Default: True) - filter_func – An optional function to filter outputs by
Yields: Astropy tables
-
load_table
(table_id: Union[int, str]) → astropy.table.table.Table¶ Return a Vizier table published by this data release
Parameters: table_id – The published table number or table name
-
register_filters
(force: bool = False)¶ Register filters for this survey / data release with SNCosmo
Parameters: force – Re-register a band if already registered
Lick Observatory Supernova Search (LOSS)¶
The loss
module provides access to supernova data from the Lick
Observatory Supernova Search (LOSS). For the spectroscopic compliment to this
survey, see the bsnip
module.
Data Release | Class Name | Data Type | Publication |
---|---|---|---|
Stahl et al. 2019 | Stahl19 | Photometric | Stahl et al. 2019 |
Ganeshalingam et al. 2013 | Ganeshalingam13 | Photometric | Ganeshalingam et al. 2013 |
Stahl et al. 2019¶
-
class
sndata.loss.
Stahl19
[source]¶ The
Stahl19
class provides access to 93 Type Ia supernovae (SNe Ia) from the second data release of the Lick Observatory Supernova Search (LOSS) conducted between 2005 and 2018. It consists of 78 spectroscopically normal SNe Ia, with the remainder divided between distinct subclasses (3 SN 1991bg-like, 3 SN 1991T-like, 4 SNe Iax, 2 peculiar, and 3 super-Chandrasekhar events), and has a median redshift of 0.0192. The sample has a median coverage of 16 photometric epochs at a cadence of 5.4 d, and the median first observed epoch is ∼4.6 d before maximum B-band light. (Source: Stahl et al. 2019)- Deviations from the standard UI:
- LOSS data files are published without metadata such as ra, dec, or z
- Cuts on returned data:
- None
-
delete_module_data
()¶ Delete any data for the current survey / data release
-
download_module_data
(force: bool = False, timeout: float = 15)¶ Download data for the current survey / data release
Parameters: - force – Re-Download locally available data
- timeout – Seconds before timeout for individual files/archives
-
get_available_ids
() → List[str]¶ Return a list of target object IDs for the current survey
Returns: A list of object IDs as strings
-
get_available_tables
() → List[Union[int, str]]¶ Get Ids for available vizier tables published by this data release
-
get_data_for_id
(obj_id: str, format_table: bool = True) → astropy.table.table.Table¶ Returns data for a given object ID
See
get_available_ids()
for a list of available ID values.Parameters: - obj_id – The ID of the desired object
- format_table – Format data into the
sndata
standard format
Returns: An astropy table of data for the given ID
-
classmethod
get_zp_for_band
(band: str) → str¶ Get the zeropoint for a given band name
Parameters: band – The name of the bandpass
-
iter_data
(verbose: bool = False, format_table: bool = True, filter_func: bool = None) → astropy.table.table.Table¶ Iterate through all available targets and yield data tables
An optional progress bar can be formatted by passing a dictionary of
tqdm
arguments. Outputs can be optionally filtered by passing a functionfilter_func
that accepts a data table and returns a boolean.Parameters: - verbose – Optionally display progress bar while iterating
- format_table – Format data for
SNCosmo
(Default: True) - filter_func – An optional function to filter outputs by
Yields: Astropy tables
-
load_table
(table_id: Union[int, str]) → astropy.table.table.Table¶ Return a Vizier table published by this data release
Parameters: table_id – The published table number or table name
-
register_filters
(force: bool = False)¶ Register filters for this survey / data release with SNCosmo
Parameters: force – Re-register a band if already registered
Ganeshalingam et al. 2013¶
-
class
sndata.loss.
Ganeshalingam13
[source]¶ The
Ganeshalingam13
class provides access to BVRI light curves of 165 objects published by the first data release of the Lick Observatory Supernova Search (LOSS) conducted between 1998 and 2008. (Source: Ganeshalingam et al. 2013)- Deviations from the standard UI:
- None
- Cuts on returned data:
- None
-
delete_module_data
()¶ Delete any data for the current survey / data release
-
download_module_data
(force: bool = False, timeout: float = 15)¶ Download data for the current survey / data release
Parameters: - force – Re-Download locally available data
- timeout – Seconds before timeout for individual files/archives
-
get_available_ids
() → List[str]¶ Return a list of target object IDs for the current survey
Returns: A list of object IDs as strings
-
get_available_tables
() → List[Union[int, str]]¶ Get Ids for available vizier tables published by this data release
-
get_data_for_id
(obj_id: str, format_table: bool = True) → astropy.table.table.Table¶ Returns data for a given object ID
See
get_available_ids()
for a list of available ID values.Parameters: - obj_id – The ID of the desired object
- format_table – Format data into the
sndata
standard format
Returns: An astropy table of data for the given ID
-
classmethod
get_zp_for_band
(band: str) → str¶ Get the zeropoint for a given band name
Parameters: band – The name of the bandpass
-
iter_data
(verbose: bool = False, format_table: bool = True, filter_func: bool = None) → astropy.table.table.Table¶ Iterate through all available targets and yield data tables
An optional progress bar can be formatted by passing a dictionary of
tqdm
arguments. Outputs can be optionally filtered by passing a functionfilter_func
that accepts a data table and returns a boolean.Parameters: - verbose – Optionally display progress bar while iterating
- format_table – Format data for
SNCosmo
(Default: True) - filter_func – An optional function to filter outputs by
Yields: Astropy tables
-
load_table
(table_id: Union[int, str]) → astropy.table.table.Table¶ Return a Vizier table published by this data release
Parameters: table_id – The published table number or table name
-
register_filters
(force: bool = False)¶ Register filters for this survey / data release with SNCosmo
Parameters: force – Re-register a band if already registered
Sloan Digital Sky Survey (SDSS)¶
The sdss
module provides access to supernova data from the Sloan
Digital Sky Survey (SDSS). Please note that access to the photometric and
spectroscopic components of the Sako et al. 2018 data release is provided
by separate modules.
Data Release | Class name | Data Type | Publication |
---|---|---|---|
Sako et al. 2018 | Sako18 | Photometric | Sako et al. 2018 |
Sako et al. 2018 | Sako18Spec | Spectroscopic | Sako et al. 2018 |
Sako et al. 2018 (Photometric)¶
-
class
sndata.sdss.
Sako18
[source]¶ The
Sako18
class provides access to the photometric data release of the Sloan Digital Sky Survey-II (SDSS-II) Supernova Survey conducted between 2005 and 2007. Light curves are presented for 10,258 variable and transient sources discovered through repeat ugriz imaging of SDSS Stripe 82, a 300 deg2 area along the celestial equator. This data release is comprised of all transient sources brighter than r ≃ 22.5 mag with no history of variability prior to 2004. (Source: Sako et al. 2018)For the spectroscopic data of this data release see the
sako18spec
module.- Deviations from the standard UI:
- The
get_outliers
method returns a dictionary of observations visually flagged by the SDSS team as outliers.
- The
- Cuts on returned data:
- Data points manually marked as outliers by the SDSS research time are not included in returned data tables.
-
delete_module_data
()¶ Delete any data for the current survey / data release
-
download_module_data
(force: bool = False, timeout: float = 15)¶ Download data for the current survey / data release
Parameters: - force – Re-Download locally available data
- timeout – Seconds before timeout for individual files/archives
-
get_available_ids
() → List[str]¶ Return a list of target object IDs for the current survey
Returns: A list of object IDs as strings
-
get_available_tables
() → List[Union[int, str]]¶ Get Ids for available vizier tables published by this data release
-
get_data_for_id
(obj_id: str, format_table: bool = True) → astropy.table.table.Table¶ Returns data for a given object ID
See
get_available_ids()
for a list of available ID values.Parameters: - obj_id – The ID of the desired object
- format_table – Format data into the
sndata
standard format
Returns: An astropy table of data for the given ID
-
get_outliers
() → dict[source]¶ Return a dictionary of data points marked by SDSS II as outliers
Returns: [<MJD of bad data point>, …], …} Return type: A dictionary {<obj_id>
-
classmethod
get_zp_for_band
(band: str) → str¶ Get the zeropoint for a given band name
Parameters: band – The name of the bandpass
-
iter_data
(verbose: bool = False, format_table: bool = True, filter_func: bool = None) → astropy.table.table.Table¶ Iterate through all available targets and yield data tables
An optional progress bar can be formatted by passing a dictionary of
tqdm
arguments. Outputs can be optionally filtered by passing a functionfilter_func
that accepts a data table and returns a boolean.Parameters: - verbose – Optionally display progress bar while iterating
- format_table – Format data for
SNCosmo
(Default: True) - filter_func – An optional function to filter outputs by
Yields: Astropy tables
-
load_table
(table_id: Union[int, str]) → astropy.table.table.Table¶ Return a Vizier table published by this data release
Parameters: table_id – The published table number or table name
-
register_filters
(force: bool = False)¶ Register filters for this survey / data release with SNCosmo
Parameters: force – Re-register a band if already registered
Sako et al. 2018 (Spectroscopic)¶
-
class
sndata.sdss.
Sako18Spec
[source]¶ The
Sako18Spec
class provides access to the spectroscopic data release of the Sloan Digital Sky Survey-II (SDSS-II) Supernova Survey conducted between 2005 and 2007. Light curves are presented for 10,258 variable and transient sources discovered through repeat ugriz imaging of SDSS Stripe 82, a 300 deg2 area along the celestial equator. This data release is comprised of all transient sources brighter than r ≃ 22.5 mag with no history of variability prior to 2004. (Source: Sako et al. 2018)For the photometric data of this data release see the
sako18
module.- Deviations from the standard UI:
- None
- Cuts on returned data:
- A spectrum is included in the data release for object
15301
, but no information about this spectra is provided in the spectra summary table (Table 9). This spectrum is ignored. - Seven spectroscopically observed objects are missing a reported Ra,
Dec, and redshift. These include:
13046
,13346
,15833
,17134
,17135
,19819
, and6471
.
- A spectrum is included in the data release for object
-
delete_module_data
()¶ Delete any data for the current survey / data release
-
download_module_data
(force: bool = False, timeout: float = 15)¶ Download data for the current survey / data release
Parameters: - force – Re-Download locally available data
- timeout – Seconds before timeout for individual files/archives
-
get_available_ids
() → List[str]¶ Return a list of target object IDs for the current survey
Returns: A list of object IDs as strings
-
get_available_tables
() → List[Union[int, str]]¶ Get Ids for available vizier tables published by this data release
-
get_data_for_id
(obj_id: str, format_table: bool = True) → astropy.table.table.Table¶ Returns data for a given object ID
See
get_available_ids()
for a list of available ID values.Parameters: - obj_id – The ID of the desired object
- format_table – Format data into the
sndata
standard format
Returns: An astropy table of data for the given ID
-
iter_data
(verbose: bool = False, format_table: bool = True, filter_func: bool = None) → astropy.table.table.Table¶ Iterate through all available targets and yield data tables
An optional progress bar can be formatted by passing a dictionary of
tqdm
arguments. Outputs can be optionally filtered by passing a functionfilter_func
that accepts a data table and returns a boolean.Parameters: - verbose – Optionally display progress bar while iterating
- format_table – Format data for
SNCosmo
(Default: True) - filter_func – An optional function to filter outputs by
Yields: Astropy tables
-
load_table
(table_id: Union[int, str]) → astropy.table.table.Table¶ Return a Vizier table published by this data release
Parameters: table_id – The published table number or table name
Supernova Legacy Survey (SNLS)¶
The snls
module provides access to data from the Supernova Legacy
Survey. It includes data from the data release of Balland et al. 2009.
Data Release | Class name | Data Type | Publication |
---|---|---|---|
Balland et al. 2009 | Balland09 | Spectroscopic | Balland et al. 2009 |
Balland et al. 2009¶
-
class
sndata.snls.
Balland09
[source]¶ The
Balland09
class provides access to to the three year data release of the Supernova Legacy Survey (SNLS) performed by the Canada-France-Hawaii Telescope (CFHT). It includes 139 spectra of 124 Type Ia supernovae that range from z = 0.149 to z = 1.031 and have an average redshift of z = 0.63 +/- 0.02. (Source: Balland et al. 2009)- Deviations from the standard UI:
- Time values returned in units of phase and not observed Julian date.
- Cuts on returned data:
- None
-
delete_module_data
()¶ Delete any data for the current survey / data release
-
download_module_data
(force: bool = False, timeout: float = 15)¶ Download data for the current survey / data release
Parameters: - force – Re-Download locally available data
- timeout – Seconds before timeout for individual files/archives
-
get_available_ids
() → List[str]¶ Return a list of target object IDs for the current survey
Returns: A list of object IDs as strings
-
get_available_tables
() → List[Union[int, str]]¶ Get Ids for available vizier tables published by this data release
-
get_data_for_id
(obj_id: str, format_table: bool = True) → astropy.table.table.Table¶ Returns data for a given object ID
See
get_available_ids()
for a list of available ID values.Parameters: - obj_id – The ID of the desired object
- format_table – Format data into the
sndata
standard format
Returns: An astropy table of data for the given ID
-
iter_data
(verbose: bool = False, format_table: bool = True, filter_func: bool = None) → astropy.table.table.Table¶ Iterate through all available targets and yield data tables
An optional progress bar can be formatted by passing a dictionary of
tqdm
arguments. Outputs can be optionally filtered by passing a functionfilter_func
that accepts a data table and returns a boolean.Parameters: - verbose – Optionally display progress bar while iterating
- format_table – Format data for
SNCosmo
(Default: True) - filter_func – An optional function to filter outputs by
Yields: Astropy tables
-
load_table
(table_id: Union[int, str]) → astropy.table.table.Table¶ Return a Vizier table published by this data release
Parameters: table_id – The published table number or table name
Sweetspot¶
The sweetspot
module provides access to data from the Sweetspot survey
Data Release | Class Name | Data Type | Publication |
---|---|---|---|
Data Release 1 | DR1 | Photometric | Weyant et al. 2018 |
Data Release 1¶
-
class
sndata.sweetspot.
DR1
[source]¶ SweetSpot is a 3 yr National Optical Astronomy Observatory (NOAO) survey program to observe Type Ia supernovae (SNe Ia) in the smooth Hubble flow. DR1 includes data from the first half of this survey, including SNe Ia observed in the rest-frame near-infrared (NIR) in the range 0.02 < z < 0.09. Because many observed supernovae require host-galaxy subtraction from templates taken in later semesters, this release contains only the 186 NIR (JHK s ) data points for the 33 SNe Ia that do not require host-galaxy subtraction. (Source: Weyant et al. 2018)
- Deviations from the standard UI:
- None
- Cuts on returned data:
- None
-
delete_module_data
()¶ Delete any data for the current survey / data release
-
download_module_data
(force: bool = False, timeout: float = 15)¶ Download data for the current survey / data release
Parameters: - force – Re-Download locally available data
- timeout – Seconds before timeout for individual files/archives
-
get_available_ids
() → List[str]¶ Return a list of target object IDs for the current survey
Returns: A list of object IDs as strings
-
get_available_tables
() → List[Union[int, str]]¶ Get Ids for available vizier tables published by this data release
-
get_data_for_id
(obj_id: str, format_table: bool = True) → astropy.table.table.Table¶ Returns data for a given object ID
See
get_available_ids()
for a list of available ID values.Parameters: - obj_id – The ID of the desired object
- format_table – Format data into the
sndata
standard format
Returns: An astropy table of data for the given ID
-
classmethod
get_zp_for_band
(band: str) → str¶ Get the zeropoint for a given band name
Parameters: band – The name of the bandpass
-
iter_data
(verbose: bool = False, format_table: bool = True, filter_func: bool = None) → astropy.table.table.Table¶ Iterate through all available targets and yield data tables
An optional progress bar can be formatted by passing a dictionary of
tqdm
arguments. Outputs can be optionally filtered by passing a functionfilter_func
that accepts a data table and returns a boolean.Parameters: - verbose – Optionally display progress bar while iterating
- format_table – Format data for
SNCosmo
(Default: True) - filter_func – An optional function to filter outputs by
Yields: Astropy tables
-
load_table
(table_id: Union[int, str]) → astropy.table.table.Table¶ Return a Vizier table published by this data release
Parameters: table_id – The published table number or table name
-
register_filters
(force: bool = False)¶ Register filters for this survey / data release with SNCosmo
Parameters: force – Re-register a band if already registered
sndata¶
The sndata
package provides access to supernova light-curve data from
various surveys while maintaining a consistent data access interface. Each
available survey is represented by a dedicated submodule. Each available
data release is represented by a dedicated class.
Submodules¶
base_classes |
The base_classes module defines parent classes used by the data access API to define basic data handling and to enforce a consistent user interface. |
exceptions |
This module defines custom exceptions. |
utils |
The utils module provides an assorted collection of general utilities used when building data access classes for a given survey / data release. |
csp |
The csp module provides access to data from the Carnegie Supernova Project (CSP). |
des |
The des module provides access to data from the Dark Energy Survey (DES). |
essence |
The essence module provides access to data from the Equation of State: Supernovae trace Cosmic Expansion survey (ESSENCE). |
jla |
The jla module provides access to supernova data compiled by the Joint Light-Curve Analysis project. |
loss |
The loss module provides access to supernova data from the Lick Observatory Supernova Search (LOSS). |
sdss |
The sdss module provides access to supernova data from the Sloan Digital Sky Survey (SDSS). |
snls |
The snls module provides access to data from the Supernova Legacy Survey. |
sweetspot |
The sweetspot module provides access to data from the Sweetspot survey |
sndata.base_classes¶
The base_classes
module defines parent classes used by the data access
API to define basic data handling and to enforce a consistent user interface.
For an example on how to use these classes to create custom data access module
for a new survey / data release, see the Creating Custom Data Classes section of the
docs.
VizierTables¶
-
class
sndata.base_classes.
DefaultParser
[source]¶ Prebuilt data parsing tools for Vizier tables and photometric filters
For more information see the Creating Custom Data Classes section of the docs.
-
_get_available_tables
() → List[Union[int, str]][source]¶ Default backend functionality of
get_available_tables
function
-
SpectroscopicRelease¶
-
class
sndata.base_classes.
SpectroscopicRelease
(survey_abbrev: str = None, release: str = None)[source]¶ Generic representation of a spectroscopic data release
This class is a template designed to enforce a consistent user interface and requires child classes to fill in incomplete functionality.
-
download_module_data
(force: bool = False, timeout: float = 15)[source]¶ Download data for the current survey / data release
Parameters: - force – Re-Download locally available data
- timeout – Seconds before timeout for individual files/archives
-
get_available_ids
() → List[str][source]¶ Return a list of target object IDs for the current survey
Returns: A list of object IDs as strings
-
get_available_tables
() → List[Union[int, str]][source]¶ Get Ids for available vizier tables published by this data release
-
get_data_for_id
(obj_id: str, format_table: bool = True) → astropy.table.table.Table[source]¶ Returns data for a given object ID
See
get_available_ids()
for a list of available ID values.Parameters: - obj_id – The ID of the desired object
- format_table – Format data into the
sndata
standard format
Returns: An astropy table of data for the given ID
-
iter_data
(verbose: bool = False, format_table: bool = True, filter_func: bool = None) → astropy.table.table.Table[source]¶ Iterate through all available targets and yield data tables
An optional progress bar can be formatted by passing a dictionary of
tqdm
arguments. Outputs can be optionally filtered by passing a functionfilter_func
that accepts a data table and returns a boolean.Parameters: - verbose – Optionally display progress bar while iterating
- format_table – Format data for
SNCosmo
(Default: True) - filter_func – An optional function to filter outputs by
Yields: Astropy tables
-
PhotometricRelease¶
-
class
sndata.base_classes.
PhotometricRelease
(survey_abbrev: str = None, release: str = None)[source]¶ Generic representation of a photometric data release
This class is a template designed to enforce a consistent user interface and requires child classes to fill in incomplete functionality.
sndata.utils¶
The utils
module provides an assorted collection of general utilities
used when building data access classes for a given survey / data release.
-
sndata.utils.
build_pbar
(data: iter, verbose: Union[bool, dict])[source]¶ Cast an iterable into a progress bar
If verbose is False, return
data
unchanged.Parameters: - data – An iterable object
- verbose – Arguments for tqdm.tqdm
-
sndata.utils.
download_file
(url: str, destination: Union[str, pathlib.Path, IO] = None, force: bool = False, timeout: float = 15, verbose: bool = True)[source]¶ Download content from a url to a file
If
destination
is a path but already exists, skip the download unlessforce
is alsoTrue
.Parameters: - url – URL of the file to download
- destination – Path or file object to download to
- force – Re-Download locally available data (Default: False)
- timeout – Seconds before raising timeout error (Default: 15)
- verbose – Print status to stdout
-
sndata.utils.
download_tar
(url: str, out_dir: str, mode: str = 'r:gz', force: bool = False, timeout: float = 15, skip_exists: str = None)[source]¶ Download and unzip a .tar.gz file to a given output directory
Parameters: - url – URL of the file to download
- out_dir – The directory to unzip file contents to
- mode – Compression mode (Default: r:gz)
- force – Re-Download locally available data (Default: False)
- timeout – Seconds before raising timeout error (Default: 15)
- skip_exists – Optionally skip the download if given path exists
-
sndata.utils.
find_data_dir
(survey_abbrev: str, release: str) → pathlib.Path[source]¶ Determine the directory where data files are stored for a data release
If the directory does not exist, create it.
Parameters: - survey_abbrev – Abbreviation of the survey to load data for (e.g., CSP)
- release – Name of the data release from the survey (e.g., DR1)
Returns: The path of the directory where
-
sndata.utils.
hourangle_to_degrees
(rah: float, ram: float, ras: float, dec_sign: str, decd: float, decm: float, decs: float) -> (<class 'float'>, <class 'float'>)[source]¶ Convert from hour angle to degrees
Parameters: - rah – RA hours
- ram – RA arcminutes
- ras – RA arcseconds
- dec_sign – Sign of the declination (‘+’ or ‘-‘)
- decd – Dec degrees
- decm – Dec arcmin
- decs – Dec arcsec
-
sndata.utils.
lru_copy_cache
(maxsize: int = 128, typed: bool = False, copy: bool = True)[source]¶ Decorator to cache the return of a function
Similar to
functools.lru_cache
, but allows a copy of the cached value to be returned, thus preventing mutation of the cache.Parameters: - maxsize – Maximum size of the cache
- typed – Cache objects of different types separately (Default: False)
- copy – Return a copy of the cached item (Default: True)
Returns: A decorator
-
sndata.utils.
read_vizier_table_descriptions
(readme_path: Union[pathlib.Path, str])[source]¶ Returns the table descriptions from a vizier readme file
Parameters: readme_path – Path of the file to read Returns: <Table description (str)>} Return type: A dictionary {<Table number (int)>
-
sndata.utils.
register_filter_file
(file_path: str, filter_name: str, force: bool = False)[source]¶ Registers filter profiles with sncosmo if not already registered
Assumes the file at
file_path
is a two column, white space delimited ascii table.Parameters: - file_path – Path of ascii table with wavelength (Ang) and transmission
- filter_name – The name of the registered filter.
- force – Whether to re-register a band if already registered