2020from pathlib import Path
2121import tarfile
2222import os
23- from astroquery import log
24- import configparser
2523
2624from astropy .io import fits
27- from . import conf
25+ from . import conf , config
2826from astroquery import log
2927from astropy .coordinates import SkyCoord
3028from ...exceptions import LoginError
3129
30+
3231__all__ = ['XMMNewton' , 'XMMNewtonClass' ]
3332
3433
3534class XMMNewtonClass (BaseQuery ):
35+
3636 data_url = conf .DATA_ACTION
3737 data_aio_url = conf .DATA_ACTION_AIO
3838 metadata_url = conf .METADATA_ACTION
3939 TIMEOUT = conf .TIMEOUT
4040
4141 def __init__ (self , tap_handler = None ):
4242 super (XMMNewtonClass , self ).__init__ ()
43- self .configuration = configparser .ConfigParser ()
4443
4544 if tap_handler is None :
4645 self ._tap = TapPlus (url = "https://nxsa.esac.esa.int/tap-server/tap" )
@@ -49,7 +48,7 @@ def __init__(self, tap_handler=None):
4948 self ._rmf_ftp = str ("http://sasdev-xmm.esac.esa.int/pub/ccf/constituents/extras/responses/" )
5049
5150 def download_data (self , observation_id , * , filename = None , verbose = False ,
52- cache = True , prop = False , credentials_file = None , ** kwargs ):
51+ cache = True , prop = False , username = None , password = None , ** kwargs ):
5352 """
5453 Download data from XMM-Newton
5554
@@ -64,13 +63,6 @@ def download_data(self, observation_id, *, filename=None, verbose=False,
6463 verbose : bool
6564 optional, default 'False'
6665 flag to display information about the process
67- prop: boolean
68- optional, default 'False'
69- flag to download proprietary data, the method will then ask the user to
70- input their username and password either manually or using the credentials_file
71- credentials_file: string
72- optional, default None
73- path to where the users config.ini file is stored with their username and password
7466 level : string
7567 level to download, optional, by default everything is downloaded
7668 values: ODF, PPS
@@ -113,7 +105,7 @@ def download_data(self, observation_id, *, filename=None, verbose=False,
113105 reveals the url being sent which in turn reveals the users username and password
114106 """
115107 previouslevel = log .getEffectiveLevel ()
116- log .setLevel (21 )
108+ log .setLevel (50 )
117109
118110 # create url to access the aio
119111 link = self ._create_link (observation_id , ** kwargs )
@@ -130,6 +122,7 @@ def download_data(self, observation_id, *, filename=None, verbose=False,
130122 params = self ._request_link (link , cache )
131123 r_filename = params ["filename" ]
132124 suffixes = Path (r_filename ).suffixes
125+ print (suffixes )
133126
134127 # get desired filename
135128 filename = self ._create_filename (filename , observation_id , suffixes )
@@ -306,7 +299,7 @@ def _request_link(self, link, cache):
306299 return params
307300
308301 def _get_username_and_password (self , credentials_file ):
309- if credentials_file != None :
302+ if credentials_file is not None :
310303 self .configuration .read (credentials_file )
311304 username = self .configuration .get ('user' , 'username' )
312305 password = self .configuration .get ('user' , 'password' )
0 commit comments