Tuesday, June 28, 2011

Good things to know...

Reading in .fits files, file=mrdfits('filename.fits',1)
dwave/wave = v/c
when you have shift in pixels, shift*69.02 = radial velocity
blah=spline(template wave, template flux, spectrum wave) for interpolating
for cross correlating, xcorl, flux, blah, range, shift where the range is the size of the area that xcorl tries to fit, shift is just the shift in pixels, blah is obviously the result from interpolation
Good line for Mdwarfs, sodium at 8183.2556 and 8194.7904
Hydrogen alpha at 6562.8 will tell whether the mdwarf is magnetically active or not (these are air wavelengths)
ps aux | grep idl -> lists all processes and pipes to grep to find IDL processes
kill process_id
kill -9 process_id -> kills the process no matter what
ls * > file_name.dat -> makes a file with the names of the contents of whatever directory you're in

Correlating Spectra, Calculating radial velocities and Screwing Up

In order to find radial velocities for my stars, I have to first figure out which spectral type each star is using a program called Hammer which is a really cool program that first auto types each star and then allows you to go back through and match a template to your spectrum. The template is just a whole bunch of spectra averaged together so that it's basically what you're typical typed star will look like.
This template is for a latish type M-dwarf star, probably an M6 or M7:

Typical template spectrum averaged over many many spectra.
        Although this looks very jagged, if you zoom in on a spectral feature, say the Sodium lines at 8183.2556 and 8194.7904 Angstroms, you will see a very smooth feature. So if you match these up to one of my M6 or M7 spectra, you can see a shift in the spectral features which comes about from the fact that as an object moves away from us, the light we observe from it has lengthened wavelengths (redshifted) or vice verse if it is moving towards us then the observed light has shortened wavelengths (blueshifted). This will shift my spectra either left or right depending on the direction of the velocity (away or toward) and so using this template spectra we can see a shift (if zoomed in enough). Here's an example of a shift in the Sodium lines, although slightly hard to see because my spectrum isn't as smooth as the template one:
The two smooth red dips are from the template and you can see the dips poorly reproduced and slightly shifted to the right of the template.
As I've found out (the difficult way) coding to match spectra and to find radial velocities can be somewhat difficult as there are many ways to screw up the code. My problem, it turned out, was easily mendable, but produced some wonky results (wonky being the scientific word for screwed up). As it turned out I was reading in a list of spectra names from a file that didn't match the spectra (the order with which I was reading in the names wasn't the order that the spectra were in), so I ended up matching some spectra with templates that didn't make sense like matching an M0 spectrum with a M7 template so on and so forth. This can look as "wonky" as this:
The green being an M7 or M8 template spectrum and the white being my probably K7 dwarf which is fairly spectroscopically similar to an M0.

All in all, it's been quite a learning process, especially in terms of learning IDL (the coding language we use) and now I also feel like I can probably look at any M-dwarf and spectral type it pretty accurately. This concludes this portion of my research (the radial velocity portion that is), now it's on to calculating the strength of Hydrogen alpha emission, woot.

And thanks to Kevin Covey for taking these spectra at the Apache Point Observatory!