API Reference
File reading
Sarracen’s design goal is to read data from multiple SPH codes while preserving full functionality. All the general file formats supported by pandas (csv, notably) work within Sarracen.
For SPH codes, Sarracen supports reading the native binary format of the Phantom code, the Gasoline code, and the Shamrock code.
Raise an issue on our GitHub if you would like Sarracen to be able to read the file format for other SPH codes (or make a pull request!).
|
Read data from a csv file. |
|
Read data from a Gasoline tipsy file. |
|
Read data from a GradSPH dump file. |
|
Read data from a Marisa dump file. |
Read data from a Phantom dump file. |
|
|
Read a Phantom .ev file and return a pandas DataFrame of the data. |
|
Read data from a Shamrock native binary format dump file. |
|
Read data from a Shamrock vtk file (compatible with Paraview). |
File writing
Sarracen can write native binary Phantom dump files. SarracenDataFrames can also be dumped to .csv using pandas functionality.
|
Write a Phantom dump file from a SarracenDataFrame. |
SarracenDataFrame
A SarracenDataFrame is a subclass of the pandas DataFrame class. It holds SPH
particle data. SarracenDataFrames will attempt to identify columns which hold
particle positions, velocities, smoothing lengths, masses and densities so that
they can be used for interpolation and rendering. Global simulation values are
stored in params, which is a standard Python dictionary.
Constructor
A SarracenDataFrame is a pandas DataFrame with support for SPH data. |
Extra Quantities
Create a new column 'rho' that contains particle densities. |
|
Create new columns that contain the densities of gas, dust (total), each dust grain size and the dust-to gas ratio in one-fluid (a.k.a. |
|
Returns the centre of mass of the data. |
Rendering
|
Render a scalar SPH target variable to a grid plot. |
|
Render a scalar SPH target variable to line plot. |
|
Create an SPH interpolated streamline plot of a target vector. |
|
Create an SPH interpolated vector field plot of a target vector. |
Interpolation
|
Interpolate this data to a 2D or 3D grid, depending on the dimensionality of the data. |
sarracen.kernels
The default smoothing kernel is the cubic spline. Additional smoothing kernels are included within the kernels module.
An implementation of the Cubic Spline kernel |
|
An implementation of the Quartic Spline kernel. |
|
An implementation of the Quintic Spline kernel. |
sarracen.disc
Accretion disc analysis routines are in the disc module.
|
Calculates the 1D azimuthally-averaged surface density profile. |
|
Calculates the 1D azimuthally-averaged profile for a target quantity. |
|
Calculates the angular momentum profile of the disc. |
|
Calculates the scale height, H/R, of the disc. |
|
Calculates <h>/H, the averaged smoothing length divided by the scale height. |
sarracen.ptmass
Analysis routines related to point masses and sink particles are in the ptmass module.
|
Determines to which sink each SPH particle is gravitationally bound. |