Skip to content

Commit

Permalink
Docs updates, data downloader
Browse files Browse the repository at this point in the history
  • Loading branch information
bmorris3 committed Dec 2, 2017
1 parent 9505a75 commit 97989ae
Show file tree
Hide file tree
Showing 5 changed files with 197 additions and 43 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ Clone this repository:
```bash
git clone https://github.com/bmorris3/mrspoc.git
```
Run this command to download a local copy of the required TGAS data, Hipparcos,
and interferometric radius tables:
```
cd mrspoc
python download_data.py
```
You can delete the data archive `data.tar.gz`.

Create an environment variable that contains the path to the `data/` directory,
called `MRSPOC_DATA_DIR`. For example, add the following line to your `~/.cshrc`:
```
Expand Down
38 changes: 0 additions & 38 deletions docs/details.rst

This file was deleted.

23 changes: 23 additions & 0 deletions download_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""
Download and extract the data archive from the web.
"""

import tarfile
import os
from urllib.request import urlretrieve

data_archive_path = 'data.tar.gz'
data_archive_url = 'http://staff.washington.edu/bmmorris/docs/data.tar.gz'
p = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data')

# Write local copy of the data archive:
print('Downloading (150 MB) and extracting data to "{0}"...'.format(p))
urlretrieve(data_archive_url, data_archive_path)

# Extract all files from the gzipped tar archive
with tarfile.open(data_archive_path, 'r|gz') as f:
f.extractall()

# Remind the user to set an environment variable:
print('Now set an environment variable "MRSPOC_DATA_DIR" to the path to the '
'data, directory {0}'.format(p))
21 changes: 16 additions & 5 deletions notebooks/spot_contrasts.ipynb

Large diffs are not rendered by default.

0 comments on commit 97989ae

Please sign in to comment.