Skip to content

Commit

Permalink
address the first round of review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
zoghbi-a committed Jul 9, 2024
1 parent baf95ed commit 00af79e
Show file tree
Hide file tree
Showing 25 changed files with 24 additions and 9,325 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Service fixes and enhancements
heasarc
^^^^^^^

- Refactor heasarc to use the VO backend. The old Heasarc class is now HeasarcBrowser [#2997]
- Refactor heasarc to use the VO backend. [#2997]

mpc
^^^
Expand Down
7 changes: 0 additions & 7 deletions astroquery/heasarc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@
The High Energy Astrophysics Science Archive Research Center (HEASARC)
is the primary archive for NASA's (and other space agencies') missions.
The initial version of this was coded in a sprint at the
"Python in astronomy" workshop in April 2015 by Jean-Christophe Leyder,
Abigail Stevens, Antonio Martin-Carrillo and Christoph Deil.
Updates to use the XAMIN service was added by Abdu Zoghbi
"""
from astropy import config as _config

Expand Down
26 changes: 13 additions & 13 deletions astroquery/heasarc/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
import pyvo

from astroquery import log
from ..query import BaseQuery
from ..query import BaseQuery, BaseVOQuery
from ..utils import commons, async_to_sync, parse_coordinates
from ..exceptions import InvalidQueryError, NoResultsWarning
from . import conf


@async_to_sync
class HeasarcClass(BaseQuery):
class HeasarcClass(BaseVOQuery, BaseQuery):
"""Class for accessing HEASARC data using XAMIN.
Example Usage:
Expand Down Expand Up @@ -60,7 +60,7 @@ def _meta(self):
This is a table that holds useful information such as
the list of default columns per table, the reasonable default
search radius per table that is appropriate for a mission etc.
Instead of making a server call for each of that type information,
Instead of making a server call for each table for that type information,
we do a single one and then post-process the resulting table.
These are not meant to be used directly by the user.
Expand Down Expand Up @@ -102,7 +102,7 @@ def _get_default_cols(self, table_name):
defaults = meta['par']
return defaults

def get_default_radius(self, table_name):
def _get_default_radius(self, table_name):
"""Get a mission-appropriate default radius for a table
Parameters
Expand Down Expand Up @@ -194,7 +194,7 @@ def query_mission_list(self, *, cache=True, get_query_payload=False):
return self.tables(master=False)

def columns(self, table_name, full=False):
"""Return a dictionay of the columns available in table_name
"""Return the columns available in table_name as a table
Parameters
----------
Expand Down Expand Up @@ -327,7 +327,7 @@ def query_region(self, position=None, table=None, radius=None, *,
`astropy.units` may also be used. If None, a default value
appropriate for the selected table is used. To see the default
radius for the table, see
~astroquery.heasarc.Heasarc.get_default_radius.
~astroquery.heasarc.Heasarc._get_default_radius.
width : str, `~astropy.units.Quantity` object [Required for
spatial == ``'box'``.]
The string must be parsable by `~astropy.coordinates.Angle`. The
Expand Down Expand Up @@ -397,7 +397,7 @@ def query_region(self, position=None, table=None, radius=None, *,

if spatial.lower() == 'cone':
if radius is None:
radius = self.get_default_radius(table)
radius = self._get_default_radius(table)
elif isinstance(radius, str):
radius = coordinates.Angle(radius)
where = (" WHERE CONTAINS(POINT('ICRS',ra,dec),CIRCLE("
Expand Down Expand Up @@ -462,7 +462,7 @@ def query_object(self, object_name, mission, *,
return self.query_region(pos, table=mission, spatial='cone',
get_query_payload=get_query_payload)

def get_links(self, query_result=None, tablename=None):
def get_datalinks(self, query_result=None, tablename=None):
"""Get links to data products
Use vo/datalinks to query the data products for some query_results.
Expand Down Expand Up @@ -567,7 +567,7 @@ def enable_cloud(self, provider='aws', profile=None):
self.s3_resource = boto3.resource('s3')

else:
log.info('Enabling cloud data access with profile: {profile} ...')
log.info(f'Enabling cloud data access with profile: {profile} ...')
session = boto3.session.Session(profile_name=profile)
self.s3_resource = session.resource(service_name='s3')

Expand All @@ -581,7 +581,7 @@ def download_data(self, links, host='heasarc', location='.'):
Parameters
----------
links : `astropy.table.Table`
The result from get_links
The result from get_datalinks
host : str
The data host. The options are: heasarc (defaul), sciserver, aws.
If host == 'sciserver', data is copied from the local mounted
Expand All @@ -608,7 +608,7 @@ def download_data(self, links, host='heasarc', location='.'):
if host_column not in links.colnames:
raise ValueError(
f'No {host_column} column found in the table. Call '
'~get_links first'
'~get_datalinks first'
)

if host == 'heasarc':
Expand All @@ -635,7 +635,7 @@ def _download_heasarc(self, links, location='.'):
Parameters
----------
links : `astropy.table.Table`
The result from get_links
The result from get_datalinks
location : str
local folder where the downloaded file will be saved.
Default is current working directory
Expand Down Expand Up @@ -690,7 +690,7 @@ def _copy_sciserver(self, links, location='.'):
Users should be using ~self.download_data instead
"""
if not os.path.exists('/FTP/'):
if not (os.path.exists('/FTP/') and os.environ['HOME'].split('/')[-1] == 'idies'):
raise FileNotFoundError(
'No data archive found. This should be run on Sciserver '
'with the data drive mounted.'
Expand Down
Loading

0 comments on commit 00af79e

Please sign in to comment.