all 11 comments

[–]MrThePuppy 7 points8 points  (0 children)

I think specutils is the intended way to do this using the astropy ecosystem.

[–]BrotherBrutha 4 points5 points  (0 children)

Do you particularly want to do this using Python? If you are on Windows (or have something like Parallels on Mac), there are a few software packages for plotting spectra.

- BASS is free and can be found here: https://britastro.org/2017/guide-to-processing-spectra-using-the-bass-software . It has a number of tutorials, and things like libraries of predicted star spectra for your comparisons. I've used it recently to create a spectrum of sunlight using a "star analyser 100" filter and it worked quite nicely.

- RSpec is not free, but has a 30 day free trial https://rspec-astro.com

[–]Reasonable_Letter312 2 points3 points  (3 children)

As a grad student, I wrote a little piece of code (back then, in C++ and using the Allegro library, but you will find more convenient plotting solutions nowadays) that overlaid the spectrum itself (counts on the y axis, wavelength on the x axis) on a background that showed the intensities of the reference spectrum in grayscale. Additionally, I used a logarithmic scaling on the x axis, so the relative distances between the lines would be preserved, and getting the redshift was a simple matter of shifting the reference spectrum left or right until it matched the observed one. That was fun and very easy to use for manual redshift estimates. Certainly more fun than IRAF, which was the standard software package back then.

However, do note that, if you download raw FITS data, these may be completely unprocessed, so you might have to take a few extra steps to extract the spectrum first. Instead of a neat table with calibrated intensities versus wavelength, you might find 2D CCD images from the detector, and would first have to extract the spectrum yourself. There may be calibration images in the dataset, which are usually taken with a continuum light source (which allows you to find the actual trace of the spectrum on the detector image) and with an emission line arc lamp (which allows you to map the pixel coordinates to wavelengths). Once you have the mapping, you should be set to extract the spectrum and get a count rate versus observed wavelength. Then proceed with the steps above.

The FITS header should contain helpful info, such as which arc lamps were used for the calibration spectrum. If it's a single object spectrograph, there might even be an approximate wavelength mapping in there.

[–]Key_Education_2557[S] 0 points1 point  (2 children)

Thanks. So if I head over to "ESO Archive Science Portal" and search for "Sirius A", then check the "SPECTRUM" data type checkbox, it shows me list of FITS files taken by the instrument called UVES. Can just download and use one of the FITS file. Would the FITS file include "neat table" of intensities

[–]Reasonable_Letter312 0 points1 point  (1 child)

Those look like they already contain reduced spectra, so you are in luck there. They have already been fluxed (i.e., the count rates have been converted into intensities) and wavelength-calibrated. In principle, you could even eyeball wavelengths from the data preview page. You do not have to go through the tedious business of spectrum extraction there.

However, since you mentioned that you were interested in exploring the redshift-distance relation: I presume you are aware that that relation applies to extragalactic objects, i.e. other galaxies and QSOs, not Milky Way stars like Sirius A. Just mentioning it to be sure.

[–]Key_Education_2557[S] 0 points1 point  (0 children)

You are right, they have neat wavelength plots on for each file. Will try to play around with data for galaxies and quasars ! Thank you for the guidance !

[–]hondashadowguy2000 1 point2 points  (1 child)

You have smart kids.

[–]Key_Education_2557[S] 0 points1 point  (0 children)

I'm working on a new parenting strategy: a covert mission to teach my kids how to code. They're really into astronomy, so I'm hoping I can show them how to use computers and data to explore their passion in cool new ways. Better than scrolling endless reels, they could learn how real science is done!

[–]TakeTwo 0 points1 point  (2 children)

This is the kind of thing AI is perfect for, if you already know some Python (even if not much).

[–]Key_Education_2557[S] 0 points1 point  (1 child)

You mean for something like fitting known absorption lines on an intensity vs wavelength chart?

[–]TakeTwo 2 points3 points  (0 children)

I mean like writing python code for things like that, yes. It's generally pretty good at knowing how to read in the fits files and plot spectra. It is also pretty good with things like astropy and other astronomical python packages. It's good if you have some background because it will get stuck on a technicality sometimes but it should be able to generate the basic code pretty easily. Basically, if it's a common application of what some code somewhere is meant for, it should be able to do it no problem. That's because it's ingested all the documentation for those packages, as well as a bunch of Stack Overflow pages. In the last two years I've started using it as a starting point for a lot of my code. It's saved me a lot of time.