ORIGIN

class muse_origin.ORIGIN(filename, name='origin', path='.', loglevel='DEBUG', logcolor=False, fieldmap=None, profiles=None, PSF=None, LBDA_FWHM_PSF=None, FWHM_PSF=None, PSF_size=25, param=None, imawhite=None, wfields=None)[source]

Bases: muse_origin.steps.LogMixin

ORIGIN: detectiOn and extRactIon of Galaxy emIssion liNes

This is the main class to interact with all the steps. An Origin object is mainly composed by: - cube data (raw data and covariance) - 1D dictionary of spectral profiles - MUSE PSF

Attributes
pathstr

Path where the ORIGIN data will be stored.

namestr

Name of the session and basename for the sources.

paramdict

Parameters values.

cube_rawarray (Nz, Ny, Nx)

Raw data.

vararray (Nz, Ny, Nx)

Variance.

wcsmpdaf.obj.WCS

RA-DEC coordinates.

wavempdaf.obj.WaveCoord

Spectral coordinates.

profileslist of array

Read the list of spectral profiles.

FWHM_profileslist

Read the list of FWHM of the spectral profiles.

wfieldsNone or list of arrays

List of weight maps (one per fields in the case of MUSE mosaic) None: just one field

PSFarray (Nz, PSF_size, PSF_size) or list of arrays

MUSE PSF (one per field)

LBDA_FWHM_PSF: list of floats

Value of the FWMH of the PSF in pixel for each wavelength step (mean of the fields).

FWHM_PSFfloat or list of float

Mean of the fwhm of the PSF in pixel (one per field).

imawhiteImage

White image

segmapImage

Segmentation map

cube_stdCube

standardized data for PCA. Result of step01.

cont_dctCube

DCT continuum. Result of step01.

ima_stdImage

Mean of standardized data for PCA along the wavelength axis. Result of step01.

ima_dctImage

Mean of DCT continuum cube along the wavelength axis. Result of step01.

nbAreasint

Number of area (segmentation) for the PCA.

areamapImage

PCA area. Result of step02.

testO2list of arrays (one per PCA area)

Result of the O2 test (step03).

histO2list of arrays (one per PCA area)

PCA histogram (step03).

binO2list of arrays (one per PCA area)

Bins for the PCA histogram (step03).

thresO2list of float

For each area, threshold value (step03).

meaO2list of float

Location parameter of the Gaussian fit used to estimate the threshold (step03).

stdO2list of float

Scale parameter of the Gaussian fit used to estimate the threshold (step03).

cube_faintCube

Projection on the eigenvectors associated to the lower eigenvalues of the data cube (representing the faint signal). Result of step04.

mapO2Image

The numbers of iterations used by testO2 for each spaxel. Result of step04.

cube_correlCube

Cube of T_GLR values (step05).

cube_profileCube (type int)

PSF profile associated to the T_GLR (step05).

maxmapImage

Map of maxima along the wavelength axis (step05).

cube_local_maxCube

Local maxima from max correlation (step05).

cube_local_minCube

Local maxima from min correlation (step05).

thresholdfloat

Estimated threshold (step06).

Pvalastropy.table.Table

Table with the purity results for each threshold (step06): - PVal_r : The purity function - index_pval : index value to plot - Det_m : Number of detections (-DATA) - Det_M : Number of detections (+DATA)

Cat0astropy.table.Table

Catalog returned by step07

Pval_compastropy.table.Table

Table with the purity results for each threshold in compl (step08): - PVal_r : The purity function - index_pval : index value to plot - Det_m : Number of detections (-DATA) - Det_M : Number of detections (+DATA)

Cat1astropy.table.Table

Catalog returned by step08

spectralist of Spectrum

Estimated lines. Result of step09.

Cat2astropy.table.Table

Catalog returned by step09.

Attributes Summary

FWHM_profiles

Read the list of FWHM of the spectral profiles.

cube_raw

mask

nbAreas

Number of area (segmentation) for the PCA.

profiles

Read the list of spectral profiles.

threshold_correl

Estimated threshold used to detect lines on local maxima of max correl.

threshold_std

Estimated threshold used to detect complementary lines on local maxima of std cube.

var

Methods Summary

info()

Prints the processing log.

init(cube[, fieldmap, profiles, PSF, ...])

Create a ORIGIN object.

load(folder[, newname, loglevel, logcolor])

