threeML.plugins.DispersionSpectrumLike module

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

Bases: SpectrumLike

display_rsp()[source]

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.

Parameters:
  • 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

Returns:

simulated DispersionSpectrumLike plugin

get_pha_files()[source]
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)

Returns:

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

Parameters:
  • 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