#!/usr/bin/env python # -*- coding: utf-8 -*- from astropy.io.votable import parse_single_table from astropy.time import Time from astropy.coordinates import SkyCoord from mapper import Mapper from iterator import Iterator import matplotlib.pyplot as plt import numpy as np import sys , pprint def main(): """ VOTable processing """ # Read the annotations file_to_process = "../../data/SDSS_VizieR_ts.xml" mapper = Mapper("SDSS", file_to_process) mapper.read_annotation() # Read data and initiate an iterator iterator = Iterator(file_to_process, mapper) pp = pprint.PrettyPrinter(indent=4) x = [] y = [] header = {} print(mapper.__str__()) while iterator.hasNext() : #pp.pprint( iterator.next_object()) response = iterator.next_object() print(iterator.get_listed_columns()) ##print(response.__repr__()) for k,v in response.items() : if not k.startswith("#"): header[k] = v data = response["#cube:SparseCube.data"] for point in data: x.append(point['JD.date']) y.append(point['PhysicalCoordValue.cval']) # Let's assume we have only one TS in this file """ Plotting section """ fig, ax1 = plt.subplots() plt.plot(x, y, "bo", markersize=1) plt.xlabel('Time') plt.ylabel('Mag') ax1.text(x[0], min(y), pp.pformat(header), fontsize=8) plt.show() if __name__ == "__main__": main()