diff --git a/.gitignore b/.gitignore index 0baeb313..36c26818 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,7 @@ build/ dist/ # Light Curve Data -sndata/sweetspot/whircs +sndata/data # Testing cache files .pytest_cache/ diff --git a/docs/source/change_log.rst b/docs/source/change_log.rst index c2aedeb2..65504f21 100644 --- a/docs/source/change_log.rst +++ b/docs/source/change_log.rst @@ -4,6 +4,11 @@ Change Log This page documents any API changes between different versions of the ``sndata`` package. +V 1.1.1 +------- + +- Fixes bug where existing data is not skipped during download by default. + V 1.1.0 ------- diff --git a/docs/source/conf.py b/docs/source/conf.py index 9673511d..5fc23580 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -26,7 +26,7 @@ author = 'Daniel Perrefort' # The short X.Y version -version = '1.0.0' +version = '1.1.1' # The full version, including alpha/beta/rc tags release = version diff --git a/docs/source/index.rst b/docs/source/index.rst index 712f72eb..7910c54a 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -55,6 +55,10 @@ data release may have from the rest of the package. In general you should: 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 | +======================================================+==========================+===============+ @@ -68,8 +72,6 @@ Available Data +------------------------------------------------------+--------------------------+---------------+ + Joint Light-Curve Analysis | `Betoule et al. 2014`_ | Photometric | +------------------------------------------------------+--------------------------+---------------+ -+ Lick Observatory Supernova Search | `Stahl et al. 2019`_ | Photometric | -+------------------------------------------------------+--------------------------+---------------+ | | `Sako et al. 2018`_ | Photometric | + Sloan Digital Sky Survey +--------------------------+---------------+ | | `Sako et al. 2018`_ | Spectroscopic | @@ -79,6 +81,7 @@ Available Data + Sweetspot | `Weyant et al. 2018`_ | Photometric | +------------------------------------------------------+--------------------------+---------------+ +.. _Server Status Page: https://stats.uptimerobot.com/gQ8lkslGWO .. _DR1: https://csp.obs.carnegiescience.edu/news-items/CSP_spectra_DR1 .. _DR3: https://csp.obs.carnegiescience.edu/news-items/csp-dr3-photometry-released .. _SN3YR: https://des.ncsa.illinois.edu/releases/sn diff --git a/sndata/__init__.py b/sndata/__init__.py index a53c3d16..0ab37203 100644 --- a/sndata/__init__.py +++ b/sndata/__init__.py @@ -10,7 +10,7 @@ from . import * from ._combine_data import CombinedDataset, get_zp -__version__ = '1.1.0' +__version__ = '1.1.1' __author__ = 'Daniel Perrefort' __license__ = 'GPL 3.0' diff --git a/sndata/utils.py b/sndata/utils.py index 42852419..2e18db4d 100644 --- a/sndata/utils.py +++ b/sndata/utils.py @@ -180,14 +180,11 @@ def download_file( verbose: Print status to stdout """ - response = requests.get(url, timeout=timeout) - response.raise_for_status() - if file_obj is None: if path is None: raise ValueError('Must specify either ``path`` or ``file_obj``') - # Skip downcload if file already exists or url unavailable + # Skip download if file already exists or url unavailable path = Path(path) if not (force or not path.exists()): return @@ -195,10 +192,12 @@ def download_file( path.parent.mkdir(parents=True, exist_ok=True) file_obj = open(path, 'wb') - # Establish remote connection if verbose: print(f'Fetching {url}') + # Establish remote connection + response = requests.get(url, timeout=timeout) + response.raise_for_status() file_obj.write(response.content) if path: