@@ -0,0 +1,3054 @@
+from selenium import webdriver                                                                                                      %0Afrom selenium.webdriver.common.keys import Keys %0Afrom numpy import array, ndarray%0A%0Adef GetBJD(iJD=0, iRA=0, iDEC=0, iLAT=0, iLON=0, iALT=0):%0A    %22%22%22%0A    Gets BJD from returned result at:%0A    %0A        http://astroutils.astronomy.ohio-state.edu/time/utc2bjd.html%0A        %0A    Ohio State University IDL based UTC to BJD code%0A    %0A    Sateless function%0A    %0A    Params:%0A        iJD - list or single UTC JD value %5Bstring%5D%0A        iRA - hh:mm:ss Right Ascension for target %5Bstring%5D%0A        iDEC - dd:mm:ss Declination for target %5Bstring%5D%0A        iLAT - decimal degrees of latitude for observation location %5Bstring%5D%0A        iLON - decimal degrees of longitude for observation location %5Bstring%5D%0A        iALT - elevation of obvsevation from sea level in meters %5Bstring%5D%0A        %0A    Returns:%0A        BJDs - list of returnes BJDs as floats of length n = length iJD%0A        %0A    Exeptions:%0A        BAD_JD - JD formated incorrectly, will raise an assertation error showing JDs%0A                    all JDs should be castable to a float            %0A    Prerequisits:%0A        Selinium - Webserver interaction%0A        PhantomJS - invisible webdriver%0A        numpy - array handeling%0A    %22%22%22%0A    URL = 'http://astroutils.astronomy.ohio-state.edu/time/utc2bjd.html'%0A    %0A    if not isinstance(iJD, (list, ndarray)):%0A        iJD = %5BiJD%5D    # make all JDs into list%0A        %0A    JD_send = ''%0A    for i,e in enumerate(iJD):%0A        if i != len(iJD):%0A            JD_send += %22%7B%7D%5Cn%22.format(e)    #format JDs for webserver%0A        else:%0A            JD_send += %22%7B%7D%22.format(e)%0A%0A    #interact with webserver        %0A    driver = webdriver.PhantomJS()   # phantomJS required%0A    driver.get(URL)%0A    ra = driver.find_element_by_name('ra')%0A    ra.send_keys(iRA)%0A    dec = driver.find_element_by_name('dec')%0A    dec.send_keys(iDEC)%0A    jd = driver.find_element_by_name('jds')%0A    jd.send_keys(JD_send)%0A    lat = driver.find_element_by_name('lat')%0A    lat.send_keys(iLAT)%0A    lon = driver.find_element_by_name('lon')%0A    lon.send_keys(iLON)%0A    alt = driver.find_element_by_name('elevation')%0A    alt.send_keys(iALT)%0A    submit = driver.find_element_by_name('submit').click()%0A    source = driver.page_source.split('%5Cn')%0A    driver.close%0A    %0A    # check for JD conversion fail%0A    try:%0A        assert '%3Cpre%3EThe 0th date' not in source%5B5%5D%0A    except AssertionError as e:%0A        e.args += ('BAD JD', 'Error in input - check JDs for validity (are they all capable of being cast to floats?)', %0A                   'JDs inputed: ', iJD, 'JDs sent', JD_send)%0A        raise%0A    %0A    #Bracket the BJDs (based on the knonw formating of the output HTML)%0A    index_val = source.index('%3Cpre%3EThe following are the BJD_TDBs for each of your input dates:')%0A    close_val = source.index('%3C/pre%3E%3C/body%3E%3C/html%3E')%0A    BJDs = source%5Bindex_val+2:close_val-3%5D  # retrive BJDs based on braket%0A    BJDs = %5Bfloat(x) for x in BJDs%5D         # cast BJDs to float%0A    %0A    return BJDs%0A

Create pyBJD.py