Load a previous session of ORIGIN.

plot_NB(src_ind[, ax1, ax2, ax3])

Plot the narrow band images.

plot_PCA_threshold(area[, pfa_test, log10, ...])

Plot the histogram and the threshold for the starting point of the PCA.

plot_areas([ax])

Plot the 2D segmentation for PCA from self.step02_areas() on the test used to perform this segmentation.

plot_mapPCA([area, iteration, ax])

Plot at a given iteration (or at the end) the number of times a spaxel got cleaned by the PCA.

plot_min_max_hist([ax, comp])

Plot the histograms of local maxima and minima.

plot_purity([comp, ax, log10, legend])

Draw number of sources per threshold computed in step06/step08.

plot_segmaps([axes, figsize])

Plot the segmentation maps:

plot_sources(x, y[, circle, vmin, vmax, ...])

Plot detected emission lines on the 2D map of maximum of the T_GLR values over the spectral channels.

plot_step03_PCA_stat([cutoff, ax])

Plot the threshold value according to the area.

plot_step03_PCA_threshold([log10, ncol, ...])

Plot the histogram and the threshold for the starting point of the PCA.

set_loglevel(level)

Set the logging level for the console logger.

stat()

Print detection summary.

status()

Prints the processing status.

timestat([table])

Print CPU usage by steps.

write([path, erase])

Save the current session in a folder that will have the name of the ORIGIN object (self.name).

Attributes Documentation

FWHM_profiles

Read the list of FWHM of the spectral profiles.

cube_raw
mask
nbAreas

Number of area (segmentation) for the PCA.

profiles

Read the list of spectral profiles.

threshold_correl

Estimated threshold used to detect lines on local maxima of max correl.

threshold_std

Estimated threshold used to detect complementary lines on local maxima of std cube.

var

Methods Documentation

info()[source]

Prints the processing log.

classmethod init(cube, fieldmap=None, profiles=None, PSF=None, LBDA_FWHM_PSF=None, FWHM_PSF=None, PSF_size=25, name='origin', path='.', loglevel='DEBUG', logcolor=False)[source]

Create a ORIGIN object.

An Origin object is composed by: - cube data (raw data and covariance) - 1D dictionary of spectral profiles - MUSE PSF - parameters used to segment the cube in different zones.

Parameters
cubestr

Cube FITS file name

fieldmapstr

FITS file containing the field map (mosaic)

profilesstr

FITS of spectral profiles If None, a default dictionary of 20 profiles is used.

PSFstr

Cube FITS filename containing a MUSE PSF per wavelength. If None, PSF are computed with a Moffat function (13x13 pixels, beta=2.6, fwhm1=0.76, fwhm2=0.66, lambda1=4750, lambda2=7000)

LBDA_FWHM_PSF: list of float

Value of the FWMH of the PSF in pixel for each wavelength step (mean of the fields).

FWHM_PSFlist of float

FWHM of the PSFs in pixels, one per field.

PSF_sizeint

Spatial size of the PSF (when reconstructed from the cube header).

namestr

Name of this session and basename for the sources. ORIGIN.write() method saves the session in a folder that has this name. The ORIGIN.load() method will be used to load a session, continue it or create a new from it.

loglevelstr

Level for the logger (defaults to DEBUG).

logcolorbool

Use color for the logger levels.

classmethod load(folder, newname=None, loglevel=None, logcolor=None)[source]

Load a previous session of ORIGIN.

ORIGIN.write() method saves a session in a folder that has the name of the ORIGIN object (self.name).

Parameters
folderstr

Folder name (with the relative path) where the ORIGIN data have been stored.

newnamestr

New name for this session. This parameter lets the user to load a previous session but continue in a new one. If None, the user will continue the loaded session.

loglevelstr

Level for the logger (by default reuse the saved level).

logcolorbool

Use color for the logger levels.

plot_NB(src_ind, ax1=None, ax2=None, ax3=None)[source]

Plot the narrow band images.

Parameters
src_indint

Index of the object in self.Cat0.

ax1matplotlib.Axes

The Axes instance in which the NB image around the source is drawn.

ax2matplotlib.Axes

The Axes instance in which a other NB image for check is drawn.

ax3matplotlib.Axes

The Axes instance in which the difference is drawn.

plot_PCA_threshold(area, pfa_test='step03', log10=False, legend=True, xlim=None, ax=None)[source]

