tardis.energy_input.gamma_ray_packet_source module¶
- class tardis.energy_input.gamma_ray_packet_source.GammaRayPacketSource(packet_energy, gamma_ray_lines, positronium_fraction, inner_velocities, outer_velocities, inv_volume_time, times, energy_df_rows, effective_times, taus, parents, average_positron_energies, average_power_per_mass, **kwargs)[source]¶
Bases:
BasePacketSource
- calculate_positron_fraction(isotopes)[source]¶
Calculate the fraction of energy that an isotope releases as positron kinetic energy
- Parameters:
- isotopesarray
Array of isotope names as strings
- Returns:
- dict
Fraction of energy released as positron kinetic energy per isotope
- create_packet_directions(no_of_packets)[source]¶
Create an array of random directions
- Parameters:
- no_of_packetsint
Number of packets to produce directions for
- Returns:
- array
Array of direction vectors
- create_packet_energies(no_of_packets, energy)[source]¶
Create the uniform packet energy for a number of packets
- Parameters:
- no_of_packetsint
Number of packets
- energyfloat
The packet energy
- Returns:
- array
Array of packet energies
- create_packet_nus(no_of_packets, packets, positronium_fraction, positronium_energy, positronium_intensity)[source]¶
Create an array of packet frequency-energies (i.e. E = h * nu)
- Parameters:
- no_of_packetsint
Number of packets to produce frequency-energies for
- packetspd.DataFrame
DataFrame of packets
- positronium_fractionfloat
The fraction of positrons that form positronium
- positronium_energyarray
Array of positronium frequency-energies to sample
- positronium_intensityarray
Array of positronium intensities to sample
- Returns:
- array
Array of sampled frequency-energies
- create_packet_radii(sampled_packets_df)[source]¶
Initialize the random radii of packets in a shell
- Parameters:
- packet_countint
Number of packets in the shell
- sampled_packets_dfpd.DataFrame
Dataframe where each row is a packet
- Returns:
- array
Array of length packet_count of random locations in the shell
- create_packet_times_uniform_energy(no_of_packets, isotopes, decay_time)[source]¶
Samples the decay time from the mean lifetime of the isotopes
- Parameters:
- no_of_packetsint
Number of packets
- isotopespd.Series
Series of packet parent isotopes
- decay_timearray
Series of packet decay time index
- Returns:
- array
Array of decay times
- create_packet_times_uniform_time(no_of_packets, start, end)[source]¶
Samples decay time uniformly (needs non-uniform packet energies)
- Parameters:
- no_of_packetsint
Number of packets
- startfloat
Start time
- endfloat
End time
- Returns:
- array
Array of packet decay times
- create_packets(decays_per_isotope, number_of_packets, *args, **kwargs)[source]¶
Initialize a collection of GXPacket objects for the simulation to operate on.
- Parameters:
- decays_per_isotopearray int64
Probability of decays per simulation shell per isotope per time step
- number_of_packetsint
Number of packets to create
- Returns:
- GXPacketCollection
- class tardis.energy_input.gamma_ray_packet_source.RadioactivePacketSource(packet_energy, gamma_ray_lines, positronium_fraction, inner_velocities, outer_velocities, inv_volume_time, times, energy_df_rows, effective_times, taus, parents, average_positron_energies, average_power_per_mass, **kwargs)[source]¶
Bases:
BasePacketSource
- calculate_energy_factors(no_of_packets, start_time, decay_times)[source]¶
Calculates the factors that adjust the energy of packets emitted before the first time step and moves those packets to the earliest possible time
- Parameters:
- no_of_packetsint
Number of packets
- start_timefloat
First time step
- decay_timesarray
Packet decay times
- Returns:
- array
Energy factors
- array
Adjusted decay times
- calculate_positron_fraction(positron_energy, isotope_energy, isotope_intensity)[source]¶
Calculate the fraction of energy that an isotope releases as positron kinetic energy
- Parameters:
- positron_energyfloat
Average kinetic energy of positrons from decay
- isotope_energynumpy array
Photon energies released by the isotope
- isotope_intensitynumpy array
Intensity of photon energy release
- Returns:
- float
Fraction of energy released as positron kinetic energy
- create_packet_directions(no_of_packets)[source]¶
Create an array of random directions
- Parameters:
- no_of_packetsint
Number of packets to produce directions for
- Returns:
- array
Array of direction vectors
- create_packet_energies(no_of_packets, energy)[source]¶
Create the uniform packet energy for a number of packets
- Parameters:
- no_of_packetsint
Number of packets
- energyfloat
The packet energy
- Returns:
- array
Array of packet energies
- create_packet_nus(no_of_packets, energy, intensity, positronium_fraction, positronium_energy, positronium_intensity)[source]¶
Create an array of packet frequency-energies (i.e. E = h * nu)
- Parameters:
- no_of_packetsint
Number of packets to produce frequency-energies for
- energyOne-dimensional Numpy Array, dtype float
Array of frequency-energies to sample
- intensityOne-dimensional Numpy Array, dtype float
Array of intensities to sample
- positronium_fractionfloat
The fraction of positrons that form positronium
- positronium_energyarray
Array of positronium frequency-energies to sample
- positronium_intensityarray
Array of positronium intensities to sample
- Returns:
- array
Array of sampled frequency-energies
- array
Positron creation mask
- create_packet_radii(no_of_packets, inner_velocity, outer_velocity)[source]¶
Initialize the random radii of packets in a shell
- Parameters:
- packet_countint
Number of packets in the shell
- inner_velocityfloat
Inner velocity of the shell
- outer_velocityfloat
Outer velocity of the shell
- Returns:
- array
Array of length packet_count of random locations in the shell
- create_packet_times_uniform_energy(no_of_packets, start_tau, end_tau=0.0, decay_time_min=0.0, decay_time_max=0.0)[source]¶
Samples the decay time from the mean lifetime of the isotopes
- Parameters:
- no_of_packetsint
Number of packets
- start_taufloat
Initial isotope mean lifetime
- end_taufloat, optional
Ending mean lifetime, by default 0.0 for single decays
- decay_time_minfloat, optional
Minimum time to decay, by default 0.0
- decay_time_maxfloat, optional
Maximum time to decay, by default 0.0
- Returns:
- array
Array of decay times
- create_packet_times_uniform_time(no_of_packets, start, end)[source]¶
Samples decay time uniformly (needs non-uniform packet energies)
- Parameters:
- no_of_packetsint
Number of packets
- startfloat
Start time
- endfloat
End time
- Returns:
- array
Array of packet decay times
- create_packets(decays_per_isotope, *args, **kwargs)[source]¶
Initialize a collection of GXPacket objects for the simulation to operate on.
- Parameters:
- decays_per_isotopearray int64
Number of decays per simulation shell per isotope
- Returns:
- list
List of GXPacket objects
- array
Array of main output dataframe rows
- array
Array of plotting output dataframe rows
- array
Array of positron output dataframe rows