Skip to content

Instantly share code, notes, and snippets.

@jdnc
Created June 24, 2013 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdnc/5851110 to your computer and use it in GitHub Desktop.
Save jdnc/5851110 to your computer and use it in GitHub Desktop.
{
"metadata": {
"name": "get_votable_fields"
},
"name": "get_votable_fields",
"nbformat": 2,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": "import astropy.utils.data as aud\ncontent = aud.get_file_contents(\"http://simbad.u-strasbg.fr/simbad/sim-help?Page=sim-fscript#VotableFields\")",
"language": "python",
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": "WARNING: ConfigurationDefaultMissingWarning: Requested default configuration file /home/rk7/astropy/astropy/astropy.cfg is not a file. Cannot install default profile. If you are importing from source, this is expected. [astropy]\n"
},
{
"output_type": "stream",
"stream": "stdout",
"text": "\u001b[0;39mDownloading http://simbad.u-strasbg.fr/simbad/sim-help?Page=sim-fscript#VotableFields\u001b[0m \u25d3"
},
{
"output_type": "stream",
"stream": "stdout",
"text": "\n\u001b[0;39mDownloading http://simbad.u-strasbg.fr/simbad/sim-help?Page=sim-fscript#VotableFields\u001b[0m\u001b[0;32m [Done]\u001b[0m"
}
],
"prompt_number": 2
},
{
"cell_type": "code",
"collapsed": true,
"input": "import re\nimport bs4\nhtmldoc = bs4.BeautifulSoup(content)\nsearch_text = re.compile(r'Field names for VOTable output', re.IGNORECASE)\nfoundtext = htmldoc.find('h2', text=search_text)",
"language": "python",
"outputs": [],
"prompt_number": 4
},
{
"cell_type": "code",
"collapsed": false,
"input": "table = foundtext.findNext('table')# Find the first <table> tag that follows it\nfor row in table.findAll('tr'):\n cols = row.findChildren('td')\n if len(cols) > 1:\n if cols[0].findChild(\"ul\"):\n text1 = cols[0].findChild('ul').getText()\n else: text1 = cols[0].getText()\n if cols[1].findChild(\"ul\"):\n text2 = cols[1].findChild('ul').getText()\n else: text2 = cols[1].getText()\n print text1.replace(\"\\n\", \" \")+text2.replace(\"\\n\", \" \") + \"\\n\"",
"language": "python",
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": " Object type \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\n\notype \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0standard name of the object type\n\notype(opt) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 N : numerical display S : standard name (max 6 chars) 3 : short name (max 3 chars) V : full description \n\n Magnitude and Fluxes \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0The parameter filtername must correspond to an existing filter. Currently: B,V. Coming soon: IR filters (R,I,J,K,L)\n\nfluxdata(filtername) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0all fields related with a particular filter. \n\nflux(filtername) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0value of the flux for the given filter\n\nflux_name(filtername) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0name of the filter\n\nflux_unit(filtername) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0flux unit (mag, jy, ...)\n\nflux_error(filtername) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0error value of the flux measurement\n\nflux_quality(filtername) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0quality (A:best, E:worst) of the flux\n\nflux_bibcode(filtername) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bibcode\n\n Coordinates \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\n\ncoordinates \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0all fields related with coordinates\n\ncoo(opt) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 d : decimal display s : sexagesimal display frame : ICRS, FK5, FK4, GAL, SGAL, ECL epoch : epoch (decimal value) for the coordinates display equinox : equinox (decimal value) for the coordinates display \n\nra(opt) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0right ascension. The options are the same as for coo above.\n\ndec(opt) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0declination. The options are the same as for coo above.\n\nra_prec \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0right ascension precision code (0:1/10deg, ..., 8: 1/1000 arcsec)\n\ndec_prec \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0declination precision code (0:1/10deg, ..., 8: 1/1000 arcsec)\n\ncoo_err_maja \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0major axis of the error ellipse\n\ncoo_err_mina \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0minor axis of the error ellipse\n\ncoo_err_angle \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0angle of the error ellipse\n\ncoo_qual \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0quality (A:astrometric, .., E:unknown)\n\ncoo_wavelength \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0wavelength type of the measure (Radio, IR, Visible, UV, X, Gamma)\n\ncoo_bibcode \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bibliographical reference\n\n Proper motions \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\n\npropermotions \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0all fields related with the proper motions\n\npm \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0proper motion values in right ascension and declination\n\npmra \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0proper motion in right ascension\n\npmdec \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0proper motion in declination\n\npmra_prec \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0precision code (0:1/10deg, ..., 8: 1/1000 arcsec)\n\npmdec_prec \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0precision code (0:1/10deg, ..., 8: 1/1000 arcsec)\n\npm_err_maja \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0major axis of the error ellipse\n\npm_err_mina \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0minor axis of the error ellipse\n\npm_err_angle \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0angle of the error ellipse\n\npm_qual \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0quality (A:astrometric, .., E:unknown)\n\npm_bibcode \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bibliographical reference\n\n Parallaxes \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\n\nparallax \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0all fields related to parallaxes\n\nplx \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0parallax value\n\nplx_prec \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0precision code (0:1/10deg, ..., 8: 1/1000 arcsec)\n\nplx_error \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0parallax error\n\nplx_qual \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0parallax quality (A:astrometric, .., E:unknown)\n\nplx_bibcode \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bibliographical reference\n\n Radial Velocity and redshift \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Fields beginning with rvz display the data as it is in the database. Fields beginning with rv force the display as a radial velocity. Fields beginning with z force the display as a redshift\n\nvelocity \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0all fields related with radial velocity and redshift\n\nrvz_type \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0stored type of velocity: 'v'=radial velocity, 'z'=redshift\n\nrv_value \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Radial velocity value. Eventually translated from a redshift\n\nz_value \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Redshift value. Eventually translated from a radial velocity\n\nrvz_radvel \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0stored value. Either a radial velocity, or a redshift, depending on the rvz_type field\n\nrvz_error \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Error. In the same unit as rvz_radvel\n\nrvz_qual \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Quality code (A: best, .., E: worst)\n\nrvz_wavelength \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0wavelength type of the measure (Radio, IR, Visible, UV, X, Gamma)\n\nrvz_bibcode \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Bibliographical reference\n\n Spectral type \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\n\nsptype \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0all fields related with the spectral type\n\nsp \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0spectral type value\n\nsp_qual \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0spectral type quality (A: best, .., E: worst)\n\nsp_nature \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0spectral type nature ('s'pectroscopic, 'a'bsorbtion, 'e'mmission\n\nsp_bibcode \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Bibliographical reference\n\n Morphological type \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\n\nmorphtype \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0all fields related to the morphological type\n\nmt \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0morphological type value\n\nmt_qual \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0morphological type quality (A: best, .., E: worst)\n\nmt_bibcode \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Bibliographical reference\n\n Extended object dimensions \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\n\ndimensions \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0all fields related to object dimensions\n\ndim \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0main fields related to object dimensions: major and minor axis, angle and inclination\n\ndim_majaxis \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Major axis\n\ndim_minaxis \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Minor axis\n\ndim_angle \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0angle of the object\n\ndim_incl \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0inclination (unit of 15d: value from 0 to 6)\n\ndim_qual \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0quality (A: best, .., E: worst)\n\ndim_wavelength \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0wavelength type in which these dimensions were measured (Radio, IR, Visible, UV, X, Gamma)\n\ndim_bibcode \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Bibliographical reference\n\n Identifiers \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\n\nmain_id \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0main identifier of an astronomical object. It is the same as id(1)\n\nid(opt) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1 : display the first (main identifier) of the object. Is the same as main_id cat : display the identifier from the given catalog. If it doesn't exist, the field is left empty cat1|cat2|...[|1] : display the identifier from the first catalog, or, if it doesn't exits the one from the second identifier and so on. If none is found, the \t\t\t\tfield is left empty, except if |1 closes the list: then the \t\t\t\tfirst identifier is used. \n\n Bibliography \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\n\nbibcodelist(y1-y2) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0number of references. The parameter is optional and limit the count to the references between the years y1 and y2\n\n Measurement catalogs \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0For each measurement catalog, the VOTable contains all fields of the first measurement. When applicable, the first measurement is the mean one. \n\nmeasurements \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0display all fields from all measurements (291 fields)\n\n cel \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Celescope catalog of ultra-violet photometry\n\n cl.g \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Cluster of Galaxies: Abell & Corwin,Astrophys. J. Suppl.,70,1 (1989)\n\n einstein \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0The Einstein Observatory Soft X-ray Source List\n\n fe_h \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0The Stellar Metallicity Values taken from the compilation by Cayrel de Strobel G.,et all (1997A&AS..124..299C)\n\n gcrv \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0General Catalogue of Radial Velocities\n\n gen \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Geneva Photometric System Catalogue\n\n gj \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Gliese Jahreiss Nearby Stars (Catalog of stars within 20 parsecs of the Sun)\n\n hbet \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0The Hbeta photometric system (Crawford and Mander,1966,Astron. J. 7,114)\n\n hbet1 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0The Hbeta photometric system (Crawford and Mander,1966,Astron. J. 7,114)\n\n hgam \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Catalogue of equivalent width of Hgamma line from Petrie et al. (1973PDAO...14..151P)\n\n iras \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0InfraRed Astronomical Satellite Measurements extracted from the IRAS Point Source Catalog, 2nd Edition\n\n irc \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Infra-red measurements by Neugebauer and Leighton, Caltech, NASA, 1969\n\n iso \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Infrared Space Observatory (ISO) log\n\n iue \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0International Ultraviolet Explorer\n\n jp11 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0UBVRIJKLMNH Johnson s photometry\n\n mk \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0MK classifications in the Morgan-Keenan system and the Michigan Catalogues of Two-Dimensional Spectral Types for the HD stars (Houk N.,1975,and seq.)\n\n orv \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0oRV stellar radial velocities (will shortly replace the GCRV measurements.\n\n mesplx \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Parallax measurements\n\n mespm \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0compilation of measurements of stellar proper motions (except SAO catalogue). These data are presently given at equinox and epoch 1950, in the FK4 system.\n\n pos \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0compilation of measurements of stellar positions (except SAO data)\n\n posa \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Measurements of Position (since June 1998)\n\n rot \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Stellar Rotational Velocities\n\n rvel \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Radial velocities of galaxies\n\n sao \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0SAO catalogue (Star catalog of 258997 stars for the epoch and equinox 1950.0,1966)\n\n td1 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0UV fluxes from TD1 satellite,by Thompson et al.\n\n ubv \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0UBV data in Johnson's UBV system compiled by J.-Cl. Mermilliod from Institut d Astronomie de Lausanne (1973A&AS...71..413M)\n\n uvby \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0The Str\u00f6mgren uvby photometric system\n\n uvby1 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0The Str\u00f6mgren uvby photometric system\n\n v* \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0variable stars parameters extracted mainly from the General Catalog of Variable Stars by Kukarkin et al. USSR Academy of Sciences (3rd edition in 1969,and continuations)\n\n xmm \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0XMM log\n\n z \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Redshift data for extragalactic sources\n\n ze \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Redshift data for extragalactic sources (with error on redshift)\n"
}
],
"prompt_number": 6
},
{
"cell_type": "markdown",
"source": "This fetches the table data as utf-8 encoded. todo : find a way to display this nicely..."
},
{
"cell_type": "code",
"collapsed": true,
"input": "",
"language": "python",
"outputs": []
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment