opengate.sources.generic ======================== .. py:module:: opengate.sources.generic Attributes ---------- .. autoapisummary:: opengate.sources.generic.gate_source_path opengate.sources.generic.all_beta_plus_radionuclides Classes ------- .. autoapisummary:: opengate.sources.generic.SourceBase opengate.sources.generic.GenericSource opengate.sources.generic.TemplateSource Functions --------- .. autoapisummary:: opengate.sources.generic.read_beta_plus_spectra opengate.sources.generic.compute_bins_density opengate.sources.generic.get_rad_yield opengate.sources.generic.compute_cdf_and_total_yield opengate.sources.generic.generate_isotropic_directions opengate.sources.generic.get_rad_gamma_energy_spectrum opengate.sources.generic.set_source_rad_energy_spectrum opengate.sources.generic.get_source_skipped_events opengate.sources.generic.get_source_zero_events Module Contents --------------- .. py:data:: gate_source_path .. py:data:: all_beta_plus_radionuclides :value: ['F18', 'Ga68', 'Zr89', 'Na22', 'C11', 'N13', 'O15', 'Rb82'] .. py:function:: read_beta_plus_spectra(rad_name) 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) .. py:function:: compute_bins_density(bins) Given a list of (energy) bins center, compute the width of each bin. .. py:function:: get_rad_yield(rad_name) .. py:function:: compute_cdf_and_total_yield(data, bins) Compute the CDF (Cumulative Density Function) of a list of non-uniform energy bins with associated probability. Also return the total probability. .. py:function:: generate_isotropic_directions(n, min_theta=0, max_theta=np.pi, min_phi=0, max_phi=2 * np.pi, rs=np.random) like in G4SPSAngDistribution.cc Later : do a version with torch (gpu) instead of np (cpu) ? .. py:function:: get_rad_gamma_energy_spectrum(rad) .. py:function:: set_source_rad_energy_spectrum(source, rad) .. py:function:: get_source_skipped_events(sim, source_name) .. py:function:: get_source_zero_events(sim, source_name) .. py:class:: SourceBase(user_info) Bases: :py:obj:`opengate.userelement.UserElement` Base class for all source types. .. py:method:: set_default_user_info(user_info) :staticmethod: .. py:attribute:: g4_source .. py:attribute:: run_timing_intervals :value: None .. py:attribute:: current_thread_id :value: None .. py:method:: __str__() .. py:method:: __getstate__() .. py:method:: dump() .. py:method:: create_g4_source() .. py:method:: initialize_source_before_g4_engine(source) .. py:method:: initialize_start_end_time(run_timing_intervals) .. py:method:: initialize(run_timing_intervals) .. py:method:: add_to_source_manager(source_manager) .. py:method:: prepare_output() .. py:method:: can_predict_number_of_events() .. py:class:: GenericSource(user_info) Bases: :py:obj:`SourceBase` GenericSource close to the G4 SPS, but a bit simpler. The G4 source created by this class is GateGenericSource. .. py:attribute:: type_name :value: 'GenericSource' .. py:method:: set_default_user_info(user_info) :staticmethod: .. py:method:: create_g4_source() .. py:attribute:: fTotalZeroEvents :value: 0 .. py:attribute:: fTotalSkippedEvents :value: 0 .. py:method:: initialize(run_timing_intervals) .. py:method:: check_ui_activity(ui) .. py:method:: check_confine(ui) .. py:method:: prepare_output() .. py:method:: update_tac_activity() .. py:method:: can_predict_number_of_events() .. py:class:: TemplateSource(user_info) Bases: :py:obj:`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 .. py:attribute:: type_name :value: 'TemplateSource' .. py:method:: set_default_user_info(user_info) :staticmethod: .. py:method:: create_g4_source() .. py:method:: initialize(run_timing_intervals)