Skip to main content

Generate VOEvent XMLs

Project description

VOEVENT-TOOLS-PKG

Python module that generates VOEvent XML from user-supplied data.

Requirements

  • Python 3.0.0+
  • Pandas 2.3.0+
  • Numpy 2.3.0+

Installation and Setup

(Recommended): Set up a python virtual environment

source .venv/bin/activate

Run the following commands to install the related dependencies, and then the package itself.

pip install pandas
pip install numpy
pip install voevent-tools-pkg

If you downloaded the package from source, you can install the package locally with the following command

pip install -e .

Modify the config.ini file to configure the XML output directory. You can also change the voevent spec file location, which by default is https://www.lmsal.com/hek/software/herconfig/VOEvent_Spec.txt

Supported Event Types and Attributes

The full list of event types and coresponding attributes can be found here: https://www.lmsal.com/hek/VOEvent_Spec.html

Current HEK entries does NOT support the latest VOEvent 2.0 schema.

How to use

Please refer to the included file demo_FL.py, which contains an example script on how to use voevent-tools-pkg.

First, import VOEvent-tools

from hek_voevent_tools import parse_features_file, create_event, export_event, load_config

Load from config.ini

config = load_config()
VOEVENT_SPEC = config['DEFAULT'].get('specs_location')
OUTPUT_PATH = config['DEFAULT'].get('output_path')

Convert the VOEvent_Spec file into a Pandas dataframe

csv_dataframe = parse_features_file(VOEVENT_SPEC)

Create the VOEvent object, in which you also provide the event type as a two letter abbreviation as listed in the specs file.

voevent = create_event(csv_dataframe, EVENT_TYPE='FL')

Assigned required and optional parameters

voevent.required['OBS_Observatory'] = 'SDO'
voevent.required['OBS_Instrument'] = 'AIA'
...
voevent.optional['FL_PeakFlux'] = "674.229"

Add citations

voevent.citation = {
  'action': 'supersedes',
  'description': 'Closing of open event'
}

Add a reference

voevent.reference.append({
  'name': 'Publication',
  'link': 'http://www.harvard.edu/',
  'type': 'html'
})

Display all information from a VOEvent object, including what is required or optional.

voevent.help()

Export the VOEvent object as an XML file. By default, the file location is defined at output_path in config.ini.

export_event(csv_dataframe, voevent, OUTPUT_PATH+'example.xml')

Running the unit tests

(Recommended): Install and run pytests

pip install pytest
pytest -v

You can also run the unit tests with Python's built-in unittest.

python -m unittest discover -s tests

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

hek_voevent_tools-1.0.0.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hek_voevent_tools-1.0.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file hek_voevent_tools-1.0.0.tar.gz.

File metadata

  • Download URL: hek_voevent_tools-1.0.0.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for hek_voevent_tools-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6ee6332a629fdc773b537df5c2225d0859d605cc43575cf4ed700e705fb360e6
MD5 c0d736c60bcfe1feb7d66bf88d028861
BLAKE2b-256 02b783eb677b1efd34b83a1d06cd0cd7515b123bb2d4877dfd52fcb984695ae3

See more details on using hashes here.

File details

Details for the file hek_voevent_tools-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for hek_voevent_tools-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b932e74538f5328d56bb6044f3033b10453f5f21b09fd3846d5b201e518eb970
MD5 318bb7c2cd6d7921b4162fe2b74e35a9
BLAKE2b-256 5a602b266a7d35758e6d1132ffd3e1ba4d597089af577fdec40de95cf37f0490

See more details on using hashes here.

Supported by

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