brutus module

brutus: a set of Python modules to process datacubes from integral field spectrographs.

Copyright (C) 2016, F.P.A. Vogt


This file contains the master brutus routines to fit the stellar continuum and the emission lines in an IFU data cube (i.e. MUSE). Most of these routines call sub-routines, after setting the scene/loading datasets/etc ...

Any processing step MUST have a dediacted routine in this file call ‘run_XXX’, which can then refer to any existing/new brutus/Python module.

Created April 2016, F.P.A. Vogt - frederic.vogt@alumni.anu.edu.au


This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

brutus.run_build_continuum_mix(fn_list, params, suffix=None)[source]

Construct the mixed continuum cube, following the user’s wishes.

Args:
fn_list: dictionary

The dictionary containing all filenames created by brutus.

params: dictionary

The dictionary containing all paramaters set by the user.

suffix: string [default: None]

The tag of this step, to be used in all files generated for rapid id.

Returns:
fn_list: dictionary

The updated dictionary of filenames.

brutus.run_extragal_dered(fn_list, params, suffix=None, do_plot=True)[source]

Corrects the line fluxes for the extragalactic reddening using Ha and Hb.

This function returns a corrected set of line fluxes, as well as the associated Av map.

Args:
fn_list: dictionary

The dictionary containing all filenames created by brutus.

params: dictionary

The dictionary containing all paramaters set by the user.

suffix: string [default: None]

The tag of this step, to be used in all files generated for rapid id.

do_plot: bool [default: True]

Whether to make a plot of the Av map or not.

Returns:
fn_list: dictionary

The updated dictionary of filenames.

Notes:

Should I add some info about each curve here ?

brutus.run_find_structures(fn_list, params, suffix=None, interactive_mode=True, automatic_mode=True)[source]

This function is designed to identify structures (e.g. HII regions) in the data from a 2D image (i.e. an line intensity map), and save them to a pickle file. When interactive_mode=True, the user can manually refine the selection. Set automatic_mode=False to skip the automatic detection.

brutus.run_fit_continuum(fn_list, params, suffix=None, start_row=None, end_row=None, method='lowess')[source]

This function fits the continuum in the datacube, either using ppxf (if SNR is decent) or using a simple polynomial value. It is designed to use multiprocessing to speed things up on good computers. It deals with the data columns-per-columns, and can be restarted mid-course, in case of a crash.

brutus.run_fit_elines(fn_list, params, suffix=None, start_row=None, end_row=None)[source]

This function fits the emission lines in the datacube, after subtracting the continuum derived using LOWESSS or PPXF. It is designed to use multiprocessing to speed things up on good computers. It deals with the data columns-per-columns, and can be restarted mid-course, in case of a crash.

brutus.run_fit_kinematic_pa(fn_list, params, suffix=None, do_plot=True, vrange=[None, None])[source]

This function computes the kinematic position angle for the stars or the gas, via the fit_kinematic_pa() routine from M.Cappellari (not included with brutus).

Args:
fn_list: dictionary

The dictionary containing all filenames created by brutus.

params: dictionary

The dictionary containing all paramaters set by the user.

suffix: string [default: None]

The tag of this step, to be used in all files generated for rapid id.

do_plot: bool [default: True]

Whether to make a plot of the kinematic map or not.

vrange: list of int [default: [None,None]]

The range of the colorbar for the velocity plot.

Returns:
fn_list: dictionary

The updated dictionary of filenames.

Notes:

pyqz is NOT included with brutus. A separate installation is required. See http://fpavogt.github.io/pyqz/installation.html

brutus.run_gal_dered(fn_list, params, suffix=None, do_plot=False)[source]

Corrects for Galactic extinction, given the Ab and Av extinction.

This function erives the Alambda value for any wavelength, and corrects the data to correct for our “local” extinction. Intended for extragalactic sources.

Args:
fn_list: dictionary

The dictionary containing all filenames created by brutus.

params: dictionary

The dictionary containing all paramaters set by the user.

suffix: string [default: None]

The tag of this step, to be used in all files generated for rapid id.

do_plot: bool [default: True]

Whether to make a plot of the Alambda correction applied or not.

Returns:
fn_list: dictionary

The updated dictionary of filenames.

