Skip to main content

Convenience routines for parsing and manipulation of VOEvent XML packets.

Project description

A bare-bones, lightweight library for parsing, manipulating, and generating VOEvent XML packets.

voevent-parse is available via PyPI. See below for details on installation.

Rationale

The python library lxml.objectify provides very elegant, attribute-style access to data stored in XML packets. However, dealing with the vagaries of its namespace handling requires some careful reading of the documentation. This library takes care of the details for you, so that accessing those vital data elements is as simple as:

v = voeparse.load(xml_filename)
print "AuthorIVORN:", v.Who.AuthorIVORN   #Prints ivo://nasa.gsfc.tan/gcn
v.Who.AuthorIVORN = 'ivo://i.heart.python/lxml' #Alters the XML value.

It also provides convenience routines for common data access tasks, saving you the hassle of typing out very long attribute chains and dealing with varying formats of VOEvent.

Installation

Take your pick; options are:

  • pip install voevent-parse (with a virtualenv, recommended)

  • pip install voevent-parse --user (to install for current user only)

  • Other development tricks e.g. symlink into ~/.local/lib/python2.7/site-packages.

I intend to mark any updates by bumping the version number accordingly. That said, if you find yourself using voevent-parse in any serious context, do drop me an email so I can keep you informed of any updates or bugs.

API reference docs

While currently quite minimal, these can be found at http://voevent-parse.readthedocs.org, or can be built from the source if you prefer the traditional python docs colour-scheme.

lxml.objectify tips

The objectify library has a few syntactic quirks which can trip up new users. Firstly, you should be aware that the line root.foo actually returns an object that acts like a list of all the children with the name ‘foo’. What’s confusing is that objectify has syntactic sugar applied so that print root.foo is effectively identical to print root.foo[0]. Furthermore, this can confuse access to the actual leaf values, so you should be aware of the accessor to the text representation of the value; .text, e.g.:

>root = lxml.objectify.Element('root')
>root.foo = 'sometext'
>root.foo
'sometext'
>len(root.foo)
1
>#The string clearly does not have length==1 - it's the list.
>root.foo.text
'sometext'
>print len(root.foo.text)
8
>#Ah, that's better!

For some more examples, you might also try: http://www.saltycrane.com/blog/2011/07/example-parsing-xml-lxml-objectify/.

See also

Alternative parsing libraries

voevent-parse was preceded by VOEventLib, which has similar aims but a different stylistic approach (see http://lib.skyalert.org/VOEventLib/VOEventLib/doc/index.html ).

Brokers

In order to receive VOEvent packets, you will require a utility capable of connecting to the VOEvent backbone. Two such tools are Comet and Dakota.

Associated utility routines

Depending on what you want to use your VOEvents for, you may be interested in pysovo, a collection of routines for dealing with VOEvents and responding to them accordingly.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

voevent-parse-0.4.3.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

voevent-parse-0.4.3.linux-x86_64.exe (80.4 kB view details)

Uploaded Source

File details

Details for the file voevent-parse-0.4.3.tar.gz.

File metadata

File hashes

Hashes for voevent-parse-0.4.3.tar.gz
Algorithm Hash digest
SHA256 bb794ee39f561590e407de8775f854929e03c52da0fc569a0cfc9e375b46e7fc
MD5 accb2a98f11f1745c7f908aa57f04f77
BLAKE2b-256 f3ec556f93b30f763ea5cce2dbdb6733de93841ee4799fa69ad8ef2e69e98e61

See more details on using hashes here.

File details

Details for the file voevent-parse-0.4.3.linux-x86_64.exe.

File metadata

File hashes

Hashes for voevent-parse-0.4.3.linux-x86_64.exe
Algorithm Hash digest
SHA256 cb34f94f4eb4653d6cc28122e6bdf2c06c3572ef3ff9037437a1d0e32abbf987
MD5 5d2d6ca1fd7c2efe27a8c9b68b71297e
BLAKE2b-256 d5c4b7abde13fe1a7849ed5df4749db6101ed4d3d9dc10fbd0949a9974f8fed2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page