Skip to content

Reverse engineer astronomical spectra into pretty rainbow pictures with Python

License

Notifications You must be signed in to change notification settings

labjg/spectrify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spectrify

Reverse engineer astronomical spectra into pretty rainbow pictures with Python

Prerequisites:

  • Python Imaging Library ('PIL')
  • NumPy

The class in 'spectrify.py' takes a 2D NumPy array of spectral values (wavelength, counts) and 'reverse engineers' the data to produce a visible spectrum image vaguely like what came out of the telescope spectrograph. It is intended for more intuitive visualisation of spectra for public outreach etc.

Actually, any image can be provided - the idea is that the image shows a linear progression of colours within a (specified) wavelength range.

The code rescales, truncates and interpolates the spectral data so that it can be pasted over the 'rainbow' image as a mask, where colours with few counts are opaque and colours with the most counts are transparent. The user can specify the output resolution of the image and a file path for saving.

About

Reverse engineer astronomical spectra into pretty rainbow pictures with Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages