Albedo#

class sunkit_spex.models.physical.albedo.Albedo(*args, **kwargs)[source]#

Bases: FittableModel

Aldedo model which adds albdeo correction to input spectrum.

Following [Kontar2006] using precomputed green matrices distributed as part of [SSW].

Parameters:
  • energy_edges – Energy edges associated with input spectrum

  • theta – Angle between Sun-observer line and X-ray source

  • anisotropy – Ratio of the flux in observer direction to the flux downwards, 1 for an isotropic source

Examples

import astropy.units as u
import numpy as np
import matplotlib.pyplot as plt

from astropy.modeling.powerlaws import PowerLaw1D
from astropy.visualization import quantity_support

from sunkit_spex.models.physical.albedo import Albedo

e_edges = np.linspace(5, 550, 600) * u.keV
e_centers = e_edges[0:-1] + (0.5 * np.diff(e_edges))
source = PowerLaw1D(amplitude=1*u.ph/(u.cm*u.s), x_0=5*u.keV, alpha=3)
albedo = Albedo(energy_edges=e_edges)
observed = source | albedo

with quantity_support():
    plt.figure()
    plt.plot(e_centers,  source(e_centers), 'k', label='Source')
    for i, t in enumerate([0, 45, 90]*u.deg):
        albedo.theta = t
        plt.plot(e_centers,  observed(e_centers), '--', label=f'Observed, theta={t}', color=f'C{i+1}')
        plt.plot(e_centers,  observed(e_centers) - source(e_centers), ':',
                 label=f'Reflected, theta={t}', color=f'C{i+1}')

    plt.ylim(1e-6,  1)
    plt.xlim(5, 550)
    plt.loglog()
    plt.legend()
    plt.show()

(Source code, png, hires.png, pdf)

../_images/sunkit_spex-models-physical-albedo-Albedo-1.png

Attributes Summary

anisotropy

n_inputs

n_outputs

name

param_names

Names of the parameters that describe models of this type.

theta

Methods Summary

__call__(*inputs[, model_set_axis, ...])

Evaluate this model using the given input(s) and the parameter values that were specified when the model was instantiated.

evaluate(spectrum, theta, anisotropy)

Evaluate the model on some input variables.

Attributes Documentation

anisotropy = Parameter('anisotropy', value=1.0, fixed=True)#
n_inputs = 1#
n_outputs = 1#
name = 'Albedo'#
param_names = ('theta', 'anisotropy')#

Names of the parameters that describe models of this type.

The parameters in this tuple are in the same order they should be passed in when initializing a model of a specific type. Some types of models, such as polynomial models, have a different number of parameters depending on some other property of the model, such as the degree.

When defining a custom model class the value of this attribute is automatically set by the Parameter attributes defined in the class body.

theta = Parameter('theta', value=0.0, unit=deg, bounds=(-90, 90))#

Methods Documentation

__call__(
*inputs,
model_set_axis=None,
with_bounding_box=False,
fill_value=nan,
equivalencies=None,
inputs_map=None,
**new_inputs,
)#

Evaluate this model using the given input(s) and the parameter values that were specified when the model was instantiated.

evaluate(spectrum, theta, anisotropy)[source]#

Evaluate the model on some input variables.