Plot the histogram and the threshold for the starting point of the PCA.

Parameters
areaint in [1, nbAreas]

Area ID

pfa_testfloat or str

PFA of the test (if ‘step03’, the value set during step03 is used)

log10bool

Draw histogram in logarithmic scale or not

legendbool

If true, write pfa and threshold values as legend

xlim(float, float)

Set the data limits for the x-axis

axmatplotlib.Axes

Axes instance in which the image is drawn

plot_areas(ax=None, **kwargs)[source]

Plot the 2D segmentation for PCA from self.step02_areas() on the test used to perform this segmentation.

Parameters
axmatplotlib.Axes

The Axes instance in which the image is drawn.

kwargsmatplotlib.artist.Artist

Optional extra keyword/value arguments to be passed to ax.imshow().

plot_mapPCA(area=None, iteration=None, ax=None, **kwargs)[source]

Plot at a given iteration (or at the end) the number of times a spaxel got cleaned by the PCA.

Parameters
area: int in [1, nbAreas]

if None draw the full map for all areas

iterationint

Display the nuisance/bacground pixels at iteration k

axmatplotlib.Axes

The Axes instance in which the image is drawn

kwargsmatplotlib.artist.Artist

Optional extra keyword/value arguments to be passed to ax.imshow().

plot_min_max_hist(ax=None, comp=False)[source]

Plot the histograms of local maxima and minima.

plot_purity(comp=False, ax=None, log10=False, legend=True)[source]

Draw number of sources per threshold computed in step06/step08.

Parameters
compbool

If True, plot purity curves for the complementary lines (step08).

axmatplotlib.Axes

The Axes instance in which the image is drawn.

log10bool

To draw histogram in logarithmic scale or not.

legendbool

To draw the legend.

plot_segmaps(axes=None, figsize=(6, 6))[source]

Plot the segmentation maps:

  • segmap_cont: segmentation map computed on the white-light image.

  • segmap_merged: segmentation map merged with the cont one and another one computed on the residual.

  • segmap_purity: combines self.segmap and a segmentation on the maxmap.

  • segmap_label: segmentation map used for the catalog, either the one given as input, otherwise self.segmap_cont.

plot_sources(x, y, circle=False, vmin=0, vmax=30, title=None, ax=None, **kwargs)[source]

Plot detected emission lines on the 2D map of maximum of the T_GLR values over the spectral channels.

Parameters
xarray

Coordinates along the x-axis of the estimated lines in pixels.

yarray

Coordinates along the y-axis of the estimated lines in pixels.

circlebool

If true, plot circles with a diameter equal to the mean of the fwhm of the PSF.

vminfloat

Minimum pixel value to use for the scaling.

vmaxfloat

Maximum pixel value to use for the scaling.

titlestr

An optional title for the figure (None by default).

axmatplotlib.Axes

the Axes instance in which the image is drawn

kwargsmatplotlib.artist.Artist

Optional arguments passed to ax.imshow().

plot_step03_PCA_stat(cutoff=5, ax=None)[source]

Plot the threshold value according to the area.

Median Absolute Deviation is used to find outliers.

Parameters
cutofffloat

Median Absolute Deviation cutoff

axmatplotlib.Axes

The Axes instance in which the image is drawn

plot_step03_PCA_threshold(log10=False, ncol=3, legend=True, xlim=None, fig=None, **fig_kw)[source]

Plot the histogram and the threshold for the starting point of the PCA.

Parameters
log10bool

Draw histogram in logarithmic scale or not

ncolint

Number of colomns in the subplots

legendbool

If true, write pfa and threshold values as legend

xlim(float, float)

Set the data limits for the x-axes

figmatplotlib.Figure

Figure instance in which the image is drawn

**fig_kwmatplotlib.artist.Artist

All additional keyword arguments are passed to the figure() call.

set_loglevel(level)[source]

Set the logging level for the console logger.

stat()[source]

Print detection summary.

status()[source]

Prints the processing status.

timestat(table=False)[source]

Print CPU usage by steps.

If table is True, an astropy.table.Table is returned.

write(path=None, erase=False)[source]

Save the current session in a folder that will have the name of the ORIGIN object (self.name).

The ORIGIN.load(folder, newname=None) method will be used to load a session. The parameter newname will let the user to load a session but continue in a new one.

Parameters
pathstr

Path where the folder (self.name) will be stored.

erasebool

Remove the folder if it exists.