WDDustModel

class dgfit.dustmodel.WDDustModel(**kwargs)[source]

Bases: DustModel

Dust model that uses the Weingartner & Draine (2001) size distributions.

Same kewyords and attributes as the parent DustModel class.

Methods Summary

compute_size_dist(x, params)

Compute the size distribution for the input sizes.

eff_grain_props(OD[, predict_all])

Compute the effective grain properties of the ensemble of grain sizes and compositions.

get_percentile_vals(chain, ndim)

Compute the 50% +/- 33% values from the samples

grains_on_model(full_dustmodel)

Calculate the dust grain properties on the model grid (simple copy).

grains_on_obs(full_dustmodel, observeddata)

Calculate the dust grain properties on the observed wavelength grid.

initial_walkers(p0, nwalkers)

Setup the walkers based on the initial parameters p0 Specific to MCMC fitters (e.g., emcee).

lnprob(params, obsdata, dustmodel)

Compute the ln(prob) given the model parameters

lnprob_generic(obsdata)

Compute the ln(prob) for the dust grain size and composition distribution as defined by the dustmodel.

read_grain_files(componentnames[, path, ...])

Read in the precomputed dust grain physical properties from files for each grain component.

read_sizedist_from_file(filename)

Read in the size distribution from a file interpolating across sizes if needed

save_50percentile_results(oname, sampler, ...)

Compute the 50th percentile paramaters, set the size distribution, and save the results

save_best_results(oname, sampler, obsdata[, ...])

Compute the best fit paramaters using a sampler chain, set the size distribution, and save the results

save_results(filename, OD[, size_dist_uncs])

Save fitting results to a file.

set_size_dist(params)

Set the size distributions for each component based on the parameters of the functional form of the distributions.

set_size_dist_parameters(params)

Set the size distribution parameters in the object dictonary.

Methods Documentation

compute_size_dist(x, params)[source]

Compute the size distribution for the input sizes.

Parameters:
xfloats

grain sizes

paramsfloats

Size distribution parameters

Returns:
floats

Size distribution as a function of x

eff_grain_props(OD, predict_all=False)

Compute the effective grain properties of the ensemble of grain sizes and compositions.

Parameters:
ODObsData object

Observed data object specifically used to determine which observations to compute (only those needed for speed)

predict_alltype

Regardless of the ObsData, compute all possible observations

Returns:
dict

Dictonary of predicted observations E.g., keys of cext, natoms, emission, albedo, g

static get_percentile_vals(chain, ndim)

Compute the 50% +/- 33% values from the samples

Parameters:
chainsampler.chain

Chain from the EMCEE sampler

ndimint

number of paramaters

Returns:
tuple of floats

(p50, p84-p50, p50-p16)

grains_on_model(full_dustmodel)

Calculate the dust grain properties on the model grid (simple copy). Uses an existing DustModel based on the full precomputed files and an ObsData object to get the wavelength grid. Makes the fitting faster to only do this transformation once.

Parameters:
full_dustmodelDustModel object

full dust model based on input files

Returns:
updated class variables
grains_on_obs(full_dustmodel, observeddata)

Calculate the dust grain properties on the observed wavelength grid. Uses an existing DustModel based on the full precomputed files and an ObsData object to get the wavelength grid. Makes the fitting faster to only do this transformation once.

Parameters:
full_dustmodelDustModel object

full dust model based on input files

observeddata: ObsData object

observed data to use for transformation

Returns:
updated class variables
initial_walkers(p0, nwalkers)[source]

Setup the walkers based on the initial parameters p0 Specific to MCMC fitters (e.g., emcee).

Parameters:
p0floats

Initial values of the parameters

nwalkersint

Number of walkers to initialize

Returns:
array of floats

concatenated set of initial walker positions

static lnprob(params, obsdata, dustmodel)[source]

Compute the ln(prob) given the model parameters

Parameters:
paramsarray of floats 4

parameters of the WD model

obsdataObsData object

observed data for fitting

dustmodelDustModel object

must be passed explicitly as the fitters require a static method (is this true?)

Returns:
lnprobfloat

natural log of the probability the input parameters describe the data

lnprob_generic(obsdata)

Compute the ln(prob) for the dust grain size and composition distribution as defined by the dustmodel.

Parameters:
obsdataObsData object

All the observed data

Returns:
float

natural log of the probability

read_grain_files(componentnames, path='./', every_nth=5)

Read in the precomputed dust grain physical properties from files for each grain component.

Parameters:
componentnameslist of strings

names of dust grain materials

pathtype

path to files

every_nthint

Only use every nth size, faster fitting

Returns:
updated class variables
read_sizedist_from_file(filename)

Read in the size distribution from a file interpolating across sizes if needed

Parameters:
filenamestr

name of FITS file with size distributions one component per extension

save_50percentile_results(oname, sampler, obsdata, nburn=0, cur_step=None)

Compute the 50th percentile paramaters, set the size distribution, and save the results

Creates a FITS file with the results

Parameters:
onamestr

Name of the file to save the results

sampleremcee.sampler

Sampler object from EMCEE run

obsdataObsData object

All the observed data (may not be needed)

cur_stepint

Current step number

save_best_results(oname, sampler, obsdata, cur_step=None)

Compute the best fit paramaters using a sampler chain, set the size distribution, and save the results

Creates a FITS file with the results

Parameters:
onamestr

Name of the file to save the results

sampleremcee.sampler

Sampler object from EMCEE run

obsdataObsData object

All the observed data (may not be needed)

cur_stepint

Current step number

save_results(filename, OD, size_dist_uncs=[0])

Save fitting results to a file. Results include the size distribution and all predicted observations.

Creates a FITS file with the results

Parameters:
filenamestr

Name of the file to save the results

ODObsData object

All the observed data (may not be needed)

size_dist_uncsfloats

Uncertainties on the size distributions

set_size_dist(params)

Set the size distributions for each component based on the parameters of the functional form of the distributions.

Parameters:
new_size_diststype

Description of parameter new_size_dists.

Returns:
type

Description of returned object.

set_size_dist_parameters(params)[source]

Set the size distribution parameters in the object dictonary.

Parameters:
paramsfloats

Size distribution parameters