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
- path
str
Path where the ORIGIN data will be stored.
- name
str
Name of the session and basename for the sources.
- param
dict
Parameters values.
- cube_raw
array
(Nz
,Ny
,Nx
) Raw data.
- var
array
(Nz
,Ny
,Nx
) Variance.
- wcs
mpdaf.obj.WCS
RA-DEC coordinates.
- wave
mpdaf.obj.WaveCoord
Spectral coordinates.
profiles
list
ofarray
Read the list of spectral profiles.
FWHM_profiles
list
Read the list of FWHM of the spectral profiles.
- wfields
None
orlist
ofarrays
List of weight maps (one per fields in the case of MUSE mosaic) None: just one field
- PSF
array
(Nz
,PSF_size
,PSF_size
) orlist
ofarrays
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_PSF
float
orlist
offloat
Mean of the fwhm of the PSF in pixel (one per field).
- imawhite
Image
White image
- segmap
Image
Segmentation map
- cube_std
Cube
standardized data for PCA. Result of step01.
- cont_dct
Cube
DCT continuum. Result of step01.
- ima_std
Image
Mean of standardized data for PCA along the wavelength axis. Result of step01.
- ima_dct
Image
Mean of DCT continuum cube along the wavelength axis. Result of step01.
nbAreas
int
Number of area (segmentation) for the PCA.
- areamap
Image
PCA area. Result of step02.
- testO2
list
ofarrays
(one
per
PCA
area
) Result of the O2 test (step03).
- histO2
list
ofarrays
(one
per
PCA
area
) PCA histogram (step03).
- binO2
list
ofarrays
(one
per
PCA
area
) Bins for the PCA histogram (step03).
- thresO2
list
offloat
For each area, threshold value (step03).
- meaO2
list
offloat
Location parameter of the Gaussian fit used to estimate the threshold (step03).
- stdO2
list
offloat
Scale parameter of the Gaussian fit used to estimate the threshold (step03).
- cube_faint
Cube
Projection on the eigenvectors associated to the lower eigenvalues of the data cube (representing the faint signal). Result of step04.
- mapO2
Image
The numbers of iterations used by testO2 for each spaxel. Result of step04.
- cube_correl
Cube
Cube of T_GLR values (step05).
- cube_profile
Cube
(typeint
) PSF profile associated to the T_GLR (step05).
- maxmap
Image
Map of maxima along the wavelength axis (step05).
- cube_local_max
Cube
Local maxima from max correlation (step05).
- cube_local_min
Cube
Local maxima from min correlation (step05).
- threshold
float
Estimated threshold (step06).
- Pval
astropy.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)
- Cat0
astropy.table.Table
Catalog returned by step07
- Pval_comp
astropy.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)
- Cat1
astropy.table.Table
Catalog returned by step08
- spectra
list
ofSpectrum
Estimated lines. Result of step09.
- Cat2
astropy.table.Table
Catalog returned by step09.
- path
Attributes Summary
Read the list of FWHM of the spectral profiles.
Number of area (segmentation) for the PCA.
Read the list of spectral profiles.
Estimated threshold used to detect lines on local maxima of max correl.
Estimated threshold used to detect complementary lines on local maxima of std cube.
Methods Summary
info
(self)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
(self, src_ind[, ax1, ax2, ax3])Plot the narrow band images.
plot_PCA_threshold
(self, area[, pfa_test, …])Plot the histogram and the threshold for the starting point of the PCA.
plot_areas
(self[, ax])Plot the 2D segmentation for PCA from self.step02_areas() on the test used to perform this segmentation.
plot_mapPCA
(self[, 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
(self[, ax, comp])Plot the histograms of local maxima and minima.
plot_purity
(self[, comp, ax, log10, legend])Draw number of sources per threshold computed in step06/step08.
plot_segmaps
(self[, axes, figsize])Plot the segmentation maps:
plot_sources
(self, x, y[, circle, vmin, …])Plot detected emission lines on the 2D map of maximum of the T_GLR values over the spectral channels.
plot_step03_PCA_stat
(self[, cutoff, ax])Plot the threshold value according to the area.
plot_step03_PCA_threshold
(self[, log10, …])Plot the histogram and the threshold for the starting point of the PCA.
set_loglevel
(self, level)Set the logging level for the console logger.
stat
(self)Print detection summary.
status
(self)Prints the processing status.
timestat
(self[, table])Print CPU usage by steps.
write
(self[, 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
-
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
- cube
str
Cube FITS file name
- fieldmap
str
FITS file containing the field map (mosaic)
- profiles
str
FITS of spectral profiles If None, a default dictionary of 20 profiles is used.
- PSF
str
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_PSF
list
offloat
FWHM of the PSFs in pixels, one per field.
- PSF_size
int
Spatial size of the PSF (when reconstructed from the cube header).
- name
str
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.
- loglevel
str
Level for the logger (defaults to DEBUG).
- logcolorbool
Use color for the logger levels.
- cube
-
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
- folder
str
Folder name (with the relative path) where the ORIGIN data have been stored.
- newname
str
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.
- loglevel
str
Level for the logger (by default reuse the saved level).
- logcolorbool
Use color for the logger levels.
- folder
-
plot_NB
(self, src_ind, ax1=None, ax2=None, ax3=None)[source]¶ Plot the narrow band images.
- Parameters
- src_ind
int
Index of the object in self.Cat0.
- ax1
matplotlib.Axes
The Axes instance in which the NB image around the source is drawn.
- ax2
matplotlib.Axes
The Axes instance in which a other NB image for check is drawn.
- ax3
matplotlib.Axes
The Axes instance in which the difference is drawn.
- src_ind
-
plot_PCA_threshold
(self, 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
- area
int
in
[1,nbAreas
] Area ID
- pfa_test
float
orstr
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
- ax
matplotlib.Axes
Axes instance in which the image is drawn
- area
-
plot_areas
(self, ax=None, **kwargs)[source]¶ Plot the 2D segmentation for PCA from self.step02_areas() on the test used to perform this segmentation.
- Parameters
- ax
matplotlib.Axes
The Axes instance in which the image is drawn.
- kwargs
matplotlib.artist.Artist
Optional extra keyword/value arguments to be passed to
ax.imshow()
.
- ax
-
plot_mapPCA
(self, 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
- iteration
int
Display the nuisance/bacground pixels at iteration k
- ax
matplotlib.Axes
The Axes instance in which the image is drawn
- kwargs
matplotlib.artist.Artist
Optional extra keyword/value arguments to be passed to
ax.imshow()
.
-
plot_min_max_hist
(self, ax=None, comp=False)[source]¶ Plot the histograms of local maxima and minima.
-
plot_purity
(self, comp=False, ax=None, log10=False, legend=True)[source]¶ Draw number of sources per threshold computed in step06/step08.
-
plot_segmaps
(self, 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
(self, 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
- x
array
Coordinates along the x-axis of the estimated lines in pixels.
- y
array
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.
- vmin
float
Minimum pixel value to use for the scaling.
- vmax
float
Maximum pixel value to use for the scaling.
- title
str
An optional title for the figure (None by default).
- ax
matplotlib.Axes
the Axes instance in which the image is drawn
- kwargs
matplotlib.artist.Artist
Optional arguments passed to
ax.imshow()
.
- x
-
plot_step03_PCA_stat
(self, cutoff=5, ax=None)[source]¶ Plot the threshold value according to the area.
Median Absolute Deviation is used to find outliers.
- Parameters
- cutoff
float
Median Absolute Deviation cutoff
- ax
matplotlib.Axes
The Axes instance in which the image is drawn
- cutoff
-
plot_step03_PCA_threshold
(self, 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
- ncol
int
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
- fig
matplotlib.Figure
Figure instance in which the image is drawn
- **fig_kw
matplotlib.artist.Artist
All additional keyword arguments are passed to the figure() call.
-
timestat
(self, table=False)[source]¶ Print CPU usage by steps.
If
table
is True, an astropy.table.Table is returned.
-
write
(self, 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.