cosmogrb.sampler package

Submodules

cosmogrb.sampler.background module

class cosmogrb.sampler.background.Background(tstart, tstop, average_rate=1000, background_spectrum_template=None)[source]

Bases: cosmogrb.sampler.sampler.Sampler

sample_channel(size=None)[source]

Sample the background template. Other options do not exist yet

Parameters:size
Returns:
Return type:
sample_times()[source]

sample the background times

Returns:
Return type:
class cosmogrb.sampler.background.BackgroundSpectrumTemplate(counts, start_at_one=False)[source]

Bases: object

classmethod from_file(file_name, start_at_one=False)[source]

Read the counts from a HDF5 file that has a dataset in its top directory called counts

Parameters:
  • cls
  • file_name
Returns:

Return type:

sample_channel(size=None)[source]

Sample from the background template

Parameters:size
Returns:
Return type:
cosmogrb.sampler.background.background_poisson_generator[source]
Parameters:
  • tstop
  • rate
Returns:

Return type:

Type:

param tstart

cosmogrb.sampler.constant_cpl module

class cosmogrb.sampler.constant_cpl.ConstantCPL(peak_flux=1e-06, ep=300.0, alpha=-1.0, emin=10.0, emax=10000.0, response=None)[source]

Bases: cosmogrb.sampler.source_function.SourceFunction

energy_integrated_evolution(time)[source]

return the integral over energy at a given time via Simpson’s rule

Parameters:time – the time of the pulse
Returns:
Return type:
evolution(energy, time)[source]

must return a matrix (time.shape, energy.shape)

sample_energy(times)[source]
sample_events(tstart, tstop, fmax)[source]
time_integrated_spectrum(energy, tmin, tmax)[source]
Parameters:
  • energy
  • t1
  • t2
Returns:

Return type:

cosmogrb.sampler.cpl_source module

class cosmogrb.sampler.cpl_source.CPLSourceFunction(peak_flux=1e-06, ep_start=300.0, ep_tau=1.0, alpha=-1.0, trise=1.0, tdecay=2, emin=10.0, emax=10000.0, response=None)[source]

Bases: cosmogrb.sampler.source_function.SourceFunction

energy_integrated_evolution(time)[source]

return the integral over energy at a given time via Simpson’s rule

Parameters:time – the time of the pulse
Returns:
Return type:
evolution(energy, time)[source]

must return a matrix (time.shape, energy.shape)

sample_energy(times)[source]
sample_events(tstart, tstop, fmax)[source]
time_integrated_spectrum(energy, tmin, tmax)[source]
Parameters:
  • energy
  • t1
  • t2
Returns:

Return type:

cosmogrb.sampler.sampler module

class cosmogrb.sampler.sampler.Sampler(tstart, tstop)[source]

Bases: object

sample_channel(size=None)[source]
sample_times()[source]
times
tstart
tstop

cosmogrb.sampler.source module

class cosmogrb.sampler.source.Source(tstart, tstop, source_function, z, use_plaw_sample=False)[source]

Bases: cosmogrb.sampler.sampler.Sampler

display_energy_dependent_light_curve(time, energy, ax=None, cmap='viridis', **kwargs)[source]

FIXME! briefly describe function

Parameters:
  • time
  • energy
  • ax
  • cmap
Returns:

Return type:

display_energy_integrated_light_curve(time, ax=None, **kwargs)[source]

FIXME! briefly describe function

Parameters:
  • time
  • ax
Returns:

Return type:

sample_channel(photons, response)[source]
sample_photons(times)[source]
sample_times()[source]

sample the evolution function INTEGRATED over energy

Returns:
Return type:
set_response(response)[source]

called if there is no response upon creation

z

Module contents

class cosmogrb.sampler.SourceFunction(emin=10.0, emax=10000.0, index=None, response=None)[source]

Bases: object

display_energy_dependent_light_curve(time, energy, ax=None, cmap='viridis', **kwargs)[source]

plot the latent light curve integrated over energy

Parameters:
  • time
  • ax
Returns:

Return type:

display_energy_integrated_light_curve(time, ax=None, **kwargs)[source]

plot the latent light curve integrated over energy

Parameters:
  • time
  • ax
Returns:

Return type:

emax
emin
energy_integrated_evolution(time)[source]

return the integral over energy at a given time via Simpson’s rule

Parameters:time – the time of the pulse
Returns:
Return type:
evolution(energy, time)[source]

must return a matrix (time.shape, energy.shape)

index
response
sample_energy(times)[source]
sample_events(tstart, tstop, fmax)[source]
set_response(response)[source]
set_source(source)[source]
classmethod time_integrated_spectrum(energy, t1, t2)[source]
Parameters:
  • energy
  • t1
  • t2
Returns:

Return type:

class cosmogrb.sampler.Source(tstart, tstop, source_function, z, use_plaw_sample=False)[source]

Bases: cosmogrb.sampler.sampler.Sampler

display_energy_dependent_light_curve(time, energy, ax=None, cmap='viridis', **kwargs)[source]

FIXME! briefly describe function

Parameters:
  • time
  • energy
  • ax
  • cmap
Returns:

Return type:

display_energy_integrated_light_curve(time, ax=None, **kwargs)[source]

FIXME! briefly describe function

Parameters:
  • time
  • ax
Returns:

Return type:

sample_channel(photons, response)[source]
sample_photons(times)[source]
sample_times()[source]

sample the evolution function INTEGRATED over energy

Returns:
Return type:
set_response(response)[source]

called if there is no response upon creation

z
class cosmogrb.sampler.Background(tstart, tstop, average_rate=1000, background_spectrum_template=None)[source]

Bases: cosmogrb.sampler.sampler.Sampler

sample_channel(size=None)[source]

Sample the background template. Other options do not exist yet

Parameters:size
Returns:
Return type:
sample_times()[source]

sample the background times

Returns:
Return type:
class cosmogrb.sampler.CPLSourceFunction(peak_flux=1e-06, ep_start=300.0, ep_tau=1.0, alpha=-1.0, trise=1.0, tdecay=2, emin=10.0, emax=10000.0, response=None)[source]

Bases: cosmogrb.sampler.source_function.SourceFunction

energy_integrated_evolution(time)[source]

return the integral over energy at a given time via Simpson’s rule

Parameters:time – the time of the pulse
Returns:
Return type:
evolution(energy, time)[source]

must return a matrix (time.shape, energy.shape)

sample_energy(times)[source]
sample_events(tstart, tstop, fmax)[source]
time_integrated_spectrum(energy, tmin, tmax)[source]
Parameters:
  • energy
  • t1
  • t2
Returns:

Return type: