AASTeX, BibTeX, and Journal style

I’ve now got a winning strategy for citations:  BibDesk, AASTeX, and a python script to clean it all up.

Keeping track of citations is a pain, but there are lots of great tools out there for keeping them all straight and eventually importing them into your papers.  For a while I was a big fan of Papers for Macs. But when I put it into practice, exporting to a BibTeX database and importing into an AASTeX manuscript, I was disappointed. Mostly because Papers fetches data from ADS, but doesn’t use the AASTeX macros for the different journal names. And I couldn’t customize it. Annoying.

That’s when I tried another combination: BibDesk (part of the MacTeX package). It’s a lot like Papers, though with less bells and whistles. But you can’t beat the price (free) and it has this really nice feature:  highlight any citation string (like 2011AJ….141…19B), right-click, and choose “Add to BibDesk”. Voila! Citation is imported from ADS complete with AASTeX journal macros.

There’s just one little problem:  the resulting \bibitem entries have all the author names. The ApJ and AJ Journal styles like to have one, two, three, four, or two with “et al.”. So I wrote a python script to parse a .bbl file and output it with the author entries all fixed up. You might ask:  why not update the BibTeX database instead. Well, I thought about that, but decided I wanted to keep the database in tact, in case I ever want to find someone deep down in the author list (like, say, me). So here’s my magic recipe:

  1. Use BibDesk to maintain your .bib database:
    1. Add entries using the magic right-click-on-ADS-string
    2. Add entries by copying BibTeX entries to the clipboard.
    3. Merge previous BibTeX databases
  2. Use bibtex command as usual to build your .bbl file from your .tex manuscript.
  3. Run my python script:
    fix_authors ms.bbl
    (it will make a backup of the original file:  ms.bbl.backup)
  4. Re-run latex again. Maybe do that a couple of times. Just to be sure.
Posted in Uncategorized | Leave a comment

Astronomy Lecture Series

Something I’ve worked hard on is the Carnegie Astronomy Lecture Series.  This is a very popular series of talks given primarily by Carnegie Astronomers on all sorts of astronomical topics.  They are usually given at the Huntington Library and Botanical Gardens and recently have been so full that people have been turned away.

The Huntington makes audio recordings and publishes when in iTunes U, but that doesn’t really work well in astronomy, which is highly visual.  So that’s when I decided to try and pair the Keynote/PowerPoint slides with the audio.  There here’s the result.

http://www.obs.carnegiescience.edu/news/huntington_online

Posted in Uncategorized | Leave a comment

Beautiful Math

Installed a WordPress plugin called jetpack because it’s supposed to allow you to embed latex formulas in your posts/pages.  This alone could bring me over for good from plone.  So…  let’s give a try by writing out the bend equation I came up with:

y\left(t\right) = \frac{\left(s_0 + s_1\right)}{2}t + \frac{\tau}{2}\left(s_1 - s_0\right)\ln\left[\cosh\left(\frac{t-t_{max}}{\tau}\right)\right] + c

Whoa!  It worked!

Posted in Uncategorized | Leave a comment

Pyflot anyone?

So this flot thing is pretty cool.  But I hate working in JS and most of my web tinkering is using Django, which is python-based.  So I wrote a quick and dirty module for generating flot output based on a python class.  Here’s how I reproduce their first flot example:

p1 = pyflot.Plot()
x1 = np.arange(0,14,0.5); y1 = np.sin(x1)
x2 = [0,4,8,9]; y2 = [3,8,5,13]
x3 = [0,7,None,7,12]; y3 = [12,12,None,2.5,2.5]
p1.plot(x1,y1,'-')
p1.plot(x2,y2,'-')
p1.plot(x3,y3,'-')
p1.htmlout('example1.html')

And here’s the output html to compare.

Posted in Uncategorized | Leave a comment

Python and Latex Tables

Finally got around to writing a python LaTeX table-generator.  Takes lists and numpy arrays and puts them in columnar form.  Outputs the deluxetable environment LaTeX which can then be imported into any aastex document.

Here’s how it works:

import Table
fout = open('mytable.tex','w')
t = Table.Table(6, justs='lrc', caption='Awesome results', label="tab:label")
t.add_header_row(['obj', 'X', '$\\beta$'])
col1 = ['obj1','obj2','obj3']
col2 = [0.001,0.556,10.56]   # just numbers
col3 = [[0.12345,0.1],[0.12345,0.01],[0.12345,0.001]]
t.add_data([col1,col2,col3], sigfigs=2)
t.print_table(fout)
fout.close()

You just create a table object, specifying the number of columns (6), their justifications (justs), the table caption, and \ref label to use.  Next, add the header labels.  Then add data, which can be a list of strings (col1), a list of numbers (col2) or a list of number and error pairs (col3).   The argument sigfigs lets you set the number of significant figures for the data in the table.  It will round up to this for single numbers and round up the errors and format the numbers appropriately.

Table.py
sigfig.py

Posted in Uncategorized | 4 Comments

So Long Mobile Me

Well, it was a nice run while we had it, but Apple’s done away with MobileMe (which was once known as .mac).  So long gallery.  So long iWeb.  So long…  MY WEBISTE!!!  Yikes!

So here we go with WordPress.  So far, I’m rather happy with it.  Not as hard to set up as Drupal.  Not as bare-bones as Django.  This just might do.

I might even keep this blog thing up.  But more along the lines of posting software and stuff.  We’ll see.

Posted in Uncategorized | Leave a comment