User:Warrickball

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Wikipedia:Babel
en This user is a native speaker of English.
Search user languages

I consider myself a very small-scale contributor to the Wikipedia. I created my own account due to an IP-block against my ISP preventing access. At this stage I'm little more than a hedge-clipper, ironing out minor flaws in articles, with only a few exceptions where I've made more substantial contributions.

Stellar structure, evolution and pulsation[edit]

If I ever have the time, I'd love to overhaul a number of articles related to the theory, observation and study of stars and their stellar oscillations. There are several related articles in Wikipedia already. Here are links to my (mostly non-existent) working copies, as well as the original articles (where appropriate).

Working copy Original
User:Warrickball/Helioseismology Helioseismology
User:Warrickball/Stellar oscillations Stellar oscillations
User:Warrickball/Stellar atmosphere Stellar atmosphere
User:Warrickball/Stellar structure Stellar structure

Python script to generate Wikipedia citation from ADS bibcode[edit]

This is a Python script I use to quickly turn ADS data into Wikipedia citations. It takes a number of bibcodes as arguments and prints the Wikipedia citation to the terminal.

#!/usr/bin/env python                                                                                                                                                   

from os import sys
import urllib2

for bibcode in sys.argv[1:]:
    bibcode.replace('&','%26')

    data = urllib2.urlopen('http://esoads.eso.org/cgi-bin/nph-bib_query?bibcode=%s&data_type=BIBTEX&db_key=AST&nocookieset=1' % bibcode).read()

    Is = [0] + [i for i,c in enumerate(data) if c=='\n'] + [len(data)]

    # get relevant lines of URL
    lines = [data[Is[i-1]:Is[i]] for i in range(1,len(Is))]

    # create dictionary with citation information
    d = {}
    for line in lines:
        if '=' not in line: continue

        # strip out some confusing characters
        for c in ['{','}',',','"']:
            line = line.replace(c,'')

        words = line.split()
        d[words[0]] = ' '.join(words[2:])

    d['page1'] = bibcode[-6:-1].replace('.','')
    d['author'] = d['author'].replace('~',' ').split(' and ')

    # create Wikipedia citation
    cite = '{{Citation'

    for i, author in enumerate(d['author']):
        words = author.split()
        cite = cite + ' | last%i = %s | first%i = %s' \
               % (i+1, words[0], i+1, ' '.join(words[1:]))

    # replace some common journal names
    if d['journal'] == '\\araa': d['journal'] = '[[Annual Reviews in Astronomy and Astrophysics]]'
    elif d['journal'] == '\\apj': d['journal'] = '[[The Astrophysical Journal]]'
    elif d['journal'] == '\\apjl': d['journal'] = '[[The Astrophysical Journal]] Letters'
    elif d['journal'] == '\\mnras': d['journal'] = '[[Monthly Notices of the Royal Astronomical Society]]'
    elif d['journal'] == '\\aap': d['journal'] = '[[Astronomy and Astrophysics]]'
    elif d['journal'] == '\\nat': d['journal'] = '[[Nature (journal)|Nature]]'
    elif d['journal'] == '\\sci': d['journal'] = '[[Science (journal)|Science]]'

    cite = cite + ' | title = %s | year = %s | journal = %s | volume = %s | pages = %s' \
           % (d['title'], d['year'], d['journal'], d['volume'], d['page1'])

    cite = cite + '| bibcode = %s}}' % bibcode
    print(cite)

Links[edit]

Six Degrees of Wikipedia