Skip to main content

Python Package for SDSS Composite Spectra

Project description

CoSpecPy - SDSS Composites Made Easy

This is a package written for the purpose of creating composite spectra from SDSS data releases.

Future releases will contain additional features for plotting and uncertainty information. Connections to astropy Tables and queries are also a possibility.

Full documentation for this project can be found at https://cospecpy.readthedocs.io/en/latest/

Install Instructions

Requires a Python version later than 3.6.

Install using pip available through:

pip install CoSpecPy

Or alternatively you can clone this GitHub repository, navigate to the directory you have just cloned and run:

python setup.py install

Quick Start

Here are a couple of examples using the early stages of the Composite and DownloadHandler classes. We can create spectra using the example 50 SDSS URLs provided or by specifying the RA and DEC of your targets of interest. Make sure that either wget or aria2 is installed on your machine.

from CoSpecPy import DownloadHandler, Composite # Import the Handler

output_dir = "/path/to/output"

ra = [] # Input you ra values here
dec = [] # Input you dec values here

example_handler = DownloadHandler(download_method = "wget", #Download method (aria2 or wget)
no_of_connections = 1, batch_size="10", #Connections only apply to aria2, batches not implemented
 download_folder=output_dir) # output folder

#Example download with wget
example_handler.download_example()

#This will download the 50 example spectra in CoSpecPy/data/example_speclist.txt to your chosen output

example_composite = Composite(name = "example_composite") #Creation of Composite Class
example_composite.set_wavelength_grid(w_min = 1000, w_max = 3000, steps = 2500) #Add the desired wavelength grid in Angstrom
example_composite.set_normalisation(norm_low = 2575, norm_high = 2625) #Add desired normalisation range in Angstrom
example_composite.composite_from_downloads(output_dir) # Will create the composite
example_composite.plot_composite() # Plots the composite stored in the composite class with bootstrapped uncertainties

# Now rest and create using the ra and dec list
example_composite.reset_composite()
example_composite.composite_from_coords(ra, dec) # Will download SDSS DR14 catalogue if not already present (~750 MB)
example_composite.plot_composite()

Output should look something like this

./example.png

Download Dependencies

The DownloadHandler requires use of either wget or aria2 to download from the SDSS servers.

wget is GNU Wget is a free software package for retrieving files using HTTP, HTTPS, FTP and FTPS. Information and documentation can be found here https://www.gnu.org/software/wget/. For a quick Debian/Ubuntu install try:

sudo apt-get install wget

aria2 is a lightweight multi-protocol & multi-source command-line download utility and can be far faster than wget when used with this package. Information and documentation can be found here https://aria2.github.io/. For a quick Debian/Ubuntu install try:

sudo apt-get install -y aria2

Features Implemented

  • Download of spectra list using either aria2 or wget. aria2 allows for easy opening of multiple connections for a much faster download.

  • Example included with DownloadHandler.download_example()

  • Batch-split downloads given spectra list

  • Spectral composite making from downloads - Options for wavelength grid, normalisation range, uncertainty estimation, plotting

  • Helper functions to go from an astropy.Table through to composite making

Future Features

  • Possible inclusion of SDSS querying to create the fetch information for speclist
  • Long-term, add external features such as redenning estimation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

CoSpecPy-0.5.tar.gz (10.9 kB view details)

Uploaded Source

File details

Details for the file CoSpecPy-0.5.tar.gz.

File metadata

  • Download URL: CoSpecPy-0.5.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.10

File hashes

Hashes for CoSpecPy-0.5.tar.gz
Algorithm Hash digest
SHA256 e3d26f14325664cd47bfe1c42b75aee0d9cdb31a2754eeb3fa7f37f9f85649bf
MD5 ad36ba737b63269bce2e4ae838095ada
BLAKE2b-256 2320beeb172cbd593cd55cd0a88839502f7139b36bb7600072c54e4a040482ac

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page