Notes:

To reproduce the approach from NED, use the Ab and Av value for you object from there, and set curve=’f99’, rv=3.1.

brutus.run_get_QZ(fn_list, params, suffix=None, start_row=0, end_row=None)[source]

This function computes the ionization parameter and oxygen abundance of HII regions using the pyqz module: http://fpavogt.github.io/pyqz/

Args:
fn_list: dictionary

The dictionary containing all filenames created by brutus.

params: dictionary

The dictionary containing all paramaters set by the user.

suffix: string [default: None]

The tag of this step, to be used in all files generated for rapid id.

start_row: int [default: 0]

The starting row from which to process the data

end_row: int [default: None]

The row at which to finish the processing. Set to None for the max row.

Returns:
fn_list: dictionary

The updated dictionary of filenames.

Notes:

pyqz is NOT included with brutus. A separate installation is required. See http://fpavogt.github.io/pyqz/installation.html

brutus.run_get_ne(fn_list, params, suffix=None, do_plot=True, ratio_range=[None, None])[source]

This function computes the kinematic position angle for the stars or the gas, via the fit_kinematic_pa() routine from M.Cappellari (not included with brutus).

Args:
fn_list: dictionary

The dictionary containing all filenames created by brutus.

params: dictionary

The dictionary containing all paramaters set by the user.

suffix: string [default: None]

The tag of this step, to be used in all files generated for rapid id.

do_plot: bool [default: True]

Whether to make a plot of the electron density map or not.

ratio_range: list [default[None,None]

The line ratio range, for the plot.

Returns:
fn_list: dictionary

The updated dictionary of filenames.

Notes:

pyqz is NOT included with brutus. A separate installation is required. See http://fpavogt.github.io/pyqz/installation.html

brutus.run_inspect_fit(fn_list, params, suffix=None, irange=[None, None], vrange=[None, None])[source]

Setup the interactive inspection of the fit results.

Args:
fn_list: dictionary

The dictionary containing all filenames created by brutus.

params: dictionary

The dictionary containing all paramaters set by the user.

suffix: string [default: None]

The tag of this step, to be used in all files generated for rapid id.

irange: list of int [default: [None,None]]

The range of the colorbar for the intensity plot.

vrange: list of int [default: [None,None]]

The range of the colorbar for the velocity dispersion plot.

Returns:
fn_list: dictionary

The updated dictionary of filenames.

brutus.run_make_QZ_cube(fn_list, params, suffix=None, do_plot=True)[source]

This function is designed to construct a “usable and decent” datacube out of the mess generated by the pyqz step.

Args:
fn_list: dictionary

The dictionary containing all filenames created by brutus.

params: dictionary

The dictionary containing all paramaters set by the user.

suffix: string [default: None]

The tag of this step, to be used in all files generated for rapid id.

do_plot: bool [default: True]

Whether to make some nifty plots or not.

Returns:
fn_list: dictionary

The updated dictionary of filenames.

brutus.run_make_ap_cube(fn_list, params, suffix=None, do_plot=True)[source]

This function is designed to make a cube from a series of apertures (x,y,rs). For compativilty with spaxels-by-spaxels analysis codes (incl.brutus), make the cube the same size as the original, and repleace each spectra in a given aperture by the total aperture spectra. Spaxels outside any apertures are nan’s. Assigned spaxels to one aperture only, in order of decreasing flux peak. This makes the data redondant, but will allow for a rapid and direct processing of the resulting cube by brutus.

brutus.run_make_continuum_cube(fn_list, params, suffix=None, method='lowess')[source]

This function is designed to construct a “usable and decent” datacube out of the mess generated by the continuum fitting function, i.e. out of the many pickle files generated.

brutus.run_make_elines_cube(fn_list, params, suffix=None)[source]

This function is designed to construct a “usable and decent” datacube out of the mess generated by the emission line fitting function, i.e. out of the many pickle files generated.

brutus.run_plot_elines_RGB(fn_list, params, suffix=None, mixes=[['[NII]', 'Ha', '[OIII]']], stretches=['log'], stretch_plims=[[10.0, 99.5, 10.0, 99.5, 10.0, 99.5]], stretch_vlims=[[None, None, None, None, None, None]], use_egal_dered=False)[source]

This function is designed to make some RGB images from emission lines.

Args:
fn_list: dictionary

The dictionary containing all filenames created by brutus.

params: dictionary

The dictionary containing all paramaters set by the user.

suffix: string [default: None]

The tag of this step, to be used in all files generated for rapid id.

mixes: list of list [default: [[‘[NII]’,’Ha’,’[OIII]’]]]

A list of line triplets indicatin the R, G & B channels.

stretches: list of string [default: [‘log’]]

The stretches to apply to the data, e.g. ‘linear’, ‘log’, ‘arcsinh’.

stretch_plims: list of list of floats [default: [[10.,99.5,10.,99.5,10.,99.5],]]

The limiting percentiles for the plot, as [pmin_r, pmax_r, pmin_g, pmax_g, pmin_b, pmax_b]

stretch_vlims: list of list of floats [default: [[10.,99.5,10.,99.5,10.,99.5],]]

The limtiing values for the plot (superseeds stretch_plims), as [vmin_r, vmax_r, vmin_g, vmax_g, vmin_b, vmax_b]

use_egal_dered: bool [default: False]

If available, whether to use the line fluxes corrected for extragalactic attentuation.

Returns:
fn_list: dictionary

The updated dictionary of filenames.

brutus.run_plot_elines_cube(fn_list, params, suffix=None, vrange=None, sigrange=None)[source]

Creates some plots for the emission lines: F, I, v and sigma.

Args:
fn_list: dictionary

The dictionary containing all filenames created by brutus.

params: dictionary

The dictionary containing all paramaters set by the user.

suffix: string [default: None]

The tag of this step, to be used in all files generated for rapid id.

vrange: list of int [default: None]

If set, the range of the colorbar for the velocity plot.

sigrangre: list of int [default: None]

If set, the range of the colorbar for the velocity dispersion plot.

Returns:
fn_list: dictionary

The updated dictionary of filenames.

brutus.run_plot_flux_ratio(fn_list, params, suffix=None, ratios=['[NII]/[OIII]'], vrange=[[None, None]], use_egal_dered=False)[source]

This function is designed to make some images from emission lines flux ratios.

Args:
fn_list: dictionary

The dictionary containing all filenames created by brutus.

params: dictionary

The dictionary containing all paramaters set by the user.

suffix: string [default: None]

The tag of this step, to be used in all files generated for rapid id.

ratios: list of string [default: [‘[NII]/[OIII]’]]

A list of line ratios to plot.

vrange: list of lists [default: [[Mone,None]]]

The plot range.

use_egal_dered: bool [default: False]

If available, whether to use the line fluxes corrected for extragalactic attentuation.

Returns:
fn_list: dictionary

The updated dictionary of filenames.

brutus.run_plot_ppxf_sol(fn_list, params, suffix=None, vrange=None, sigrange=None)[source]

Creates some plots for the stellar kinematics parameters derived via ppxf.

Args:
fn_list: dictionary

The dictionary containing all filenames created by brutus.

params: dictionary

The dictionary containing all paramaters set by the user.

suffix: string [default: None]

The tag of this step, to be used in all files generated for rapid id.

vrange: list of int [default: None]

If set, the range of the colorbar for the velocity plot.

sigrangre: list of int [default: None]

If set, the range of the colorbar for the velocity dispersion plot.

Returns:
fn_list: dictionary

The updated dictionary of filenames.

brutus.run_snr_maps(fn_list, params, suffix=None, do_plot=False)[source]

This function computes the SNR maps for the continuum and Ha (or other line). It also creates a map of spaxels with any signal at all. The resulting maps are saved to a fits file with full header and WCS coordinates.

Args:
fn_list: dictionary

The dictionary containing all filenames created by brutus.

params: dictionary

The dictionary containing all paramaters set by the user.

suffix: string [default: None]

The tag of this step, to be used in all files generated for rapid id.

do_plot: bool [default: True]

Whether to make a plot of the SNR maps or not.

Returns:
fn_list: dictionary

The updated dictionary of filenames.

Notes:

This function is a “first guess” of the SNR for latter use in the code. A more reliable measure of the SNR for the emission line should be computed after they have been fitted.