Source injector

Convolve a source model, response and orientation to get mock data without simulations.

Warning

The source injector is still under development. Now it only supports point sources. More types of source will be supported (e.g. extenced sources).

Classes

class cosipy.source_injector.SourceInjector(response_path, response_frame='local')[source]
static get_psr_in_galactic(coordinate, response_path, spectrum)[source]

Get the point source response (psr) in galactic. Please be aware that you must use a galactic response! To do: to make the weight parameter not hardcoded

Parameters:
  • coordinate (astropy.coordinates.SkyCoord) – The coordinate.

  • response_path (str or path.lib.Path) – The path to the response.

  • spectrum (astromodels.functions) – The spectrum of the source to be placed at the hypothesis coordinate.

Returns:

psr – The point source response of the spectrum at the hypothesis coordinate.

Return type:

histpy.Histogram

inject_point_source(spectrum, coordinate, orientation=None, source_name='point_source', make_spectrum_plot=False, data_save_path=None, project_axes=None)[source]

Get the expected counts for a point source.

Parameters:
  • spectrum (astromodels.functions) – The spectrum model defined from astromodels.

  • coordinate (astropy.coordinates.SkyCoord) – The coordinate of the point source.

  • orientation (cosipy.spacecraftfile.SpacecraftFile, option) – The orientation of the telescope during the mock simulation. This is needed when using a detector response. (the default is None, which means a galactic response is used.

  • source_name (str, optional) – The name of the source (the default is point_source).

  • make_spectrum_plot (bool, optional) – Set True to make the plot of the injected spectrum.

  • data_save_path (str or pathlib.Path, optional) – The path to save the injected data to a .h5 file. This should include the file name. (the default is None, which means the injected data won’t be saved.

  • project_axes (list, optional) – The axes to project before saving the data file (the default is None, which means the data won’t be projected).

Returns:

The Histogram object of the injected spectrum.

Return type:

histpy.Histogram