SciPy

darkhistory.spec.spectrum.Spectrum

class darkhistory.spec.spectrum.Spectrum(eng, data, rs=-1.0, in_eng=-1.0, spec_type='dNdE')

Structure for particle spectra.

For an example of how to use these objects, see Example 1: Manipulating Spectra Part 1 - Spectrum.

Parameters:
engndarray

Abscissa for the spectrum.

datandarray

Spectrum stored as N or dN/dE.

rsfloat, optional

The redshift (1+z) of the spectrum. Default is -1.

in_engfloat, optional

The injection energy of the primary, if this is a secondary spectrum. Default is -1.

mode{‘N’, ‘dNdE’}, optional

Whether the input is N or dN/dE in each bin. Default is ‘dNdE’.

Attributes:
engndarray

Abscissa for the spectrum.

dNdEndarray

dN/dE of the spectrum.

Nndarray

N of the spectrum.

rsfloat, optional

The redshift (1+z) of the spectrum. Set to -1 if not specified.

lengthint

The length of the abscissa.

underflowdict of str: float

The underflow total number of particles and total energy.

Methods

at_eng(new_eng[, left, right])

Interpolates the spectrum at a new abscissa.

contract(mat)

Performs a dot product with the Spectrum.

engloss_rebin(in_eng, out_eng[, ...])

Converts an energy loss spectrum to a secondary spectrum.

rebin(out_eng)

Rebins according to a new abscissa.

rebin_fast(out_eng)

Rebins the Spectrum with 'N' spec_type quickly.

redshift(new_rs)

Redshifts the Spectrum object as a photon spectrum.

shift_eng(new_eng)

Shifts the abscissa while conserving number.

switch_spec_type([target])

Switches between data being stored as N or dN/dE.

totN([bound_type, bound_arr])

Returns the total number of particles in part of the spectrum.

toteng([bound_type, bound_arr])

Returns the total energy of particles in part of the spectrum.

__init__(eng, data, rs=-1.0, in_eng=-1.0, spec_type='dNdE')

Methods

__add__(other)

Adds two Spectrum instances together, or an array to the spectrum.

__delattr__(name, /)

Implement delattr(self, name).

__dir__(/)

Default dir() implementation.

__eq__(value, /)

Return self==value.

__format__(format_spec, /)

Default object formatter.

__ge__(value, /)

Return self>=value.

__getattribute__(name, /)

Return getattr(self, name).

__getstate__(/)

Helper for pickle.

__gt__(value, /)

Return self>value.

__hash__(/)

Return hash(self).

__init__(eng, data[, rs, in_eng, spec_type])

__init_subclass__

This method is called when a class is subclassed.

__le__(value, /)

Return self<=value.

__lt__(value, /)

Return self<value.

__mul__(other)

Takes the product of the spectrum with a Spectrum object, array or number.

__ne__(value, /)

Return self!=value.

__neg__()

Negates the spectrum.

__new__(*args, **kwargs)

__radd__(other)

Adds two Spectrum instances together, or an array to the spectrum.

__reduce__(/)

Helper for pickle.

__reduce_ex__(protocol, /)

Helper for pickle.

__repr__(/)

Return repr(self).

__rmul__(other)

Takes the product of the spectrum with an array or number.

__rsub__(other)

Subtracts this Spectrum from another or an array.

__rtruediv__(other)

Divides a number or array by the spectrum.

__setattr__(name, value, /)

Implement setattr(self, name, value).

__sizeof__(/)

Size of object in memory, in bytes.

__str__(/)

Return str(self).

__sub__(other)

Subtracts a Spectrum or an array from this Spectrum.

__subclasshook__

Abstract classes can override this to customize issubclass().

__truediv__(other)

Divides the spectrum by an array or number.

at_eng(new_eng[, left, right])

Interpolates the spectrum at a new abscissa.

contract(mat)

Performs a dot product with the Spectrum.

engloss_rebin(in_eng, out_eng[, ...])

Converts an energy loss spectrum to a secondary spectrum.

rebin(out_eng)

Rebins according to a new abscissa.

rebin_fast(out_eng)

Rebins the Spectrum with 'N' spec_type quickly.

redshift(new_rs)

Redshifts the Spectrum object as a photon spectrum.

shift_eng(new_eng)

Shifts the abscissa while conserving number.

switch_spec_type([target])

Switches between data being stored as N or dN/dE.

totN([bound_type, bound_arr])

Returns the total number of particles in part of the spectrum.

toteng([bound_type, bound_arr])

Returns the total energy of particles in part of the spectrum.

Attributes

N

__annotations__

__array_priority__

__dict__

__doc__

__module__

__weakref__

list of weak references to the object

dNdE

spec_type