pyaavso¶
pyaavso is a Python library for working with AAVSO (American Association of Variable Star Observers) data. The library is compatible with Python 3.3+.
Features¶
- reading and writing variable star observations in AAVSO’s Visual File Format
- downloading all observation data for a given observer
Usage¶
The following code uses VisualFormatWriter
to report a single
observation of SS Cyg between the outbursts.
>>> from pyaavso.formats import VisualFormatWriter
>>> observer_code = 'XYZ'
>>> with open('data.txt', 'wb') as fp:
... writer = VisualFormatWriter(fp, observer_code)
... writer.writerow({
... 'name': 'SS CYG',
... 'date': '2450702.1234',
... 'magnitude': '<11.0',
... 'comp1': '110',
... 'chart': '070613',
... })
The data.txt
file can be now submitted to AAVSO.
Resources¶
Author¶
- Zbigniew Siciarz (zbigniew at siciarz dot net)
License¶
pyaavso is free software, licensed under the MIT/X11 License. A copy of the license is provided with the source code in the LICENSE file.
Documentation¶
Usage¶
Basic usage¶
The following example shows how to use pyaavso to download all observations by a given observer.
import sys
import logging
from pyaavso.formats import VisualFormatWriter
from pyaavso.utils import download_observations
if __name__ == '__main__':
# configure logging so we can see some informational output
logger = logging.getLogger('pyaavso.utils')
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler())
try:
observer_code = sys.argv[1]
except IndexError:
print('Usage: python download_observations.py <OBSERVER_CODE>')
else:
observations = download_observations(observer_code)
print('All done.\nDownloaded %d observations.' % len(observations))
filename = '%s.txt' % observer_code
with open(filename, 'w') as fp:
writer = VisualFormatWriter(fp, observer_code)
for observation in observations:
writer.writerow(observation)
print('Observations written to file %s.' % filename)
API reference¶
Subpackages¶
parsers Package¶
webobs
Module¶
-
class
pyaavso.parsers.webobs.
WebObsResultsParser
(html_source)¶ Parser for WebObs search results page.
The parser reads an HTML page with search results (presented as a table) and parses the table into a list of observations.
Creates the parser and feeds it source code of the page.
-
get_observations
()¶ Parses the HTML table into a list of dictionaries, each of which represents a single observation.
-
utils
Module¶
-
pyaavso.utils.
download_observations
(observer_code)¶ Downloads all variable star observations by a given observer.
Performs a series of HTTP requests to AAVSO’s WebObs search and downloads the results page by page. Each page is then passed to
WebObsResultsParser
and parse results are added to the final observation list.
Development¶
Feature roadmap¶
- implement the Extended File Format
- add VSX search
- add programmatic access to lightcurves generated by LCG
- create an API client for Variable Star Plotter
Contributing¶
Looking to improve pyaavso? Here’s how you can help.
Report issues¶
If you think you found a bug in pyaavso or have a feature request, feel free to file an issue. We rely on GitHub for issue tracking. Please, search through existing issues before you report a new one; perhaps your problem was already discussed or fixed.
When submitting an issue, please include the following:
- problem description
- steps to reproduce (a smallest possible code example that reproduces the issue would be most welcome!)
- expected outcome
- actual outcome
- platform information: your operating system, Python version, etc.
- any other relevant information
Contribute code¶
Contributions to pyaavso source code are accepted as pull requests on GitHub. Fork the project, work on it in your repository and when you think your patch is ready, send us a pull request.
License¶
By contributing your code, you agree to license your contribution under
the terms of MIT license (see LICENSE
file for details).
Changelog¶
Unreleased¶
- none yet
0.2.0¶
- first Python 3-only release!
- Python 3.5 and 3.6 support
0.1.5¶
- fixed VisualFormatReader bug on Python 3 when input is bytes, not string
0.1.4¶
- minor packaging and documentation fixes
0.1.3¶
- Python 3.4 compatibility
- more specific Python version classifiers in setup.py
0.1.2¶
- added wheel distribution
0.1.1¶
- less memory-hungry VisualFormatReader
0.1.0¶
- initial release