-
Notifications
You must be signed in to change notification settings - Fork 4
Useful Tools
Highlights of useful tools/features in diskpy. Refer to the docstrings of the functions for more information. These are just a few of the available functions.
Module diskpy.utils containing utilities used by all of diskpy. Here are a few useful ones.
-
configparser: Reads tipsy .param files and ChaNGa .director files and returns them as adict. Use in conjunction withutils.configsave. -
configsave: Save a tipsy .param file or ChaNGa .director file -
logparser: parse a ChaNGa log file and return a dict of the runtime parameters used. -
deepreload: Can be useful for reloading sub-packages during development. If using IPython, you should use%load_ext autoreload,%autoreload 2instead.
Module diskpy.disk, containing functions useful for analyzing and dealing with protoplanetary disks. Here are a few useful ones.
-
height: Disk height -
kappa: Disk epicyclic frequency -
sigma: Surface density -
Q: Toomre Q -
Qeff: Effective Toomre Q for 3D disks (Backus & Quinn 2016).
Module diskpy.pychanga containing functions to interface with and execute ChaNGa from python. Here are a few useful modules.
-
changa_command: Generate a command to run ChaNGa, uses the ChaNGa presets defined indiskpy.global_settings['changa_presets']. Use in conjunction with changa_run -
changa_run: Run ChaNGa from python, using a command generated by changa_command -
get_fnames: Get output filenames from a ChaNGa simulation (as of writing, this only works with tipsy formatting). -
snapshot_time: Get the time of a snapshot -
units_from_param: Try to infer the simulation units from a .param file or a param dict -
walltime: Read walltime from a ChaNGa log file. Useful for monitoring a simulation
Module diskpy.pdmath containing math utilities
-
binned_mean: for (x, y, z) observations, bin y according to x and take the mean of z in each bin. Respects units. - `setupbins': setup bins for binning data. Can handle linear/logarithmic spacing
-
digitize_threshold: Bin data and setup the bins requiring at least N data points per bin.
Module diskpy.plot for some plotting functions
-
colorCodedArray: Plot a pynbody.image for one quantity, color coded by another.
Module diskpy.ICgen for generating ICs for protoplanetary disks.
-
ICgen.IC: The class for generating initial conditions for protoplanetary disks. Initialize withIC = diskpy.ICgen.IC()-
IC.settings: Contains the settings
-
-
ICgen.load(...): Load an ICgen file. Example:# First cd into simulation directory, then load ICs: IC = diskpy.ICgen.load('IC.p')
-
ICgen.ICgen_settings.defaults(): Echo default settings with descriptions of the settings
Settings used by diskpy
-
global_settings['max_particles']: Maximum number of particles to use in ICgen calculations. Calculating velocities very accurately probably doesn't need more than 10^6 particles, often not more than 10^5. -
global_settings['changa_presets]`: Presets used for running ChaNGa. Make sure these are set (see (Installing diskpy)[https://github.com/ibackus/diskpy/wiki#3-setup-diskpy].
pynbody defines an interface to allow users to define automatically derived arrays for SimSnaps (see pynbody automatically derived arrays). diskpy defines a number of automatically derived arrays, useful for PPDs and dusty-gas. They are described below. These arrays are defined in diskpy/utils/_derivedarrays.py. If you add a new array this wiki entry can be updated with the script generate_wiki_stuff.py in the wiki repo.
abs_dust_rho_dot: abs(rho * dustFracDot)
abs_z: Absolute value of z
cs: Sound speed
dust_delta_v: Dust delta v is defined as v_dust - v_gas
dust_delta_v_phi: Cylindrical tangential component of the dust delta v velocity in the x-y plane. Dust delta v is defined as v_dust - v_gas
dust_delta_v_rxy: Radial dust delta v in x-y plane. Dust delta v is defined as v_dust - v_gas
dust_midplane_v: component of delta v (v_dust - v_gas) in the direction of the midplane
dust_rho_dot: dustFracDot * rho
dustmass: dustFrac * mass
dustVel_phi: Cylindrical tangential component of the dust velocity in the x-y plane
dustVel_rxy: Radial dust velocity in the x-y plane
gas_v_phi: Cylindrical tangential component of the gas velocity in the x-y plane
gas_v_rxy: Gas cylindrical radial velocity
gas_vel: Gas velocity
P: Pressure
rho_dust: Dust density
roche_rho: Roche density
.. math::
\rho_{roche} \equiv M_{star}/r^3
where :math:r is the distance to the center of mass of the star(s). The
total star mass is used.
roche_rho_fac: Gas density divided by roche density
s: An alias for u_dustGrainSize
scaleheight: |z|/r (in cylindrical coords)
stokes: Dust stokes parameter, defined as the dust stopping time times the Keplerian orbital angular velocity R is calculated relative to the origin! NOT THE STARS!
tstop: Dust stopping time
u_dustFrac: Returns the auxilliary array of the same name (excluding the 'u_' prefix) with units inferred from the runtime parameters.
u_dustFracDot: Returns the auxilliary array of the same name (excluding the 'u_' prefix) with units inferred from the runtime parameters.
u_dustGrainSize: Returns the dust grain size with units for onefluid dust. If grain growth is not on, i.e. if there is not a variable dust size, the dust size is found in the snapshot param If grain growth is turned on, i.e. if there is a variable grain size, the 'dustGrainSize' is returned with proper units.
u_dustVel: Returns the auxilliary array of the same name (excluding the 'u_' prefix) with units inferred from the runtime parameters.
u_smoothlength: Returns the auxilliary array of the same name (excluding the 'u_' prefix) with units inferred from the runtime parameters.