API reference

pygcvs Package

class pygcvs.__init__.GcvsParser(fp)

A parser for GCVS data format.

Example usage:

>>> with open('iii.dat', 'rb') as fp:
...     parser = GcvsParser(fp)
...     for star in parser:
...         print(star['name'])
R AND
S AND
#...
V0515 VUL
V0516 VUL

Creates the parser and feeds it a file-like object.

Parameters:fp – a file-like object or a generator yielding strings
parse_coordinates(coords_str)

Returns a pair of PyEphem-compatible coordinate strings (Ra, Dec).

If the star has no coordinates in GCVS (there are such cases), a pair of None values is returned.

parse_epoch(epoch_str)

Converts epoch field to a float value (adding 24… prefix), or None if there is no epoch in GCVS record.

parse_magnitude(magnitude_str)

Converts magnitude field to a float value, or None if GCVS does not list the magnitude.

Returns a tuple (magnitude, symbol), where symbol can be either an empty string or a single character - one of ‘<’, ‘>’, ‘(‘.

parse_name(name_str)

Normalizes variable star designation (name).

parse_period(period_str)

Converts period field to a float value or None if there is no period in GCVS record.

row_to_dict(row)

Converts a raw GCVS record to a dictionary of star data.

pygcvs.__init__.dict_to_body(star_dict)

Converts a dictionary of variable star data to a Body instance.

Requires PyEphem to be installed.

pygcvs.__init__.read_gcvs(filename)

Reads variable star data in GCVS format.

Parameters:filename – path to GCVS data file (usually iii.dat)

pygcvs.parser Module

class pygcvs.parser.GcvsParser(fp)

A parser for GCVS data format.

Example usage:

>>> with open('iii.dat', 'rb') as fp:
...     parser = GcvsParser(fp)
...     for star in parser:
...         print(star['name'])
R AND
S AND
#...
V0515 VUL
V0516 VUL

Creates the parser and feeds it a file-like object.

Parameters:fp – a file-like object or a generator yielding strings
parse_constellation(constellation_str)
parse_coordinates(coords_str)

Returns a pair of PyEphem-compatible coordinate strings (Ra, Dec).

If the star has no coordinates in GCVS (there are such cases), a pair of None values is returned.

parse_epoch(epoch_str)

Converts epoch field to a float value (adding 24… prefix), or None if there is no epoch in GCVS record.

parse_magnitude(magnitude_str)

Converts magnitude field to a float value, or None if GCVS does not list the magnitude.

Returns a tuple (magnitude, symbol), where symbol can be either an empty string or a single character - one of ‘<’, ‘>’, ‘(‘.

parse_name(name_str)

Normalizes variable star designation (name).

parse_period(period_str)

Converts period field to a float value or None if there is no period in GCVS record.

row_to_dict(row)

Converts a raw GCVS record to a dictionary of star data.