XMMNewtonClass

class astroquery.esa.xmm_newton.XMMNewtonClass(tap_handler=None)[source]

Bases: astroquery.query.BaseQuery

Attributes Summary

TIMEOUT

data_aio_url

data_url

metadata_url

Methods Summary

download_data(observation_id, *[, filename, …])

Download data from XMM-Newton

get_columns(table_name, *[, only_names, verbose])

Get the available columns for a table in XSA TAP service

get_epic_images(filename, *[, band, …])

Extracts the European Photon Imaging Camera (EPIC) images from a given TAR file

get_epic_metadata(*[, target_name, …])

Downloads the European Photon Imaging Camera (EPIC) metadata from a given target

get_postcard(observation_id, *[, …])

Download postcards from XSA

get_tables(*[, only_names, verbose])

Get the available table in XSA TAP service

query_xsa_tap(query, *[, output_file, …])

Launches a synchronous job to query the XSA tap

Attributes Documentation

TIMEOUT = 60
data_aio_url = 'http://nxsa.esac.esa.int/nxsa-sl/servlet/data-action-aio?'
data_url = 'http://nxsa.esac.esa.int/nxsa-sl/servlet/data-action?'
metadata_url = 'http://nxsa.esac.esa.int/nxsa-sl/servlet/metadata-action?'

Methods Documentation

download_data(observation_id, *, filename=None, verbose=False, **kwargs)[source]

Download data from XMM-Newton

Parameters
observation_idstring

id of the observation to be downloaded, mandatory The identifier of the observation we want to retrieve, 10 digits example: 0144090201

filenamestring

file name to be used to store the file

verbosebool

optional, default ‘False’ flag to display information about the process

levelstring

level to download, optional, by default everything is downloaded values: ODF, PPS

instnamestring

instrument name, optional, two characters, by default everything values: OM, R1, R2, M1, M2, PN

instmodestring

instrument mode, optional examples: Fast, FlatFieldLow, Image, PrimeFullWindow

filterstring

filter, optional examples: Closed, Open, Thick, UVM2, UVW1, UVW2, V

expflagstring

exposure flag, optional, by default everything values: S, U, X(not applicable)

expnointeger

exposure number with 3 digits, by default all exposures examples: 001, 003

namestring

product type, optional, 6 characters, by default all product types examples: 3COLIM, ATTTSR, EVENLI, SBSPEC, EXPMAP, SRCARF

datasubsetnocharacter

data subset number, optional, by default all examples: 0, 1

sourcenohex value

source number, optional, by default all sources example: 00A, 021, 001

extensionstring

file format, optional, by default all formats values: ASC, ASZ, FTZ, HTM, IND, PDF, PNG

Returns
None if not verbose. It downloads the observation indicated
If verbose returns the filename
get_columns(table_name, *, only_names=True, verbose=False)[source]

Get the available columns for a table in XSA TAP service

Parameters
table_namestring, mandatory, default None

table name of which, columns will be returned

only_namesbool, TAP+ only, optional, default ‘True’

True to load table names only

verbosebool, optional, default ‘False’

flag to display information about the process

Returns
A list of columns
get_epic_images(filename, *, band=[], instrument=[], get_detmask=False, get_exposure_map=False, path='')[source]

Extracts the European Photon Imaging Camera (EPIC) images from a given TAR file

For a given TAR file obtained with:

XMM.download_data(OBS_ID,level=”PPS”,extension=”FTZ”,filename=tarfile)

This function extracts the EPIC images in a given band (or bands) and instrument (or instruments) from it

The result is a dictionary containing the paths to the extracted EPIC images with keys being the band and the instrument

If the band or the instrument are not specified this function will return all the available bands and instruments

Additionally, get_detmask and get_exposure_map can be set to True. If so, this function will also extract the exposure maps and detector masks within the specified bands and instruments

Parameters
filenamestring, mandatory

The name of the tarfile to be proccessed

bandarray of integers, optional, default []

An array of intergers indicating the desired bands

instrumentsarray of strings, optional, default []

An array of strings indicating the desired instruments

get_detmaskbool, optional

If True, also extracts the detector masks

get_exposure_mapbool, optional

If True, also extracts the exposure maps

path: string, optional

If set, extracts the EPIC images in the indicated path

Returns
A dictionary of dictionaries with the full paths of the extracted
EPIC images. The keys of each dictionary are the band for the first
level dictionary and the instrument for the second level dictionaries

Notes

The structure and the content of the extracted compressed FITS files are described in details in the Pipeline Products Description [XMM-SOC-GEN-ICD-0024](https://xmm-tools.cosmos.esa.int/external/xmm_obs_info/odf/data/docs/XMM-SOC-GEN-ICD-0024.pdf).

Examples

Extract all bands and instruments::
result = XMM.get_epic_images(tarfile,band=[1,2,3,4,5,8],

instrument=[‘M1’,’M2’,’PN’],**kwargs)

If we want to retrieve the band 3 for the instrument PN (p-n junction)::

fits_image = result[3][‘PN’]

fits_image will be the full path to the extracted FTZ file

Extract the exposure and detector maps::
result = XMM.get_epic_images(tarfile,band=[1,2,3,4,5,8],

instrument=[‘M1’,’M2’,’PN’], get_detmask=True, get_exposure_map=True)

If we want to retrieve exposure map in the band 3 for the instrument PN::

fits_image = result[3][‘PN_expo’]

For retrieving the detector mask in the band 3 for the instrument PN::

fits_image = result[3][‘PN_det’]

get_epic_metadata(*, target_name=None, coordinates=None, radius=None)[source]

Downloads the European Photon Imaging Camera (EPIC) metadata from a given target

Parameters
target_namestring, optional, default None

The name of the target

coordinatesSkyCoord, optinal, default None

The coordinates of the target in a SkyCoord object

radiusfloat, optional, default None

The radius to query the target in degrees

Returns
epic_source, cat_4xmm, stack_4xmm, slew_sourceTable objects

Tables containing the metadata of the target

get_postcard(observation_id, *, image_type='OBS_EPIC', filename=None, verbose=False)[source]

Download postcards from XSA

Parameters
observation_idstring

id of the observation for which download the postcard, mandatory The identifier of the observation we want to retrieve, regardless of whether it is simple or composite.

image_typestring

image type, optional, default ‘OBS_EPIC’ The image_type to be returned. It can be: OBS_EPIC, OBS_RGS_FLUXED, OBS_RGS_FLUXED_2, OBS_RGS_FLUXED_3, OBS_EPIC_MT, OBS_RGS_FLUXED_MT, OBS_OM_V, OBS_OM_B, OBS_OM_U, OBS_OM_L, OBS_OM_M, OBS_OM_S, OBS_OM_W

filenamestring

file name to be used to store the postcard, optional, default None

verbosebool

optional, default ‘False’ Flag to display information about the process

Returns
None. It downloads the observation postcard indicated
get_tables(*, only_names=True, verbose=False)[source]

Get the available table in XSA TAP service

Parameters
only_namesbool, TAP+ only, optional, default ‘True’

True to load table names only

verbosebool, optional, default ‘False’

flag to display information about the process

Returns
A list of tables
query_xsa_tap(query, *, output_file=None, output_format='votable', verbose=False)[source]

Launches a synchronous job to query the XSA tap

Parameters
querystr, mandatory

query (adql) to be executed

output_filestr, optional, default None

file name where the results are saved if dumpToFile is True. If this parameter is not provided, the jobid is used instead

output_formatstr, optional, default ‘votable’

possible values ‘votable’ or ‘csv’

verbosebool, optional, default ‘False’

flag to display information about the process

Returns
A table object