A New Focus for the BDNYC Blog

With this coming year, we are aiming to refocus the content in this blog. While this blog does include general purpose information about brown dwarf research, most of the content was geared towards internal descriptions of our software, our database, and our setup that are relevant only for members of BDNYC. We're now using Trac to manage the internal workings of our team and will be changing some of the content you see on these pages.

From now on, you'll see posts describing general tips and tricks, including coding, project management techniques (such as using Trac), and observing tricks. You'll also see posts announcing team publications as well as team presence at conferences such as AAS. Finally, we hope to publish posts describing the small, incremental steps we take as we carry out our research, which include interesting results and plots.

We hope these changes will result in more frequent posts and will make the blog more valuable to the community as a whole.

BDNYC at Las Campanas Observatory

BDNYC team at Las Campanas Observatory. From left to right: Sara Camnasio, Munazza Alam, Haley Fica, Jackie Faherty

This past September, four members of the BDNYC team travelled to Chile to observe at Las Campanas Observatories (LCO). This team was led by Jackie Faherty and included undergraduate students Munazza Alam, Sara Camnasio, and Haley Fica. Both Munazza and Sara were funded by National Geographic Young Explorers Grants.

Las Campanas Observatories is one of the major telescope facilities in Chile, home to the two Magellan 6.5-meter telescopes and the soon-to-be-constructed Giant Magellan Telescope. For this observing run, the team had a single night on the du Pont 3-meter telescope and two nights on the Baade Magellan telescope. The aim of the run was observing cold brown dwarfs to obtain parallaxes with CAPSCam on the du Pont and FourStar on Baade as well as spectra with FIRE on Baade.

While the weather did not cooperate throughout the run, with a mix of high humidity, high winds, and clouds, that did not deter the team from pushing forward and getting as much data as they could. The all-ladies team has contributed to posts in the Las Campanas Belles blog, which details the adventures of women scientists at Las Campanas and other observatories. The below links direct to each student’s perspective and two summary posts.

Jackie Faherty summary posts:
It's a Ladies Extravaganza at Las Campanas
Thems The Breaks....

Munazza Alam: Maravilla

Sara Camnasio: Setting Foot in Chile (and trying to keep it still)

Haley Fica: A first time Observer

Deploying Package Releases to PyPI

Registering the package

To register the package and deploy the initial release to PyPI, do:

python setup.py register -r pypi
python setup.py sdist upload -r pypi

Deploying a new release

So you've made some cool new improvements to your Python package and you want to deploy a new release. It's just a few easy steps.

  1. After your package modules have been updated, you have to update the version number in your setup.py file. The format is major.minor.micro depending on what you changed. For example, a small bug fix to v0.2.3 would increment to v0.2.4 while a new feature might increment to v0.3.0.
  2. Then make sure all the changes are committed and pushed to Github.
  3. Build with python setup.py sdist
  4. Twine with twine upload dist/compressed_package_filename

That's it!

Adding Data to a SQL Database using astrodbkit

NOTE: The information on this post may be outdated. We recommend looking into the up-to-date documentation at trac (internal) and ReadTheDocs.

To add data to any table, there are two easy steps. As our working example, we'll add some new objects to the SOURCES table.

Step 1: Create an ascii file of the data

First, you must choose a delimiter, which is just the character that will break up the data into columns. I recommend a pipe '|' character since they don't normally appear in text. This is better than a comma since some data fields may have comma-separated values.

Put the data to be added in an ascii file with the following formatting:

  1. The first line must be the |-separated column names to insert/update, e.g. ra|dec|publication_id. Note that the column names in the ascii file need not be in the same order as the table. Also, only the column names that match will be added and non-matching or missing column names will be ignored, e.g. spectral_type|ra|publication_id|dec will ignore the spectral_type values as this is not a column in the SOURCES table and input the other columns in the correct places.
  2. If a record (i.e. a line in your ascii file) has no value for a particular column, type nothing. E.g. for the given column names ra|dec|publication_id|comments, a record with no publication_id should read 34.567|12.834||This object is my favorite!.

Step 2: Add the data to the specified table

To add the data to the table (in our example, the SOURCES table), import astrodbkit and initialize the .db file. Then run the add_data() method with the path to the ascii file as the first argument and the table to add the data to as the second argument. Be sure to specify your delimiter with delim='|'. Here's what that looks like:

from astrodbkit import astrodb
db = astrodb.Database('/path/to/the/database/file.db')
db.add_data('/path/to/the/upload/file.csv', 'sources', delim='|')

That's it!

BDNYC at AAS 225

BDNYC (and friends) are out in force for the 225th meeting of the American Astronomical Society!

Please come see our posters and talks (mostly on Monday). To whet your appetite, or if you missed them, here are some samplers:

Munazza Alam (Monday, 138.40)
High-Resolution Spectral Analysis of Red & Blue L Dwarfs
AAS225_Munazza_posterSara Camnasio (Monday, 138.39)
Multi-resolution Analysis of Red and Blue L Dwarfs
AAS225_Sara_posterKelle Cruz and Stephanie Douglas (Monday, 138.37)
When good fits go wrong: Untangling Physical Parameters of Warm Brown Dwarfs

AAS225_Stephanie_posterStephanie Douglas (Monday 138.19)
Rotation and Activity in Praesepe and the Hyades

AAS225_Steph_poster2Jackie Faherty (Talk, Monday 130.05)
Clouds in the Coldest Brown Dwarfs

Joe Filippazzo (Monday, 138.34)
Fundamental Parameters for an Age Calibrated Sequence of the Lowest Mass Stars to the Highest Mass Planets
Joe Filippazzo - AAS225

Paige Giorla (Monday, 138.44)
T Dwarf Model Fits for Spectral Standards at Low Spectral Resolution
AAS225_Paige_posterKay Hiranaka (Talk, Monday 130.04D)
Constraining the Properties of the Dust Haze in the Atmospheres of Young Brown Dwarfs

Erini Lambrides (Thursday, 432.02)
Can 3000 IR spectra unveil the connection between AGN and the interstellar medium of their host galaxies?

Emily Rice (Tuesday, 243.02)
STARtorialist: Astronomy Outreach via Fashion, Sci-Fi, & Pop Culture
AAS225_STARtorialistAdric Riedel (Monday, 138.38)
The Young and the Red: What we can learn from Young Brown Dwarfs

Using WriteLaTeX for Collaborative Papers

Update: WriteLaTeX is now Overleaf

We all love Google Docs. It's a functional and convenient way to share and collaboratively edit documents across platforms, time zones, and even continents. We in the BDNYC group use it extensively.

But what if you want to write a scientific paper? Google Docs, as awesome as it is, is not much more than a word processor. We want the internal hyperlinks for sections, figures, tables, and citations, elegant mathematical formulae, well-formatted tables, more control over where and how our components are arranged - in a word, LaTeX. Yes, LaTeX has its own host of problems, but it's very good at what it does.

There are a number of collaborative editing projects out there - Authorea springs to mind. But one of the simpler options out there is actually pretty good: WriteLaTeX.
Continue reading

Documentation using Sphinx

Sphinx is a free, online tool that helps generate documentation for primarily Python projects.  We use it for HTML format outputs, but it also supports LaTeX, ePub, Texinfo, manual pages, and plain text formats.  The markup language of Sphinx is reStructuredText (reST) (for documentation see http://sphinx-doc.org/rest.html).  Of Sphinx's many features, the one most useful thus far is its auto-documentation of Python files, the steps of which this post details below.

Sphinx auto-documentation steps:

  1. Install Sphinx at the command line using: easy_install -U Sphinx
  2. Read through the Sphinx documentation at http://sphinx-doc.org/.
  3. Run Sphinx's Getting Started function Sphinx-quickstart to quickly set up directories and configurations. NOTE: Since I have already completed this setup, it DOES NOT need to be run again for the BDNYC documentation.
    1. Access the documentation directories in Dropbox through the shared folder BDNYCdb/Documentation
    2. The Documentation folder contains the .rst and .py files that Sphinx uses to build documentation.  Place any files for which documentation is to be made within that directory since Sphinx automatically looks there.
      Screen Shot 2014-08-07 at 2.46.31 PMBDdb.html within the Documentation directories
  4. The index.rst file is the master file that contains the table of contents (known as a TOCtree) for the entire documentation.  Within  the TOCtree, Sphinx knows that all the files are .rst, so there is no need to specify the file extension or path.  The index also serves as a welcome page for users, so it may include an introduction or other information that would be useful for outside reference.  Within the TOCtree (and all of reST) indentation and notation is especially important.  Below is an example of a functioning TOCtree.  .. toctree::
    :maxdepth: 2
    # blank line

    The "maxdepth" function specifies the depth of nesting allowed.  In order to keep the index clean and aesthetically simple, a maximum of one nested page is reasonable. In other files, however, highly nested pages are not only common, but well-supported by reST.
    Screen Shot 2014-08-07 at 2.52.07 PM
    Screenshot of index.rst
  5. For each item in the TOCtree of the index file, there must be a corresponding .rst file in the main directory for Sphinx to nest within the index HTML file.  In the above example, a Database_instructions.rst file might contain in plain English how to interact with the database, while the BDdb.rst file contains the auto-documentation of BDdb.py.
  6. The .rst file within the TOCtree of the index must be formatted like below to correctly call for the Python files. [name of module]
    ================    # make page header (see http://sphinx-doc.org/rest.html)
    .. automodule:: [name of Python file w/o extension]
    :members:    # tells Sphinx to pull from the file
    # blank line

    Screen Shot 2014-08-07 at 2.57.41 PM

    Screenshot of BDdb.rst

  7. The referenced Python files for auto-documentation can either be in located in the main directory, or their location can be specified.  Since we will be constantly pushing and pulling from Github, it is best for those doing documentation to change the file path to their local copy of BDdb.py, astrotools.py, etc, before making documentation.  This can be achieved as follows:
  8. Open conf.py, which is the configuration file for Sphinx.  It was produced during the "quickstart" function to allow easy modifications of aesthetic features (i.e., theme, font), and facilitate the HTML building process.
    1. Change the file path in line 21 to the applicable local copy.
    2. Comment out the file path of previous users in order to make it easier for others to update documentation.
  9. In order to make the HTML files, move Terminal to the directory of the documentation, i.e., '.../Dropbox/BDNYCdb/Documentation' and run make html.
    1. The make htmlfunction comes build-in through running "quickstart" and uses the makefile in the main directory.  It can take other functions as well, including make clean, which deletes the entire contents of the "build" directory.
    2. Sphinx should put the generated HTML files in the /_build/html directory.
  10. To make the HTML files live on BDNYC.org/database, use the application Cyberduck, which can be downloaded at http://cyberduck.en.softonic.com/mac.
    1. Click "Open Connection" and put in the server, username, and password.
    2. Drag and drop any .rst and HTML files that were modified into the appropriate directory and the documentation should go live immediately!



http://sphinx-doc.org/ -- Sphinx documentation homepage

http://sphinx-doc.org/contents.html -- Outline of Sphinx documentation

http://sphinx-doc.org/rest.html -- Using reStructuredText in Sphinx

http://sphinx-doc.org/ext/autodoc.html -- Auto-documentation documentation

http://cyberduck.en.softonic.com/mac -- Download Cyberduck