2013年9月17日星期二

EXAMPLEs for Latex Tables




From: http://www.astrobetter.com/how-to-make-awesome-latex-tables/



Below is the code used to generate the above table.  Note that you need the file deluxetable.sty and the package nicefrac:
\begin{deluxetable}{cccccccc}
\tabletypesize{\footnotesize}
\tablecolumns{8}
\tablewidth{0pt}
\tablecaption{ Cross-correlation Fit Details \label{table:results1}}
\tablehead{
\colhead{QSO} \vspace{-0.2cm} & \colhead{$R$ Range} & & & & & \colhead{Separation} & \colhead{Result}\\ \vspace{-0.2cm}
& & \colhead{$\langle f \rangle$} & \colhead{$r_0$} & \colhead{$\gamma$} & $W$ & & \\
\colhead{Division} & \colhead{(Mpc/h)} & \colhead{} & \colhead{} & \colhead{} & & \colhead{(\%)} & \colhead{Strength}}
\startdata
\vspace{-0.2cm} \nicefrac{1}{3} Bright & & $4.24 \cdot 10^{-4}$ & 6.19 & & 96.97 & & \\ \vspace{-0.2cm}
& [0.3,3] & & & 1.77 & & 96.7 & 1.9$\sigma$ \\
\nicefrac{2}{3} Dim & & $4.26 \cdot 10^{-4}$ & 4.48 & & 52.77
\enddata
\vspace{-0.8cm}
\tablecomments{Luminosity dependent quasar clustering using a cross-correlation technique between CS82 galaxies ($M &lt; 23.5$) and SDSS, BOSS, and 2SLAQ quasars \hbox{($0.5 < z < 1.0$)}. The quasars were broken up into the \nicefrac{1}{3} brightest and \nicefrac{2}{3} dimmest, and a cross-correlation function was calculated between a range of \hbox{$[0.3-3.0]$ Mpc}. A power-law fit to the data of the form $\xi(r) = (r_0 / r)^\gamma$ found that $\gamma = 1.77$ and $r_0 = 6.19$ for the bright sample and $r_0 = 4.48$ for the dim sample.}
\end{deluxetable}




\documentclass[10pt,preprint]{aastex}
\begin{document}

