tardis.visualization.tools.rpacket_plot module¶
- class tardis.visualization.tools.rpacket_plot.RPacketPlotter(sim, no_of_packets)[source]¶
Bases:
object
Plotting interface for the plotting Montecarlo packets. It creates an animated plot using plotly for the trajectories of the real packets as they travel through the ejecta starting from the photosphere.
Initializes the RPacket Plotter using the simulation object generated using the run_tardis function.
- Parameters:
- simtardis.simulation.Simulation
simulation object generated using the run_tardis function.
- no_of_packetsint
number of packets to be used for plotting.
- classmethod from_simulation(sim, no_of_packets=15)[source]¶
Creates an instance of RPacketPlotter from a TARDIS simulation object.
- Parameters:
- simtardis.simulation.Simulation
TARDIS Simulation object generated using run_tardis function.
- no_of_packetsint
number of packets to be used for plotting.
- Returns:
- RPacketPlotter
- generate_plot(theme='light')[source]¶
Creates an animated plotly plot showing the Montecarlo packets’ trajectories.
- Parameters:
- themestr, optional
theme for the plot, by default “light”
- Returns:
- plotly.graph_objs._figure.Figure
plot containing the packets, photosphere and the shells.
- get_coordinates_multiple_packets(r_packet_tracker)[source]¶
Generates an array of array containing x and y coordinates of multiple packets
- Parameters:
- r_packet_trackerpandas.core.frame.DataFrame
contains the rpacket_tracker_df dataframe with data of only specified no_of_packets
- Returns:
- numpy.ndarray
array of array containing x coordinates, y coordinates and the interactions for multiple packets
- get_coordinates_with_theta_init(r_track, mu_track, time, last_interaction_type, theta_initial=0)[source]¶
Generates the coordinates of a single packet for its entire trajectory using the
nu
andr
attributes.- Parameters:
- r_trackpandas.core.series.Series
radius of packet at different steps
- mu_trackpandas.core.series.Series
mu or the cosine of radial angle of the packet at different steps
- timeastropy.units.quantity.Quantity
time since the occurence of explosion
- last_interaction_typepandas.core.series.Series
last interaction type of the packet at different steps
- theta_initialfloat, optional
intial launch angle of packet from x axis as the packet starts from the photosphere, by default 0
- Returns:
- list
x coordinates of the packet at different steps
- list
y coordinates of the packet at different steps
- list
types of interactions occuring at different points
- get_equal_array_size(rpacket_x, rpacket_y, interactions)[source]¶
creates the coordinate arrays of different packets of same size. This is done for generating frames in animation.
- Parameters:
- rpacket_xnumpy.ndarray
x coordinates of packets
- rpacket_ynumpy.ndarray
y coordinates of packets
- interactionsnumpy.ndarray
interaction types of packets
- Returns:
- numpy.ndarray
normalized x coordinate array
- numpy.ndarray
normalized y coordinate array
- numpy.ndarray
normalized interaction types array
- int
size of the biggest array among different packets
- get_frames(frame, rpacket_x, rpacket_y, interactions, theme)[source]¶
Creates individual frames containing the go.Scatter objects for the animation.
- Parameters:
- frameint
current frame number
- rpacket_xnumpy.ndarray
x coordinates array
- rpacket_ynumpy.ndarray
y coordinates array
- interactionsnumpy.ndarray
interactions array
- themestr
theme for the plot
- Returns:
- list
list of go.Scatter objects for a particular frame number.
- get_slider_steps(rpacket_max_array_size)[source]¶
Generates different steps in the timeline slider for different frames in the animated plot.
- Parameters:
- rpacket_max_array_sizeint
maximum size of coordinate array among all the packets.
- Returns:
- list
list of dictionaries of different steps for different frames.