Tuesday, June 7, 2011

oh, cosmic rays

I never thought cosmic rays would ever give me such trouble.

Before I can actually put templates to the M dwarf and white dwarf binary spectra, I have to get rid of the effects of cosmic rays. For about 20 or so pixels out of 3000 for any given spectrum, there is cosmic ray interference, causing the flux values at these wavelengths to be extremely large. In order to have a proper fit with the templates, these flux values need to seem normal for the given dwarf. Luckily there is a category titled 'mask' in the spectra files; if mask =1, then there is cosmic ray interference, if mask = 0, then flux isn't tampered with.

But because we're using templates that need to match the binary spectra, we can't just set the flux to 0 at these points; we need to have it somewhat match the rest of the spectra. To do this, we should be able to take the average of the flux values on either side of the pixel with mask =1 EXCEPT for the fact that there may be two or three pixels in a row with mask =1.

So while this should be an easy task: write a little code that searches for the closest pixel with mask value =0, and take the average, it is proving slightly more difficult.

Maybe it's because I'm having an off day (being sick is the worst), but for the life of me, I can't figure out the way to do this properly. I've ended up kind of screwing around with for, if, while statements in order to get the right code. At the moment, I have it just automated to do the average on each side of the pixel with mask =1. Hopefully tomorrow morning I'll be able to focus more and just quickly get this done.

Monday, June 6, 2011

M dwarf velocity code automated!

So I fixed my if/else statements, debugged here and there, and my code is now automated!

The program takes selected M dwarfs from Andrew's DR7 file, pulls the corresponding spectra from SDSS, matches it up with the appropriate template (based on spectral type), and calculates the shifts in spectra. This means that using this program, you can choose any set of M dwarfs from Andrew's DR7 file, and calculate their radial velocities (and compare them to the catalogued radial velocities).

So now that I've done this for individual M dwarfs, we can apply this same process to analyzing M dwarf and white dwarf binaries. Because the WD will take up the bluer end of the spectrum, I've written the code so that the velocity shifts are calculated using only the redder end of the spectrum (between 7200-8800 Angstroms), so as not to interfere with the WD.

Because there are multiple exposures from SDSS data, for close WD-Md pairs (which are moving very fast), we can calculate the velocity from the changes between exposures.

Tomorrow, I will focus on reading in the spectrum of a single WD-Md pair, and doing a similar process for the binary pair, then once that looks good, automating it. Andrew pointed out that I have to be careful as there is cosmic ray interference with some of the spectra I will be using. (It sounds really cool, but will be kind of a pain to deal with).

We had our first group meeting this afternoon -- It was great hearing about what everyone is working on.

Friday, June 3, 2011




(I've decided to do a little bit more on making this blog accessible. While it does serve as my lab notebook at times, I think it would be nice to have the blog written as clearly as possible.)

Looking back, I've done quite a few things today.

I came in needing to fix my spline procedure in order to coordinate my sample spectrum and template. From that I could use the xcorl procedure to return a shift value, which when converted to km/s from pixels (multiply by 69.1), returns the change in velocity.

Below, you can see the finished plot of a sample dM5 spectrum along with its template (blue = sample, black = template).

.....
At the moment I am trying to automate my velocity calculation process so that you can just change the initial indexing number for the first fits file (indicating which SDSS spectrum you are selecting), and then end up with a velocity calculation.

This currently includes the task of automating my file names so that after getting the spectra from SDSS, the corresponding wavelength and flux data can be pulled. As the wavelength and flux data is categorized by file names that directly pertain to the fiber, mjd, and plate numbers, using an automated system that inserts the numbers and gets out the correct file name would quickly and efficiently continue the process. But alas, not all the fiber, mjd, and plate numbers have the same number of digits, so the troubling process of if statements and the like currently ensues.

plate: 3-4 digits
mjd: 5 digits
fiber: 1-3 digits
--------------------
I thought I had my code fixed --- everything is in samplespec.pro and is looped so you don't even have to input an index or anything. But something is still funny, as 1) some of the radial velocities are very off, and 2) running into problems with my IF and ELSE statements.

Thursday, June 2, 2011

So today the computer crashed -- aka, things that I've been working on are (temporarily?) gone.
But no worries! Data has been downloaded to this machine, and it took surprisingly little time to rewrite the codes I've worked on.

Progress report:
So yesterday I was working on downloaded SDSS spectrum.
At the end of today, I have avg flux calculations for my spectrum (neatly-ish graphed) and corresponding template. I've written the spline code out, and need to work on debugging it.

^ KEEP READING OVER SPLINE STUFF ON IDL LIBRARY! maybe it's supposed to be fitting star spectrum to template instead of the other way around?

Also, while the computer was down, I read over the template paper, and read more up about how SDSS works. Very cool.


rememeber: my average for my template seems to be a little off -- while it would make sense for the graph of the wave vs. flux/avg flux to hover between more than and less than 0, it is edging on the side of being more than 0. There's a drop at the most left-hand side of the graph that would account for this, but no matter how narrower I make my xrange, it still includes that drop. For sake of continuing with the process, i'll leave that for now and continue on.



note to self: organize this blog better

Wednesday, June 1, 2011




So far today:
-read in fits file of Andrew's DR7 spectroscopic sample
-put into fits binary table
-picked out some arbitrary values for plate, fiver, and mjd
-used getspec.pro to pull out corresponding spectra from sdss
-used readsloanspec.pro to return wavelength and flux information


Voila, my first spectra plot!
(plate = 53789, mjd = 2212, fiber = 356)

Then I looked at a relatively flat section, in order to calculate its velocity
Also learned that putting $ before my commands allows me to go back to my directory/files from within idl. Very useful trick.


So next up is to write a program that connects the spectra to templates. Dylan helped me out and downloaded the templates for me. First off, I need to figure out which templates correspond to which star spectra. To do this, I need to use a chi-squared fit. From there, I'll need to use the spline function in order to shift the template and star's spectra so that the wavelength values for each occupy the same bin number. From there I can start to connect the spectra to templates with the xcorl procedure.

Notes to self:

Spline function:
result=spline(x,y,t, sig)
where x is star wavelength, y is star flux, t is template flux --> should return adjusted wavelength so in same bin?

xcorl:
result = xcorl, star, temp, range

(-->not sure about how to use adjusted wavelength in the xcorl procedure; I think the input is should be adjusted flux, and that spline returns adjusted wavelength, which would make the spline procedure useless for xcorl.....so I definitely need to check that out)

Not quite sure about what function will make the best fit graph using a chi-squared distribution. From what I can gather, I can use the curvefit command, but definitely need to discuss with Andrew.


On another note, I also created a document that will serve as a reference list for all the codes/procedures I make. Last summer I learned the hard way that two months of coding adds up to a lot of files that you forget the purpose of. Hopefully this will help avoid this.


I couldn't have done any of this without help from Bertie, Saurav, and Dylan (and Andrew, of course)! It's great to have such wonderful resources.


things to do tomorrow morning:
-look at red part of m dwarfs (larger than 7000 A), pick a section that is relatively flat, calculate mean value --> from this, divide both template and spectra by this, and compare using where command
-look at .rv in sdss spectra -- calculate velocity change and compare to see if it is the same (Andrew's catalog says v = 18.3088?)


Tuesday, May 31, 2011

binary stars and beyond!

First couple of days at BU under my belt!

My project this summer includes analyzing the different spectra of (close) binaries. The spectra of these binaries are made up of several different exposures from 9-25 min in length. By looking at the individual spectra that these were composed of, we can possibly see position changes of binaries through the shifts in their absorption and emission lines, and thereby calculate velocities. More to come once I'm further along.

I spent last Friday doing some background reading. Read and took notes on Silvestri et al (2005), West et al (2008), West et al (2011), and Hilton et al (2010). Also did some quick calculations on deriving velocity from wavelength change, and also the relationship between mass, separation, and velocity of binaries.

Things to further read up on:
-how to determine signal-to-noise ratio in spectra
-using the L Halpha/L bol ratio


This afternoon, I read through the chapter on stellar activity in the textbook New Light on Dark Stars: Red Dwarfs, Low-Mass stars, Brown Dwarfs (Reid and Hawley). We also set up the new computers in the lab. I also put together a quick little reminder list of useful idl tricks to have on my desktop. Tomorrow: spectra! (I think)


Thursday, May 26, 2011

New Summer, New Research

Oh hey blog, long time no see.

I haven't exactly decided if I'm going to keep this research journal going for the next few months or if I should open up a new one (I kind of feel like it would be nice to keep this one for a little).

A lot has happened since I last posted. Astro-related, I finished up my poster for the KINSC Research Symposium in Sept 2010. It was a lot of fun to talk about my summer work, but since then I haven't really looked at stealth galaxies. I did get through sophomore-level astro and physics classes -- success! All in all, it has been a great year.

But it is time to get back to research!

This summer, I will be working with Prof. Andrew West (HC '99) at Boston University, focusing on characterizing and identifying a new sample of binary stars. What this fully entails, I have yet to find out!

I had the wonderful opportunity to spend this past week at the AAS meeting in Boston. SO MUCH ASTRO (in the best way!). I went to lectures on a wide range of topics, heard both Beth and Andrew speak, met some great astronomers, and picked up some great Astro stickers and silly bands.

Tomorrow is my first day of work at BU. Can't wait!