Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All APIs returning star identifiers should return user-preferred alias #4

Open
rickyegeland opened this issue Mar 23, 2018 · 0 comments

Comments

@rickyegeland
Copy link
Contributor

Currently APIs returning stars return the canonical star name, which is set by SIMBAD. Users must build a list of names of their preferred alias (e.g. HD number). For example:

    # Fetch Cycle Data from sunstardb
    result = db.fetch_data_table('Baliunas1995', ['S_mean', 'activity_class', 'Pcyc', 'Pcyc2'], meta={'Pcyc':'FAPGrade'}, nulls=True)

    # Add an HD number column
    hds = []
    hdnums = []
    for star in result['star']:
        if star == 'Sun':
            hd = 'Sun'
            num = 0
        else:
            hd = db.fetch_star_alias(name=star, type='HD')
            num = int(re.match('^HD (\d+)', hd).group(1))
        hds.append(hd)
        hdnums.append(num)
    result['HD'] = hds
    result['Sort'] = hdnums

(Here the 'Sort' column allows the astropy.table.Table to sort the HD numbers in numerical, not lexical, order.)

Instead the user should be able to specify a list of preferred alias types. API example:

    # Fetch Cycle Data from sunstardb
    result = db.fetch_data_table('Baliunas1995', ['S_mean', 'activity_class', 'Pcyc', 'Pcyc2'], meta={'Pcyc':'FAPGrade'}, nulls=True, star_alias=['HD', 'GJ'])

If aliases are not available, the default can be the canonical identifier (star.name in the DB)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant