Introduction to sdss_access

SDSS Access provides a convenient way of navigating local and remote filesystem paths from the Science Archive Server (SAS). sdss_access uses the SDSS Tree product for all path look-ups.

Path Generation

You can generate full paths to files easily with Path.full:

# import the path
from sdss_access import SDSSPath
path = SDSSPath()

# generate a file system path
path.full('mangacube', drpver='v2_3_1', plate='8485', ifu='1901')
'/Users/Brian/Work/sdss/sas/mangawork/manga/spectro/redux/v2_3_1/8485/stack/manga-8485-1902-LOGCUBE.fits.gz'

Note that this only generates a path. The file may not actually exist locally. If you want to generate a URL path to the file at Utah, you can use Path.url:

# generate a http path to the file
path.url('mangacube', drpver='v2_3_1', plate='8485', ifu='1901')
'https://data.sdss.org/sas/mangawork/manga/spectro/redux/v2_3_1/8485/stack/manga-8485-1902-LOGCUBE.fits.gz'

You can download files from the SAS and place them in your local SAS. sdss_access expects a local SAS filesystem that mimics the real SAS at Utah. If you do not already have a SAS_BASE_DIR set, one will be defined in your home directory, as a new sas directory.

Downloading Files

Using the HttpAccess package.

from sdss_access import HttpAccess
http_access = HttpAccess(verbose=True)

# set to use remote
http_access.remote()

# get th file
http_access.get('mangacube', drpver='v2_3_1', plate='8485', ifu='1901')

Using the RsyncAccess package. RsyncAccess is generally much faster then HttpAccess as it spreads multiple file downloads across multiple continuous rsync download streams.

# import the rsync package
from sdss_access import RsyncAccess
rsync = RsyncAccess()

# sets a remote mode to the real SAS
rsync.remote()

# add all the file(s) you want to download
# let's download all MPL-6 MaNGA cubes for plate 8485
rsync.add('mangacube', drpver='v2_3_1', plate='8485', ifu='*')

# set the stream tasks
rsync.set_stream()

# start the download(s)
rsync.commit()

Reference/API

Class

sdss_access.path.Path([mirror, public, verbose]) Class for construction of paths in general.
sdss_access.HttpAccess([verbose]) Class for providing HTTP access via urllib.request (python3) or urllib2 (python2) to SDSS SAS Paths
sdss_access.RsyncAccess([label, …]) Class for providing Rsync access to SDSS SAS Paths

Methods

sdss_access.SDSSPath.full(filetype, **kwargs) Return the full name of a given type of file.
sdss_access.SDSSPath.url(filetype[, …]) Return the url of a given type of file.
sdss_access.HttpAccess.remote([remote_base, …]) Configures remote access
sdss_access.HttpAccess.get(filetype, **kwargs) Returns file name, downloading if remote access configured.
sdss_access.RsyncAccess.remote([username, …]) Configures remote access
sdss_access.RsyncAccess.add(filetype, **kwargs) Adds a filepath into the list of tasks to download
sdss_access.RsyncAccess.set_stream() Sets the download streams
sdss_access.RsyncAccess.commit([offset, …]) Start the rsync download