astromodels.sources package

Submodules

Module contents

class astromodels.sources.ExtendedSource(source_name, spatial_shape, spectral_shape=None, components=None, polarization=None)[source]

Bases: Source, Node

property free_parameters

Returns a dictionary of free parameters for this source We use the parameter path as the key because it’s guaranteed to be unique, unlike the parameter name.

Returns:

get_boundaries()[source]

Returns the boundaries for this extended source

Returns:

a tuple of tuples ((min. lon, max. lon), (min lat, max lat))

get_spatially_integrated_flux(energies)[source]

Returns total flux of source at the given energy :param energies: energies (array or float) :return: differential flux at given energy

property has_free_parameters

Returns True or False whether there is any parameter in this source

Returns:

property parameters

Returns a dictionary of all parameters for this source. We use the parameter path as the key because it’s guaranteed to be unique, unlike the parameter name.

Returns:

property spatial_shape

A generic name for the spatial shape.

Returns:

the spatial shape instance

class astromodels.sources.ParticleSource(name, distribution_shape=None, components=None)[source]

Bases: Source, Node

A source of particles with a certain distribution. This source does not produce any electromagnetic signal, but it is useful if used in conjuction with spectral shapes which need a particle distribution as input, like for example a Synchrotron kernel.

Parameters:
  • name – name for the source

  • distribution_shape – a function describing the energy distribution of the particles

  • components – a list of SpectralComponents instances

Returns:

property free_parameters

Returns a dictionary of free parameters for this source. We use the parameter path as the key because it’s guaranteed to be unique, unlike the parameter name.

Returns:

get_flux(energies)[source]

Get the total flux of this particle source at the given energies (summed over the components)

property parameters

Returns a dictionary of all parameters for this source. We use the parameter path as the key because it’s guaranteed to be unique, unlike the parameter name.

Returns:

class astromodels.sources.PointSource(source_name: str, ra: float | None = None, dec: float | None = None, spectral_shape: Function1D | None = None, l: float | None = None, b: float | None = None, components=None, sky_position: SkyDirection | None = None, polarization=None)[source]

Bases: Source, Node

A point source. You can instance this class in many ways.

  • with Equatorial position and a function as spectrum (the component will be automatically called ‘main’):

    >>> from astromodels import *
    >>> point_source = PointSource('my_source', 125.6, -75.3, Powerlaw())
    
  • with Galactic position and a function as spectrum (the component will be automatically called ‘main’):

    >>> point_source = PointSource('my_source', l=15.67, b=80.75, spectral_shape=Powerlaw())
    
  • with Equatorial position or Galactic position and a list of spectral components:

    >>> c1 = SpectralComponent("component1", Powerlaw())
    >>> c2 = SpectralComponent("component2", Powerlaw())
    >>> point_source = PointSource("test_source",125.6, -75.3,components=[c1,c2])
    
    Or with Galactic position:
    
    >>> point_source = PointSource("test_source",l=15.67, b=80.75,components=[c1,c2])
    

NOTE: by default the position of the source is fixed (i.e., its positional parameters are fixed)

Parameters:
  • source_name – name for the source

  • ra – Equatorial J2000 Right Ascension (ICRS)

  • dec – Equatorial J2000 Declination (ICRS)

  • spectral_shape – a 1d function representing the spectral shape of the source

  • l – Galactic latitude

  • b – Galactic longitude

  • components – list of spectral components (instances of SpectralComponent)

  • sky_position – an instance of SkyDirection

Returns:

property free_parameters: Dict[str, Parameter]

Returns a dictionary of free parameters for this source. We use the parameter path as the key because it’s guaranteed to be unique, unlike the parameter name.

Returns:

property has_free_parameters: bool

Returns True or False whether there is any parameter in this source

Returns:

property parameters: Dict[str, Parameter]

Returns a dictionary of all parameters for this source. We use the parameter path as the key because it’s guaranteed to be unique, unlike the parameter name.

Returns: