tardis.io.parsers.arepo module¶
- class tardis.io.parsers.arepo.ArepoSnapshot(filename, species, speciesfile, alpha=0.0, beta=0.0, gamma=0.0, boxsize=1000000000000.0, resolution=512, numthreads=4)[source]¶
Bases:
object
Loads relevant data for conversion from Arepo snapshot to a csvy-model. Requires arepo-snap-util to be installed. The snapshot is mapped onto a Cartesian grid before further processing is done.
- Parameters
- filenamestr
Path to file to be converted.
- specieslist of str
Names of the species to be exported. Have to be the same as in the species-file of the Arepo simulation
- speciesfilestr
File specifying the species used in the Arepo simulation.
- alphafloat
Euler angle alpha for rotation of the desired line- of-sight to the x-axis. Only usable with snapshots. Default: 0.0
- betafloat
Euler angle beta for rotation of the desired line- of-sight to the x-axis. Only usable with snapshots. Default: 0.0
- gammafloat
Euler angle gamma for rotation of the desired line- of-sight to the x-axis. Only usable with snapshots. Default: 0.0
- boxsizefloat
Size of the box (in cm) from which data is mapped to a Cartesian grid. Only usable with snapshots. Default: 1e12
- resolutionint
Resolution of the Cartesian grid. Only usable with snapshots. Default: 512
- numthreadsint
Number of threads with which Cartesian mapping is done. Default: 4
- class tardis.io.parsers.arepo.ConeProfile(pos, vel, rho, xnuc, time)[source]¶
Bases:
Profile
Class for profiles extracted inside a cone around the x-axis. Extends Profile.
- Parameters
- poslist of float
Meshgrid of positions in center of mass frames in Cartesian coordinates
- vellist of float
Meshgrid of velocities/ velocity vectors
- rholist of float
Meshgrid of density
- xnucdict
Dictonary containing all the nuclear fraction meshgrids of the relevant species.
- timefloat
Time of the data
- create_profile(opening_angle=20.0, inner_radius=None, outer_radius=None, show_plot=True, save_plot=None, plot_dpi=600)[source]¶
Creates a profile along the x-axis without any averaging
- Parameters
- opening_anglefloat
Opening angle (in degrees) of the cone from which the data is extracted. Refers to the total opening angle, not the angle with respect to the x axis. Default: 20.0
- inner_radiusfloat
Inner radius where the profiles will be cut off. Default: None
- outer_radiusfloat
Outer radius where the profiles will be cut off. Default: None
- show_plotbool
Specifies if a plot is to be shown after the creation of the profile. Default: True
- save_plotstr
Location where the plot is being saved. Default: None
- plot_dpiint
Dpi of the saved plot. Default: 600
- Returns
- profileLineProfile object
- class tardis.io.parsers.arepo.FullProfile(pos, vel, rho, xnuc, time)[source]¶
Bases:
Profile
Class for profiles extracted from the full snapshot, i.e. angle averaged profiles. Extends Profile.
- Parameters
- poslist of float
Meshgrid of positions in center of mass frames in Cartesian coordinates
- vellist of float
Meshgrid of velocities/ velocity vectors
- rholist of float
Meshgrid of density
- xnucdict
Dictonary containing all the nuclear fraction meshgrids of the relevant species.
- timefloat
Time of the data
- create_profile(inner_radius=None, outer_radius=None, show_plot=True, save_plot=None, plot_dpi=600)[source]¶
Creates a profile from the full snapshot. Positive and negative direction are identical.
- Parameters
- inner_radiusfloat
Inner radius where the profiles will be cut off. Default: None
- outer_radiusfloat
Outer radius where the profiles will be cut off. Default: None
- show_plotbool
Specifies if a plot is to be shown after the creation of the profile. Default: True
- save_plotstr
Location where the plot is being saved. Default: None
- plot_dpiint
Dpi of the saved plot. Default: 600
- Returns
- profileLineProfile object
- class tardis.io.parsers.arepo.LineProfile(pos, vel, rho, xnuc, time)[source]¶
Bases:
Profile
Class for profiles extrected along a line, i.e. the x-axis. Extends Profile.
- Parameters
- poslist of float
Meshgrid of positions in center of mass frames in Cartesian coordinates
- vellist of float
Meshgrid of velocities/ velocity vectors
- rholist of float
Meshgrid of density
- xnucdict
Dictonary containing all the nuclear fraction meshgrids of the relevant species.
- timefloat
Time of the data
- create_profile(inner_radius=None, outer_radius=None, show_plot=True, save_plot=None, plot_dpi=600)[source]¶
Creates a profile along the x-axis
- Parameters
- inner_radiusfloat
Inner radius where the profiles will be cut off. Default: None
- outer_radiusfloat
Outer radius where the profiles will be cut off. Default: None
- show_plotbool
Specifies if a plot is to be shown after the creation of the profile. Default: True
- save_plotstr
Location where the plot is being saved. Default: None
- plot_dpiint
Dpi of the saved plot. Default: 600
- Returns
- profileLineProfile object
- class tardis.io.parsers.arepo.Profile(pos, vel, rho, xnuc, time)[source]¶
Bases:
object
Parent class of all Profiles. Contains general function, e.g. for plotting and export.
- Parameters
- poslist of float
Meshgrid of positions in center of mass frames in Cartesian coordinates
- vellist of float
Meshgrid of velocities/ velocity vectors
- rholist of float
Meshgrid of density
- xnucdict
Dictonary containing all the nuclear fraction meshgrids of the relevant species.
- timefloat
Time of the data
- export(nshells, filename, direction='pos', statistic='mean', overwrite=False)[source]¶
Function to export a profile as csvy file. Either the positive or negative direction can be exported. By default does not overwrite existing files, saves to <filename>_<number>.csvy file instead.
- Parameters
- nshellsint
Number of shells to be exported.
- filenamestr
Name of the exported file
- directionstr
Specifies if either the positive or negative direction is to be exported. Available options: [‘pos’, ‘neg’]. Default: pos
- statisticstr
Scipy keyword for scipy.stats.binned_statistic. If statistic=None, data is not rebinned. Default: “mean”
- overwrite: bool
If true, will overwrite if a file of the same name exists. By default False.
- Returns
- filenamestr
Name of the actual saved file
- plot_profile(save=None, dpi=600, **kwargs)[source]¶
Plots profile, both in the positive and negative direction.
- Parameters
- savestr
Path under which the figure is to be saved. Default: None
- dpiint
Dpi of the saved figure
- **kwargskeywords passable to matplotlib.pyplot.plot()
- Returns
- figmatplotlib figure object
- rebin(nshells, statistic='mean')[source]¶
Rebins the data to nshells. Uses the scipy.stats.binned_statistic to bin the data. The standard deviation of each bin can be obtained by passing the statistics=”std” keyword.
- Parameters
- nshellsint
Number of bins of new data.
- statisticstr
Scipy keyword for scipy.stats.binned_statistic. Default: mean
- Returns
- selfProfile object