threeML.plugins.DispersionSpectrumLike module

class threeML.plugins.DispersionSpectrumLike.DispersionSpectrumLike(name: str, observation: BinnedSpectrumWithDispersion, background: Optional[Union[BinnedSpectrum, SpectrumLike, XYLike]] = None, background_exposure: Optional[float] = None, verbose: bool = True, tstart: Optional[float] = None, tstop: Optional[float] = None)[source]

Bases: SpectrumLike


Display the currently loaded full response matrix, i.e., RMF and ARF convolved :return:

classmethod from_function(name: str, source_function, response, source_errors=None, source_sys_errors=None, background_function=None, background_errors=None, background_sys_errors=None, exposure=1.0, scale_factor=1.0) DispersionSpectrumLike[source]

Construct a simulated spectrum from a given source function and (optional) background function. If source and/or background errors are not supplied, the likelihood is assumed to be Poisson.

  • name – simulated data set name

  • source_function – astromodels function

  • response – 3ML Instrument response

  • source_errors – (optional) gaussian source errors

  • source_sys_errors – (optional) systematic source errors

  • background_function – (optional) astromodels background function

  • background_errors – (optional) gaussian background errors

  • background_sys_errors – (optional) background systematic errors

  • exposure – the exposure to assume

  • scale_factor – the scale factor between source exposure / bkg exposure


simulated DispersionSpectrumLike plugin

get_simulated_dataset(new_name=None, **kwargs)[source]

Returns another DispersionSpectrumLike instance where data have been obtained by randomizing the current expectation from the model, as well as from the background (depending on the respective noise models)


a DispersionSpectrumLike simulated instance

property response: InstrumentResponse
set_model(likelihoodModel: Model) None[source]

Set the model to be used in the joint minimization.

set_model_integrate_method(method: str)[source]

Change the integrate method for the model integration :param method: (str) which method should be used (simpson or trapz)

write_pha(filename: str, overwrite: bool = False, force_rsp_write: bool = False) None[source]

Writes the observation, background and (optional) rsp to PHAII fits files

  • filename – base file name to write out

  • overwrite – if you would like to force overwriting of the files

  • force_rsp_write – force the writing of an rsp even if not required