Astronomical Laboratory ASTR:4850,
          Fall 2015
        by Philip Kaaret
      
Spectroscopy is crucial to astronomy.  It is the principal
      diagnostic for determining the temperature and chemical
      composition of stars, nebulae, and galaxies.  Spectroscopy is
      of equal importance to physics.  No experimental evidence was
      of more importance to the emergence of modern physics than the
      existence of spectral lines of different atoms and
      molecules.  Today, spectroscopy continues to be one of the
      most important experimental or observational measurement in both
      astronomy and physics.    (Hmm, I think he said
      that already.)
      
      In this class, we will have the pleasure of analyzing spectra
      obtained with the Faint Object Spectrograph (FORS) mounted on the
      Very Large Telescope (VLT) of the European Southern
      Observatory.  The spectra were obtained to study emission
      from an optical nebula surrounding an ultraluminous X-ray source
      are are described in this paper http://adsabs.harvard.edu/abs/2009ApJ...697..950K. 
      You will be analyzing the spectrum of the star referred to as
      “star A” in that paper.
    
The first step in obtaining the spectrum of an astronomical
      object is positioning the spectrograph slit on the star.  The
      observer or operator points the telescope to the general direction
      of the target and then fine tunes the pointing so that the target
      lies on the slit.  Standard procedure on the VLT is to take
      an image of the whole field once the pointing is set, the image
      for this observation is in acqimage.fits. 
      The operator then moves the slit into place, but does not move the
      grating into place, and takes another image, this is acqslit.fits.  Load both of these
      images into ds9 in two different frames so that you can view them
      simultaneously.  Note that acqslit shows only the part of the
      sky visible through the slit.  Zoom in on the bright star
      visible in the slit and center it in ds9, then do
      Frame/Match/Frame/Physical.  The two images have the same
      physical coordinate system.  By comparing the positions of
      stars on the full image to sky maps, one can determine the
      coordinates of the stars on the image in order to identify them in
      catalogs.  This has already been done for you and the
      information (called the 'World Coordinate System' or WCS) is
      written into the FITS header of both images.  Thus, ds9
      reported astronomical coordinates for your cursor on the line FK5,
      in addition to image and physical coordinates.  Determine the
      coordinates of the bright star visible in the slit and record them
      in your notebook.
    
When the grating in put in place, the light passing through the slit is dispersed along the x-axis of the CCD. However, the position of the light along the y-axis is unchanged. Thus, in the spectra, the y-axis represents the positions of objects along the slit. You will need to know the position of star A along the slit. So, record the y position of the star in your notebook. Note that you want this in image units.
    
We now need to determine the relationship between the position
      along the x-axis of the spectrum images and the wavelength of the
      radiation.  As we did for the DDS-7, this is done by taking a
      spectrum a gas discharge lamp that produces several emission lines
      of known wavelength and then using the lines to determine the
      relationship between pixel number and wavelength.  The file lamp.fits contains an image of the spectrum
      obtained using an He+HgCd lamp for this observation.  This
      lamp produces many lines as shown in the figure below.  Note
      that the wavelengths are given in Angstroms.
    
    
The following is a list of the brighter lines:
3650.144 Hg   
      3888.646 He
      4046.557 Hg
      4077.831 Hg
      4358.343 Hg
      4471.479 He
      4678.160 Cd
      4713.200 He
      4799.920 Cd
      4921.929 He
      5015.675 He
      5085.824 Cd
      5460.742 Hg
      5769.598 Hg
      5790.656 Hg
      5875.620 He I
    
      Load the python program calibrate.py
      into your favorite editor and then edit the name of the file
      containing the calibration lamp spectrum and the lines specifying
      the band over which the spectrum is extracted.  There can be
      slight shifts of the calibration across the slit, if the CCD or
      grating isn't exactly perpendicular to the slit, so use the y
      value that you found above for star A.
    
Now pick out the brightest lines in the spectrum and edit them
      into values for linec (line centroid in pixels), linew (line width
      in pixels), and linew (line wavelength in nanometers in
      calibrate.py.  Note that your pixel values may be shifted
      from the pixel values in the plot above.  This calibration
      routine uses a least-squares fit to the centroid versus wavelength
      relation, so it can use more than two lines.  Record the
      values for 'central pixel', 'central wavelength', and 'slope =
      '.  Print out your wavelength calibration spectrum, indicate
      the wavelengths of the lines used, and paste the plot into your
      lab notebook.
      
    
We already know that the quantum efficiency of CCDs varies with
      wavelength.  In addition, the efficiency of reflection of the
      spectrograph grating or other components in the spectrograph can
      vary as a function of wavelength.  Thus, we need to calibrate
      the efficiency of the spectrograph versus wavelength.  This
      is done by observing a standard star with a known spectrum. 
      The primary reference for astronomical spectroscopy and photometry
      is Vega.  Flux are often measured simply as a ratio of the
      flux of the star of interest to the flux of Vega at a particular
      wavelength.  The spectrum of Vega has been measured in
      physical units by comparing it to laboratory blackbody emitters
      with known properties.  Vega is sometime not convenient to
      observe, particular when observing from the southern hemisphere,
      so the primary calibration from Vega has been transferred to a
      number of secondary stars by measuring their relative
      spectra.  And then from the secondary stars to tertiary
      stars.  See http://adsabs.harvard.edu/abs/1992PASP..104..533H
      for a reasonably easy to read synopsis of the process.
    
White dwarfs are favored objects for the secondary and tertiary
      standards.  The standard star used for our spectra is EG 274,
      a white dwarf with a spectral classification of DA,
        meaning that the spectrum shows hydrogen absorption, but no
        lines from helium or heavier elements.   The spectrum
        of EG 274 as measured Hamuy and collaborators in the reference
        above is in the file feg274.dat. 
        Each line of the file gives: wavelength (Å), flux (ergs/cm/cm/s/Å * 10**16), flux
        (milli-Jansky), and bin width (Å).  The spectrum of EG 274 obtained
        with the FORS/VLT is in the file std1.fits. 
        Open it up in ds9 and find the y-position of the star and the
        width in y of the spectrum.  A convenient way to do this is
        to draw a box using ds9 (Region/Shape/Box), position and size
        the region to fit the spectrum, and then double click on the
        region to bring up the properties dialog box and read off the
        center and size.  Note that you want these in image units.
      
Load the python program spectrum.py in an editor. Edit the calibration data (centralp, centralw, slope) to match the wavelength calibration that you just derived, edit the file name for stdfile to match the spectrum image file for the calibration star, and the value for y0 (the first instance) to match the y position of the calibration star that you found above. The code starting with '# read in the spectrum image file for the calibration star', reads in the calibration star spectrum file, extracts a spectrum, and then restricts the data to the range 3500-6000 Å because FORS using the grating (actually a grism) selected for this observation isn't reliable outside that range, and plots the spectrum. It also converts wavelength from nanometers to Angstroms because your Professor is used to working in Angstroms.
The next block of code, starting with '# read in the reference
      spectrum from Hamuy 1992', reads in a reference spectrum for the
      same star.  We want to use the reference spectrum to correct
      for the wavelength dependence of the FORS spectrograph, by
      dividing the reference spectrum by the measured spectrum to find a
      conversion factor.  However, the binning of the reference
      spectrum isn't the same as that of the FORS spectrum, so we first
      need to define a python function that interpolates between
      bins.  This is done in the line 'rfi = interp1d(rw, rf)', rfi
      is then a function that we can call with any wavelength to get an
      interpolated value for the reference spectrum.  The code does
      this for every bin in the measured spectrum and then calculation
      the conversion factor using the ratio of reference/measured. 
      Print out your plots of the reference star spectrum and the
      conversion factor and put them in your report.
    
Unfortunately, the reference spectrum isn't as high resolution as
      FORS.  This leads to spurious bumps in the conversion factor
      around the absorption lines in the reference star spectrum. 
      How could one remove those bumps?