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

Update healpixgrp() in path.py to group by 1000 instead of by 100. #23

Merged
merged 2 commits into from
Oct 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 55 additions & 2 deletions python/sdss_access/path/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -1125,13 +1125,66 @@ def healpixgrp(self, filetype, **kwargs):
Returns
-------
healpixgrp : str
HEALPix group directory, HEALPix//100.
HEALPix group directory, HEALPix//1000.

'''

healpix = int(kwargs['healpix'])
subdir = "{:d}".format(healpix//100)
subdir = "{:d}".format(healpix//1000)
return subdir

def apgprefix(self, filetype, **kwargs):
''' Returns APOGEE prefix using telescope/instrument.

Parameters
----------
filetype : str
File type parameter.
telescope : str
The APOGEE telescope (apo25m, lco25m, apo1m).
instrument : str
The APOGEE instrument (apogee-n, apogee-s).

Returns
-------
prefix : str
The APOGEE prefix (ap/as).

'''

telescope = kwargs.get('telescope')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To ensure that telescope is set to None if it is not present in the kwargs, try telescope = kwargs.get('telescope', None). Otherwise this will throw an uncaught error.

if telescope is not None:
prefix = {'apo25m':'ap', 'apo1m':'ap', 'lco25m':'as'}[telescope]
return prefix
instrument = kwargs.get('instrument')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar here as with previous comment on telescope

if instrument is not None:
prefix = {'apogee-n':'ap', 'apogee-s':'as'}[instrument]
return prefix
return ''

def apginst(self, filetype, **kwargs):
''' Returns APOGEE "instrument" from "telescope".
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this function to work, it needs a telescope kwarg. Are there any paths that do not have telescope but have instrument as a kwarg? If so, is the plan to migrate those over to use telescope and this function?


Parameters
----------
filetype : str
File type parameter.
telescope : str
The APOGEE telescope (apo25m, lco25m, apo1m).

Returns
-------
instrument : str
The APOGEE instrument (apogee-n, apogee-s).

'''

telescope = kwargs.get('telescope')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar here as with previous comments.

if telescope is not None:
instrument = {'apo25m':'apogee-n', 'apo1m':'apogee-n', 'lco25m':'apogee-s'}[telescope]
return instrument
return ''


class AccessError(Exception):
pass