pint.templates.lcprimitives.LCKernelDensity

class pint.templates.lcprimitives.LCKernelDensity(phases=None, input_file=None, **kwargs)[source]

Bases: LCPrimitive

Calculate a kernel density estimate of the light curve. The bandwidth is empirical, determined from examining several pulsars. The only parameter is an overall shift. Cannot be used with other LCPrimitive objects!

Parameters:

Shift : overall shift from original template phase

Must provide either phases or a template input file!

Methods

approx_derivative(phases[, log10_ens, ...])

approx_gradient(phases[, log10_ens, eps])

approx_hessian(phases[, log10_ens, eps])

cdf(x[, log10_ens])

center_gauss_prior([enable])

[Convenience] Set gauss mode to current params.

check_bounds([p])

check_gradient([atol, rtol, quiet])

closest_to_peak(phases)

Return the minimum distance between a member of the array of phases and the position of the mode of the primitive.

copy()

derivative(phases[, log10_ens, order])

Return d^np(phi)/dphi^n, with n=order.

dict_string()

Return a string to express the object as a dictionary that can be easily instantiated using its keys.

enable_gauss_prior([enable])

[Convenience] Turn on gaussian prior.

eval_string()

Return a string that can be evaluated to instantiate a nearly- identical object.

from_file(input_file)

from_phases(phases)

fwhm()

Return the full-width at half-maximum of the light curve model.

get_bounds([free])

get_errors([free])

get_fixed_energy_version([log10_en])

get_free_mask()

Return a mask with True if parameters are free, else False.

get_gauss_prior_parameters()

get_location([error])

get_norm([error])

get_parameter_names([free])

get_parameters([free])

get_width([error, hwhm, right])

Return the width of the distribution.

gradient(phases[, log10_ens, free])

Return the gradient of the primitives wrt the parameters.

gradient_derivative(phases[, log10_ens, free])

Return d/dphi(gradient).

hwhm([right])

Return the half-width at half-maximum of the light curve model.

init()

integrate([x1, x2])

Base implemention with scipy quad.

is_energy_dependent()

is_two_sided()

True if primitive is asymmetric.

num_parameters([free])

parse_kwargs(kwargs)

random(n[, log10_ens])

Default is accept/reject.

sanity_checks([eps])

A few checks on normalization, integration, etc.

set_errors(errs)

set_location(loc)

set_parameters(p[, free])

to_file(output_file)

__call__(phases)[source]

Call self as a function.

integrate(x1=0, x2=1)[source]

Base implemention with scipy quad.

center_gauss_prior(enable=False)

[Convenience] Set gauss mode to current params.

closest_to_peak(phases)

Return the minimum distance between a member of the array of phases and the position of the mode of the primitive.

derivative(phases, log10_ens=3, order=1)

Return d^np(phi)/dphi^n, with n=order.

dict_string()

Return a string to express the object as a dictionary that can be easily instantiated using its keys.

enable_gauss_prior(enable=True)

[Convenience] Turn on gaussian prior.

eval_string()

Return a string that can be evaluated to instantiate a nearly- identical object.

fwhm()

Return the full-width at half-maximum of the light curve model.

get_free_mask()

Return a mask with True if parameters are free, else False.

get_width(error=False, hwhm=False, right=False)

Return the width of the distribution.

Parameters:
  • error (bool) – if True, return tuple with value and error

  • hwhm (bool) – if True, scale width to be HWHM

  • right (bool) – if True, return “right” component, else “left”. There is no distinction for symmetric dists.

gradient(phases, log10_ens=3, free=False)

Return the gradient of the primitives wrt the parameters.

gradient_derivative(phases, log10_ens=3, free=False)

Return d/dphi(gradient). This is needed for computing the hessian of the profile for parameters that affect the timing model and hence pulse phase.

hwhm(right=False)

Return the half-width at half-maximum of the light curve model.

is_two_sided()

True if primitive is asymmetric. Default is False, two-sided child classes should override.

random(n, log10_ens=3)

Default is accept/reject.

sanity_checks(eps=1e-06)

A few checks on normalization, integration, etc.