Reference/API

threadcount.procedures

threadcount.procedures.open_cube_and_deredshift.run(...)

Open a fits data cube and de-redshift it, as well as any continuum cube.

threadcount.procedures.fit_lines.run(...)

threadcount.procedures.analyze_outflow_extent.run(...)

threadcount.procedures.set_rcParams.set_params([...])

threadcount.procedures.explore_results.run(...)

This funtion put everything together.

threadcount.models Module

Custom Models that should function just like lmfit’s models.

Functions

flux_expr(model)

Return constraint expression for line flux.

gaussianH(x[, height, center, sigma])

Return a 1-dimensional Gaussian function.

guess_from_peak(y, x[, negative])

Estimate starting values from 1D peak data and return (height,center,sigma).

log10_sum(arr1, arr2)

Add the 2 arguments and return the log10 of result.

mean_edges(y[, x, edge_fraction])

Compute the mean of the outer points of y.

set_common_limits(params, x, data)

Classes

Const_1GaussModel([independent_vars, ...])

Constant + 1 Gaussian Model.

Const_2GaussModel([independent_vars, ...])

Constant + 2 Gaussians Model.

Const_3GaussModel([independent_vars, ...])

Constant + 3 Gaussians Model.

GaussianModelH([independent_vars, prefix, ...])

A model heavily based on lmfit's GaussianModel, fitting height instead of amplitude.

Log10_DoubleExponentialModel([...])

Log10 of double exponential decay Model.

Quadratic_1GaussModel([independent_vars, ...])

Quadratic + 1 Gaussian Model.

Quadratic_2GaussModel([independent_vars, ...])

Quadratic + 2 Gaussians Model.

Quadratic_3GaussModel([independent_vars, ...])

Quadratic + 3 Gaussians Model.

Variables

min_sigma

int([x]) -> integer int(x, base=10) -> integer

tiny

Convert a string or number to a floating point number, if possible.

threadcount.lines Module

Library of line wavelengths.

Classes

Line(center[, plus, minus, label, save_str])

Line object containing center and wavelength range.

Variables

Hb4861

= 4861.333 # Hβ

Hdelta

= 4101.742 # Hδ

Hgamma

= 4340.471 # Hγ

L_Hb4861

Line instance, Hb4861 +/- 15

L_Hdelta

Line instance, Hdelta +/- 15

L_Hgamma

Line instance, Hgamma +/- 15

L_NeIII

Line instance, NeIII +/- 15

L_OII3727d

Line instance, (OII3726 + OII3729)/2 +/- 16

L_OIII4363

Line instance, OIII4363 +/- 15

L_OIII4959

Line instance, OIII4959 +/- 15

L_OIII5007

Line instance, OIII5007 +/- 15

NeIII

= 3868.760 # [Ne III] 3869

OII3726

= 3726.032 # [O II] 3727 doublet, line 1

OII3729

= 3728.815 # [O II] 3727 doublet, line 2

OIII4363

= 4363.210 # [O III] 4363

OIII4959

= 4958.911 # [O III] 4959

OIII5007

= 5006.843 # [O III] 5007

threadcount.fit Module

main threadcount module.

Functions

choose_model_aic(model_list[, d_aic])

Broadcast choose_model_aic_single() over array.

choose_model_aic_single(model_list[, d_aic])

Determine best modelresult in a list, chosen by computing \({\Delta}aic\).

collect_stats(model_result[, model_keys, ...])

Collect the information from one model_result.

de_redshift(wavecoord[, z, z_initial])

De-redshift the WaveCoord in-place.

extract_spaxel_info(fit_results[, fit_info, ...])

Extract ModelResult attributes into numpy array.

extract_spaxel_info_mc(mc_fits, fit_info, ...)

Compute the average and standard deviation of the information requested.

fit_baseline(spectrum, this_baseline_range, ...)

get_SNR_map(cube[, signal_idx, ...])

Create Image of signal to noise ratio in a given bandwidth.

get_SignalBW_idx(cube[, nsigma, plot])

Determine the wavelength indices containing signal.

get_aic(model[, error])

Return the aic_real of a successful fit.

get_gcomponent_comparison(fit)

Determine component comparison to this highest flux gaussian.

get_header_stats([model_keys, fit_info])

Collect list of column names, suitable for a header row.

get_index(array, value)

Determine the index of 'array' which is closest to value.

get_model_keys(model_results[, ignore])

Retrieve the names of parameters from model results.

get_ngaussians(fit)

Determine the number of gaussians in a lmfit.model.Model.

get_param_values(params, param_name[, ...])

Retrieve parameter value by name from lmfit objects.

get_reg_image(region)

Create kernel image from list of pixels.

get_region(rx[, ry])

Select pixels in ellipse of radius rx, ry from (0,0).

interactive_lower_threshold(image[, title])

Create plot and interact with user to determine the lower threshold for valid data.

interactive_user_choice(fits, choices, ...)

Choose best model from a display of all model fits to a pixel.

iter_spaxel(image[, index])

Create an iterator over the spaxels of successive image pixels in a 2d numpy array.

marginal_fits(fit_list, choices[, flux, dmu])

Determine which fits should be inspected by hand.

open_fits_cube(data_filename[, ...])

Load a fits file using mpdaf.obj.Cube, and handle variance in separate file.

plot_ModelResults_pixel(fitList[, title, ...])

Create a multipanel figure comparing fits to the same data.

plot_baseline(fitresult)

process_settings(default_settings[, ...])

Combine the default settings with any user settings.

process_settings_dict(default_settings[, ...])

Combine the default settings with any user settings.

remove_baseline(cube, subcube_av, ...)

save_choice_fit_stats(filename, fit_results, ...)

Compile fit choice and parameter summary, and save to file.

save_fit_stats([filename, dataset, ...])

Compile fit parameter summary and save to file.

save_pdf_plots(filename, fitList[, ...])

Save plots of each spaxel fit as separate page in 1 pdf file.

save_to_file(filename, result_list)

Convience wrapper of csv.writer.

spatial_average(cube, kernel_image, **kwargs)

Apply kernel image smoothing on every spatial image in a cube.

tweak_redshift(cube, z_gal[, ...])

Interactively choose a new redshift.

Classes

RecursiveArray([array])

Subclass of list which distributes attribute and function calls recursively.

ResultDict([data_array, names, data_dict, ...])

Container for ordered dict of numpy ndarrays with save/load functionality.

Variables

DEFAULT_FIT_INFO

Define typical ModelResult information we might want.

FLAM16

A header["BUNIT"] value we have.

FLOAT_FMT

Default formatting for floats in output files.

vget_aic

Vectorized get_aic().

vget_param_values

Retrieve parameter value by name from lmfit objects.

threadcount.mpdaf_ext Module

Functions to extend Spectrum, Image, and Cube from package mpdaf.

Functions

correlate2d_norm(self, other[, interp])

Return the cross-correlation of the image with an array.

lmfit(self, model, **kwargs)

Fit model to Spectrum using lmfit.

threadcount.lmfit_ext Module

Functions to extend classes Model, ModelResult, Parameters from package lmfit.

Functions

aic_real(self)

Chisqr + 2 * nvarys.

bic_real(self)

Chisqr + np.log(ndata) * nvarys.

extend_lmfit(lmfit)

mc_iter(self[, n_mc_iterations, distribution])

ModelResult extension to change the data related to sigma and refit.

order_gauss(self[, delta_x])

plot2(self[, datafmt, fitfmt, initfmt, ...])

Plot the fit results and residuals using matplotlib.

plot_components(self[, ax, show_combined, ...])

set_param_hints_endswith(self, name, **kwargs)

Set param hints for all model params names ending in name.

stderrsdict(self)

Return an ordered dictionary of parameter stderrs.

summary_array(self[, fit_info, param_info])

valerrsdict(self)

Return a dictionary of parameter [value, stderr].