tardis.io.model.readers.arepo module

class tardis.io.model.readers.arepo.ArepoSnapshot(filename, species, speciesfile, alpha=0.0, beta=0.0, gamma=0.0)[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

get_grids()[source]

Returns all relevant data to create Profile objects

class tardis.io.model.readers.arepo.ConeProfile(pos, vel, rho, mass, 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

masslist of float

Meshgrid of masses.

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

Returns:
profileConeProfile object
class tardis.io.model.readers.arepo.FullProfile(pos, vel, rho, mass, 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

masslist of float

Meshgrid of masses.

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

Returns:
profileFullProfile object
class tardis.io.model.readers.arepo.Profile(pos, vel, rho, mass, 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

masslist of float

Meshgrid of masses.

xnucdict

Dictonary containing all the nuclear fraction meshgrids of the relevant species.

timefloat

Time of the data

export(nshells, filename, direction='pos', 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

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

get_profiles()[source]

Returns all profiles for manual post_processing etc.

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)[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.

Returns:
selfProfile object