tardis.transport.geometry.calculate_distances module

tardis.transport.geometry.calculate_distances.calculate_comoving_frequency_nonhomologous(rpacket: RPacket, geometry: NumbaRadial1DGeometry, distance: float) → float[source]

Calculate packet comoving frequency after a trajectory distance.

tardis.transport.geometry.calculate_distances.calculate_distance_boundary(r, mu, r_inner, r_outer)[source]

Calculate distance to shell boundary in cm.

Parameters:
rfloat

radial coordinate of the RPacket

mufloat

cosine of the direction of movement

r_innerfloat

inner radius of current shell

r_outerfloat

outer radius of current shell

tardis.transport.geometry.calculate_distances.calculate_distance_electron(electron_density, tau_event)[source]

Calculate distance to Thomson Scattering

Parameters:
electron_densityfloat
tau_eventfloat
tardis.transport.geometry.calculate_distances.calculate_distance_line(r_packet: RPacket, comov_nu: float, is_last_line: bool, nu_line: float, time_explosion: float, enable_full_relativity: bool) → float[source]

Calculate the homologous-flow distance to the next line resonance.

Parameters:
r_packettardis.transport.montecarlo.packets.radiative_packet.RPacket

Radiative packet being propagated.

comov_nufloat

Comoving frequency at the current packet position.

is_last_linebool

Whether the packet has reached the end of the line list.

nu_linefloat

Rest frequency of the target line.

time_explosionfloat

Time since explosion in seconds.

enable_full_relativitybool

Whether to use the full-relativity distance calculation.

Returns:
float

Distance to the line resonance in centimeters.

tardis.transport.geometry.calculate_distances.calculate_distance_line_full_relativity(nu_line: float, nu: float, time_explosion: float, r_packet: RPacket) → float[source]

Calculate a fully relativistic homologous line-resonance distance.

tardis.transport.geometry.calculate_distances.calculate_distance_line_nonhomologous(rpacket: RPacket, geometry: NumbaRadial1DGeometry, nu_line: float, minimum_distance: float = 0.0, maximum_distance: float = 1e+99) → float[source]

Calculate the distance to a line resonance in a radial velocity field.

Candidate roots must lie after minimum_distance and no farther than maximum_distance along the current packet trajectory.

Parameters:
rpackettardis.transport.montecarlo.packets.radiative_packet.RPacket

Radiative packet being propagated.

geometrytardis.model.geometry.radial1d.NumbaRadial1DGeometry

Radial geometry containing the piecewise-linear velocity field.

nu_linefloat

Rest frequency of the target line.

minimum_distancefloat, optional

Exclusive lower bound for candidate resonance distances.

maximum_distancefloat, optional

Inclusive upper bound for candidate resonance distances.

Returns:
float

Distance to the line resonance in centimeters.

tardis.transport.geometry.calculate_distances.calculate_packet_position(initial_radius: float, initial_direction_cosine: float, distance: float) → tuple[float, float][source]

Calculate the packet position after a trajectory distance.

Parameters:
initial_radiusfloat

Packet radius at the start of the trajectory segment in centimeters.

initial_direction_cosinefloat

Initial cosine of the packet direction relative to the radial direction.

distancefloat

Distance traveled along the packet trajectory in centimeters.

Returns:
tuple[float, float]

Radius and direction cosine after traveling distance.

tardis.transport.geometry.calculate_distances.calculate_projected_gradient_zero_distances(rpacket: RPacket, geometry: NumbaRadial1DGeometry, distance_boundary: float) → tuple[float, float, int][source]

Calculate forward projected-gradient zeros in the current shell.

Parameters:
rpacketRPacket

Packet defining the current trajectory.

geometryNumbaRadial1DGeometry

Radial geometry containing the velocity field.

distance_boundaryfloat

Distance to the next shell boundary in centimeters.

Returns:
tuple[float, float, int]

First and second zero distances, followed by the number found. Missing distances are returned as MISS_DISTANCE.

tardis.transport.geometry.calculate_distances.calculate_projected_velocity_gradient(radius: float, direction_cosine: float, radial_velocity: float, radial_velocity_gradient: float) → float[source]

Calculate the velocity gradient projected along a packet trajectory.

Parameters:
radiusfloat

Packet radius in centimeters.

direction_cosinefloat

Cosine of the packet direction relative to the radial direction.

radial_velocityfloat

Radial flow velocity at radius in centimeters per second.

radial_velocity_gradientfloat

Radial derivative of the flow velocity in inverse seconds.

Returns:
float

Projected velocity gradient in inverse seconds.

tardis.transport.geometry.calculate_distances.get_line_id_range_nonhomologous(line_list_nu: ndarray[tuple[Any, ...], dtype[float64]], comov_nu_start: float, comov_nu_end: float, minimum_frequency_padding: float) → tuple[int, int, int][source]

Return directional candidate line-list bounds for a monotonic interval.

The transport line list is ordered by descending frequency. Both endpoint frequencies are included, with padding for numerical uncertainty. The caller excludes previously processed lines and checks resonance distances against the spatial interval.

Parameters:
line_list_nunumpy.ndarray

Line frequencies in descending order.

comov_nu_startfloat

Comoving frequency at the interval start, in Hz.

comov_nu_endfloat

Comoving frequency at the interval end, in Hz.

minimum_frequency_paddingfloat

Minimum padding in Hz, used to admit the starting close-frequency band.

Returns:
tuple[int, int, int]

Start line ID, exclusive stop line ID, and directional ID step.