%matplotlib inline
import matplotlib.pyplot as plt
In this example we show how to review the content of a DR2 source using MPDAF
from mpdaf.sdetect.source import Source
src = Source.from_file('DR2_MXDF_001037.fits')
To display a summary of its content use the src.info() method
src.info()
In the source header we find the MUSE catalog ID and DATASET, plus some matched catalogs ID
print("** Source Identifiers **")
print(f"Main MUSE ID: {src.ID} DATASET: {src.DATASET}")
print(f"ORIGIN ID: {src.ORI_ID}")
print(f"Matched Catalogs RAFELSKI ID: {src.RAF_ID} 3D-HST ID: {src.C3DHST_ID} CANDELS ID: {src.CANDELS_ID}")
The exposure map average over the source field is availble and the corresponding depth in hours. The depth in hours can also be computed by scaling the number of exposure, using the 25 min integration time of one exposure
print("** Source Exposure Map and Depth **")
print(f"Number of combined exposures, Mean:{src.EXPMEAN:.2f} Min:{src.EXPMIN:.2f} Max:{src.EXPMAX:.2f}")
print(f"Mean Depth in hours: {src.DEPTH:.2f}")
f = 25.0/60.0
print(f"Depth in hours, Mean:{f*src.EXPMEAN:.2f} Min:{f*src.EXPMIN:.2f} Max:{f*src.EXPMAX:.2f}")
The reference center for the source location is given. Locations of the matched source are also given with their offset in arcsec with respect to the source center.
print("** Source Location and offsets **")
print(f"Reference location: {src.REFCENTER}")
print(f"Source location RA: {src.RA:.5f} DEC: {src.DEC:.5f}")
print(f"OFFSETS (arcsec) ORIGIN {src.ORI_OFF:.2f} RAFELSKI {src.RAF_OFF:.2f} CANDELS {src.CANDELS_OFF:.2f} 3D-HST {src.C3DHST_OFF:.2f}")
There can be more than one redshift measurement (e.g. forbidden lines or lyman-alpha). These redshift information are given in a specific table PL_Z. The reference redshift is given and can be used to get the source redshift. The table PL_Z contains additional information which are discussed later.
print("** Source Redshift **")
print(f"Redshift confidence: {src.ZCONF}")
tab = src.tables['PL_Z']
z = tab[tab['FAMILY']==src.REFZ]['Z'][0]
print(f"Reference redshift: {src.REFZ} Z:{z:.5f}")
As discussed in the paper, various signal extractions have been used, each one result in a spectrum. The reference one is the one used for redshift measurement and lines fitting information. The reference spectrum is in MPDAF format. See https://mpdaf.readthedocs.io/en/latest/api/mpdaf.obj.Spectrum.html#mpdaf.obj.Spectrum for the list of available methods. In the follwing we plot the reference spectra. We also display the platefit line fit in a zoomed region.
ref = src.spectra[src.REFSPEC]
fig,ax = plt.subplots(1,2,figsize=(17,5),sharey=True)
ax[0].set_title(f"Reference spectrum: {src.REFSPEC}")
ref.plot(ax=ax[0])
ref.plot(ax=ax[1], lmin=8000, lmax=8400, label='ref', noise=True)
src.spectra['PL_FIT'].plot(ax=ax[1], lmin=8000, lmax=8400, color='r', label='platefit')
ax[1].legend();
The source contain a list of images. In the following we display the white light image, the OIII4959+OIII5007 narrow band and its segmentation image.
fig,ax = plt.subplots(1,3,figsize=(17,5))
src.images['MUSE_WHITE'].plot(ax=ax[0], scale='arcsinh', colorbar='v')
src.images['NB_EMI_OIII5000'].plot(ax=ax[1], scale='arcsinh', colorbar='v')
src.images['SEGNB_EMI_OIII5000'].plot(ax=ax[2], cmap='Paired')
Right panel displat the location of Rafelski sources is shown here, overlaid on the HST F775W image. Left panel the DR2 catalog ovralaid on the WHITE light image. Note we use the MPDAF Catalog class (based on astropy table), which has additional methods, such as plot_symb.
from mpdaf.sdetect import Catalog
fig,ax = plt.subplots(1,2,figsize=(18,8))
ima = src.images['HST_F775W']
ima.plot(ax=ax[0], vmin=-0.005, vmax=0.05, scale='arcsinh', cmap='Greys')
tab = Catalog(src.tables['HST_CAT'])
tab.plot_symb(ax[0], ima.wcs, ra='RA', dec='DEC', id='ID', label=True, ecol='b', esize=0.3, fontsize=12, tcol='r')
ax[0].set_title('image: HST_F775W catalog: HST_CAT');
ima = src.images['MUSE_WHITE']
ima.plot(ax=ax[1], scale='arcsinh', cmap='Greys')
tab = Catalog(src.tables['DR2_CAT'])
tab = tab[tab['DATASET']=='MXDF']
tab.plot_symb(ax[1], ima.wcs, ra='RA', dec='DEC', id='ID', label=True, ecol='b', esize=0.3, fontsize=12, tcol='r')
ax[1].set_title('image: MUSE_WHITE catalog: DR2_CAT');
The platefit results are available in the PL_LINES table. Here we list all individual forbidden lines which (we exclude the blended line OII3727b)
tab = src.tables['PL_LINES']
tab[(tab['FAMILY']=='forbidden') & (~tab['ISBLEND'])]
In this example we use the datacube itself to estimate the flux at the Rafelski ID 4663 location
cube = src.cubes['MUSE_CUBE']
cube.info()
tab = src.tables['HST_CAT']
row = tab[tab['ID']==4663][0]
ra,dec = row['RA'],row['DEC']
print(f'Rafleski ID 4663 RA {ra} DEC {dec}')
# we use an aperture of 0.5 arcsec radius (1 arcsec diameter)
rad = 0.5
sp = cube.aperture((dec,ra), rad)
# let's filter the spectrum with a box of 7 pixel width
fsp = sp.filter(width=7)
# We display the resulting spectra
fig,ax = plt.subplots(1,2,figsize=(17,5))
sp.plot(ax=ax[0], noise=True, title='data and noise')
fsp.plot(ax=ax[1], title='filtered')
# A low S/N flux can be seen at 6200 A
fig,ax = plt.subplots(1,2,figsize=(17,5))
sp.plot(ax=ax[0], title='data', lmin=6000, lmax=6500)
sp.plot(ax=ax[1], snr=True, title='S/N', lmin=6000, lmax=6500)
# we compute the narrow band around 6200 A to check if this flux is related to RAF-ID 4663
nb = cube.get_image((6190,6220),subtract_off=True)
from mpdaf.sdetect import Catalog
fig,ax = plt.subplots(1,2,figsize=(18,8))
ima = src.images['HST_F775W']
ima.plot(ax=ax[0], vmin=-0.005, vmax=0.05, scale='arcsinh', cmap='Greys')
tab = Catalog(src.tables['HST_CAT'])
tab.plot_symb(ax[0], ima.wcs, ra='RA', dec='DEC', id='ID', label=True, ecol='b', esize=0.3, fontsize=12, tcol='r')
ax[0].set_title('image: HST_F775W catalog: HST_CAT');
nb.plot(ax=ax[1], scale='arcsinh', cmap='Greys')
tab.plot_symb(ax[1], nb.wcs, ra='RA', dec='DEC', id='ID', label=True, ecol='b', esize=0.3, fontsize=12, tcol='r')
ax[1].set_title('image: Narrow-band 6200A catalog: HST_CAT');
As shown in the figure, the narrow-band is centered on RAF-ID 4595, ie MUSE-ID 1037. The flux measured at RAF-ID 4663 is just the contamination of the central source.