3.10.1.20.1.4. opengate.sources.generic

3.10.1.20.1.4.1. Attributes

gate_source_path

all_beta_plus_radionuclides

3.10.1.20.1.4.2. Classes

SourceBase

Base class for all source types.

GenericSource

GenericSource close to the G4 SPS, but a bit simpler.

TemplateSource

Source template: to create a new type of source, copy-paste

3.10.1.20.1.4.3. Functions

read_beta_plus_spectra(rad_name)

read the file downloaded from LNHB

compute_bins_density(bins)

Given a list of (energy) bins center, compute the width of each bin.

get_rad_yield(rad_name)

compute_cdf_and_total_yield(data, bins)

Compute the CDF (Cumulative Density Function) of a list of non-uniform energy bins

generate_isotropic_directions(n[, min_theta, ...])

like in G4SPSAngDistribution.cc

get_rad_gamma_energy_spectrum(rad)

set_source_rad_energy_spectrum(source, rad)

get_source_skipped_events(output, source_name)

get_source_zero_events(output, source_name)

3.10.1.20.1.4.4. Module Contents

opengate.sources.generic.gate_source_path[source]
opengate.sources.generic.all_beta_plus_radionuclides = ['F18', 'Ga68', 'Zr89', 'Na22', 'C11', 'N13', 'O15', 'Rb82'][source]
opengate.sources.generic.read_beta_plus_spectra(rad_name)[source]

read the file downloaded from LNHB there are 15 lines-long header to skip first column is E(keV) second column is dNtot/dE b+ WARNING : bins width is not uniform (need to scale for density)

opengate.sources.generic.compute_bins_density(bins)[source]

Given a list of (energy) bins center, compute the width of each bin.

opengate.sources.generic.get_rad_yield(rad_name)[source]
opengate.sources.generic.compute_cdf_and_total_yield(data, bins)[source]

Compute the CDF (Cumulative Density Function) of a list of non-uniform energy bins with associated probability. Also return the total probability.

opengate.sources.generic.generate_isotropic_directions(n, min_theta=0, max_theta=np.pi, min_phi=0, max_phi=2 * np.pi, rs=np.random)[source]

like in G4SPSAngDistribution.cc

Later : do a version with torch (gpu) instead of np (cpu) ?

opengate.sources.generic.get_rad_gamma_energy_spectrum(rad)[source]
opengate.sources.generic.set_source_rad_energy_spectrum(source, rad)[source]
opengate.sources.generic.get_source_skipped_events(output, source_name)[source]
opengate.sources.generic.get_source_zero_events(output, source_name)[source]
class opengate.sources.generic.SourceBase(user_info)[source]

Bases: opengate.userelement.UserElement

Base class for all source types.

static set_default_user_info(user_info)[source]
g4_source[source]
run_timing_intervals = None[source]
current_thread_id = None[source]
__str__()[source]
__getstate__()[source]
dump()[source]
create_g4_source()[source]
initialize(run_timing_intervals)[source]
prepare_output()[source]
get_estimated_number_of_events(run_timing_interval)[source]

# by default, all event have the same time, so we check that # this time is included into the given time interval if (

run_timing_interval[0] <= self.user_info.start_time <= run_timing_interval[1]

):

return self.user_info.n

return 0

class opengate.sources.generic.GenericSource(user_info)[source]

Bases: SourceBase

GenericSource close to the G4 SPS, but a bit simpler. The G4 source created by this class is GateGenericSource.

type_name = 'GenericSource'[source]
static set_default_user_info(user_info)[source]
create_g4_source()[source]
fTotalZeroEvents = 0[source]
fTotalSkippedEvents = 0[source]
initialize(run_timing_intervals)[source]
prepare_output()[source]
update_tac_activity()[source]
class opengate.sources.generic.TemplateSource(user_info)[source]

Bases: SourceBase

Source template: to create a new type of source, copy-paste this file and adapt to your needs. Also declare the source type in the file helpers_source.py

type_name = 'TemplateSource'[source]
static set_default_user_info(user_info)[source]
create_g4_source()[source]
initialize(run_timing_intervals)[source]