\newcommand\sk[2]{Sk\,{$-#1{^\circ}#2$}}
\newcommand\tnc{\,\tablenotemark{c}}
\newcommand\tnd{\,\tablenotemark{d}}

\begin{deluxetable}{lllllllll}
\tabletypesize{\footnotesize}
\tablecolumns{7} 
\tablewidth{0pt} 
\tablecaption{Observational Parameters for FUSE Targets}
\tablehead{\colhead{Target}                                    &
           \multicolumn{2}{c}{RA  (J2000)   Dec}               &
           \colhead{Spectral Type}                             &
           \colhead{Ref.\,\tablenotemark{a}}                   &
           \colhead{$V$}                                       &
           \colhead{(\bv)}                                     &
           \colhead{Ref.\,\tablenotemark{b}}                   &
           \colhead{Notes}                                    \\
           \colhead{}                                          &        
           \colhead{{h}\phn{m}\phn{s}}                         &
           \colhead{\phn{\arcdeg}~\phn{\arcmin}~\phn{\arcsec}} &
           \colhead{}                                          &               
           \colhead{}                                          &            
           \colhead{}                                          & 
           \colhead{}                                          & 
           \colhead{}                                          & 
           \colhead{}                                          }
\startdata
\sidehead{Large Magellanic Cloud }
\sk{65}{21}  & 05 01 22.33 & $-$65 41 48.1 & O9.7 Iab      & W95  &    12.02     & $-$0.16 & I75 &                   \\
\sk{65}{22}  & 05 01 24.00 & $-$65 52 00.0 & O6 Iaf+       & W77  &    12.07     & $-$0.19 & I79 & HDE\,270952       \\
\sk{66}{18}  & 04 55 59.88 & $-$65 58 30.0 & O6 V((f))     & M95  &    13.50     & $-$0.20 & I79 &                   \\
\sk{66}{51}  & 05 03 10.20 & $-$66 40 54.0 & WN8h          & S96  &    12.71     & $-$0.23 & F83 & HD\,33133         \\
\sk{66}{100} & 05 27 45.59 & $-$66 55 15.0 & O6 II(f)      & W95  &    13.26     & $-$0.21 & I79 &                   \\
             &             &               &               &      &              &         &     &                   \\
\sk{68}{52}  & 05 07 20.60 & $-$68 32 09.6 & B0 Ia         & W77  &    11.54     & $-$0.07 & A72 & HDE\,269050       \\
\sk{68}{75}  & 05 23 28.52 & $-$68 12 22.8 & B1 I          & J01  &    12.03     & $-$0.06 & A72 & HDE\,269463       \\
\sk{68}{80}  & 05 26 30.43 & $-$68 50 26.6 & WC4+O6V-III   & M90  &    12.42     & $-$0.23 & F83 & HD\,36521         \\
\sk{68}{82}  & 05 26 45.30 & $-$68 49 52.8 & WN5?b+(B3I)   & S96  & \phn9.86     & $-$0.03 & I82 & HDE\,269546       \\
\sk{68}{135} & 05 37 48.60 & $-$68 55 08.0 & ON9.7 Ia+     & W77  &    11.36     &\phs0.00 & A72 & HDE\,269896       \\
             &             &               &               &      &              &         &     &                   \\
BI\,170      & 05 26 47.79 & $-$69 06 11.7 & O9.5 Ib       & W01  &    13.09     & $-$0.17 & B75 &                   \\
BI\,173      & 05 27 10.08 & $-$69 07 56.2 & O8 II:        & W01  &    13.00     & $-$0.14 & B75 &                   \\
\sk{69}{142}a& 05 27 52.75 & $-$68 59 08.6 & WN10h         & C97  &    11.88\tnc & $-$0.04 & S86 & BE294, HDE\,269582\\
\sk{69}{175} & 05 31 25.61 & $-$69 05 38.4 & WN11h         & C97  &    11.90     & $-$0.07 & I75 & S119, HDE\,269687 \\
\sk{69}{191} & 05 34 19.39 & $-$69 45 10.0 & WC4           & T88  &    13.35     & $-$0.20 & F83 & HD\,37680         \\
             &             &               &               &      &              &         &     &                   \\
\sk{70}{69}  & 05 05 18.73 & $-$70 25 49.8 & O5 V          & W95  &    13.94     & $-$0.27:& R78 &                   \\
\sk{70}{91}  & 05 27 33.74 & $-$70 36 48.3 & O6.5 V        & C86  &    12.78     & $-$0.23 & I79 &                   \\
\sk{70}{115} & 05 48 49.76 & $-$70 03 57.5 & O6.5 Iaf      & Wpc  &    12.24     & $-$0.10 & I75 & HDE\,270145       \\
\sk{70}{120} & 05 51 20.85 & $-$70 17 08.7 & B1 Ia         & F88  &    11.59     & $-$0.06 & A72 & HDE\,270196       \\
\sk{71}{45}  & 05 31 15.55 & $-$71 04 08.9 & O4-5 III(f)   & W77  &    11.51\tnd & $-$0.19 & H91 & HDE\,269676       \\
             &             &               &               &      &              &         &     &                   \\
\cutinhead{Small Magellanic Cloud}
AV\,6        & 00 45 18.20 & $-$73 15 23.4 & O9 III        & L97  &    13.46     & $+$0.03 & A75 &                   \\
AV\,14       & 00 46 32.66 & $-$73 06 05.6 & O3-4 V        & G87b &    13.77     & $-$0.19 & A75 & Sk\,9             \\
AV\,15       & 00 46 42.19 & $-$73 24 54.7 & O6.5 II(f)    & W00  &    13.17     & $-$0.21 & I78 & Sk\,10            \\
AV\,26       & 00 47 50.07 & $-$73 08 20.7 & O7 III        & G87b &    12.55     & $-$0.20 & A75 & Sk\,18            \\
AV\,47       & 00 48 51.35 & $-$73 25 57.6 & O8 III((f))   & W00  &    13.38     & $-$0.26 & A75 &                   \\
             &             &               &               &      &              &         &     &                   \\
AV\,69       & 00 50 17.40 & $-$72 53 29.9 & OC7.5 III((f))& W00  &    13.35     & $-$0.22 & A75 &                   \\
AV\,70       & 00 50 18.14 & $-$72 38 09.8 & O9.5 Iw       & W83  &    12.38     & $-$0.17 & A75 & Sk\,35            \\
AV\,75       & 00 50 32.50 & $-$72 52 36.2 & O5 III(f+)    & W00  &    12.79     & $-$0.16 & I78 & Sk\,38            \\
AV\,81       & 00 50 43.47 & $-$73 27 06.1 & WN5h          & S96  &    13.29     & $-$0.10 & A75 & Sk\,41            \\
AV\,83       & 00 50 52.01 & $-$72 42 14.5 & O7 Iaf+       & W00  &    13.58     & $-$0.13 & W00 &                   \\
\enddata

\tablenotetext{a}{References for Spectral Types.~
  C82  = Crampton (1982); 
  C86  = Conti et~al (1986);
  C97  = Crowther (1997);
  Wpc  = Walborn, private communication,
  etc           }
  
\tablenotetext{b}{References for Photometry.~
  A72  = Ardeberg (1972);
  A75  = Azzopardi \& Vigneau (1975);
  etc                        }

\tablenotetext{c}{Variable.}

\tablenotetext{d}{Photometric measurements refer to a blend of several nearby sources.}

\end{deluxetable}


\end{document}

2013年9月9日星期一

Re-sampling spectra with pysynphot

Python Tip: Re-sampling spectra with pysynphot

by Jessica Lu on August 12, 2013
This post was inspired by a question from John Johnson.
Have you ever wanted to plot a model spectrum at lower resolution? Or compare a model spectrum with an observed spectrum? Have you ever wanted to shift several observed spectra to a common redshift to stack them up? In all these cases, you would need to resample the spectrum. Just such a scenario arose and I was asked:

What is the recommended way to resample a 1D spectrum?

I recalled using pysynphot, which is very useful for working with 1D spectra. However, the documentation is still a bit thin. After a bit of of exploring, here is an example that John Johnson and I wrote to illustrate our answer to the question. This package takes care to resample while preserving flux. We hope you find this useful! Or leave your alternative answer in the comments below.
from pysynphot import observation
from pysynphot import spectrum
 
def rebin_spec(wave, specin, wavnew):
    spec = spectrum.ArraySourceSpectrum(wave=wave, flux=specin)
    f = np.ones(len(wave))
    filt = spectrum.ArraySpectralElement(wave, f, waveunits='angstrom')
    obs = observation.Observation(spec, filt, binset=wavnew, force='taper')
 
    return obs.binflux
For those bleeding-edge python users out there, pysynphot is becoming an astropy affiliated package. You can download this new version from the pysynphot GitHub repository and test it out.
From:  http://www.astrobetter.com/python-tip-re-sampling-spectra-with-pysynphot/