API Reference¶
-
class
twind.
TigressWindModel
(z0='H', verbose=False)¶ TIGRESS Wind Launching Model class
Parameters: z0 (['H','2H','500','1000']) – Examples
>>> from twind import * >>> tw = TigressWindModel(z0='H') >>> tw.set_axes() >>> pdf = tw.build_Mpdf()
-
CoolMassFluxPDF
(u, w, sfr=1.0, params=None)¶ Model of mass loading/flux PDF for cool gas
This utilizes generalized gamma (vout) and log-normal (cs) distributions.
Parameters: - u (array_like (xarray.DataArray)) – log vout
- w (array_like (xarray.DataArray)) – log cs
- sfr (float, array_like) – SFR surface density
- params (array_like or None) – (p_v, d_v, cs0, sigma) if None, cool_params attribute will be used
Returns: pdf
Return type: array_like (xarray.DataArray)
Notes
see Joint PDF Model
-
HotMassFluxPDF
(u, w, sfr=1.0, params=None)¶ Model of mass loading/flux PDF for hot gas
This utilizes generalized gamma distributions in vBz and Mach, where vBz = sqrt(vout^2 + 5*cs^2) and Mach = vout/cs
Parameters: - u (array_like (xarray.DataArray)) – log vout
- w (array_like (xarray.DataArray)) – log cs
- sfr (float, array_like) – SFR surface density
- params (array_like or None) – (p_v, d_v, cs0, sigma) if None, cool_params attribute will be used
Returns: pdf
Return type: array_like (xarray.DataArray)
Notes
see Joint PDF Model
-
build_Mpdf
(verbose=False)¶ Build mass loading/flux PDF
This will use axes attributes (logvout, logcs, sfr) set by set_axes method
Parameters: verbose (bool) – print integrations of both cool and hot PDFs Returns: pdfs Return type: xarray.Dataset
-
build_model
(ZISM=None, renormalize=True, energy_bias=True, verbose=False)¶ Build full PDFs for mass, momentum, energy, and metal PDFs
This will use axes attributes (logvout, logcs, sfr) set by set_axes method
Parameters: - ZISM (float) – set ZISM for metal PDF (if None, ZISM=0.02)
- renormalize (bool) – if True, momentum, energy, and metal PDFs are renormalized
- energy_bias (bool) – if True, apply energy bias factor in building the energy PDF
- verbose (bool) – print integrations of both cool and hot PDFs
Returns: pdfs
Return type: xarray.Dataset
-
reset_parameters
(z0)¶ Reset parameters for different z0
This sets z0 attribute and calls _set_parameters() method.
Parameters: z0 (['H','2H','500','1000']) –
-
set_axes
(pdf=None, sfr=(-6, 2, 100), vout=(0, 4, 500), cs=(0, 4, 500), verbose=False)¶ Set axes (vout, cs, sfr) using xarray for convenient manipulations
If a simulated pdf is an input, model axes are set to be identical to those of the input pdf otherwise, axes are set for a given (log min, log max, N bins)
Key attributes, u = logvout, w = logcs, logsfr, vBz, and Mach, will be set
Parameters: - pdf (xarray.Dataset or xarray.DataArray) – a joint pdf from simulation
- sfr (float, tuple, list) – a single value of SFR surface density, or log values of min, max, and No. of bins for SFR axis
- vout (tuple, list) – log values of min, max, and No. of bins for vout axis
- cs (tuple, list) – log values of min, max, and No. of bins for cs axis
- verbose (bool) – print input ranges
-
show_parameters
()¶ Print all parameters in readable forms
-
-
class
twind.
TigressWindSampler
(z0='H', verbose=False)¶ Particle sampler for the TIGRESS Wind Model
Parameters: z0 (['H','2H','500','1000']) – Examples
>>> from twind import * >>> sampler = TigressWindSampler() >>> cool,hot=sampler.draw_mass(sfr0,mcool,mhot,area=area,dt=dt)
-
draw_energy
(sfr, ecool, ehot, area=1.0, dt=1000.0)¶ Draw particles with fixed particle energy quanta
Parameters: - sfr (float, array_like) – SFR surface density in Msun/yr/kpc^2
- ecool (float) – energy of cool gas in 10^51 erg
- ehot (float) – energy of hot gas in 10^51 erg
- area (float) – area in kpc^2
- dt (float, array_like) – time interval over which particle is sampled
Returns: cool, hot – dicts containg particle mass, 3 component velocity, sound speed, metallicity, and index of each particle in the corresponding input SFR surface density array, which will be used for reconstuction of time series
Return type: dicts
-
draw_mass
(sfr, mcool, mhot, area=1.0, dt=1000.0)¶ Draw particles with fixed particle mass quanta
Parameters: - sfr (float, array_like) – SFR surface density in Msun/yr/kpc^2
- mcool (float) – Mass of cool gas in Msun
- mhot (float) – Mass of hot gas in Msun
- area (float) – area in kpc^2
- dt (float, array_like) – time interval in yr over which particle is sampled
Returns: cool, hot – dicts containg particle mass, 3 component velocity, sound speed, metallicity, and index of each particle in the corresponding input SFR surface density array, which will be used for reconstuction of time series
Return type: dicts
-
get_refs
(sfr)¶ Obtain reference rates and loading factors for a given SFR surface density using scaling relations
Parameters: sfr (array_like) – SFR surface density Returns: - refs (array_like) – reference mass, momemtum, energy, metal outflow rates
- eta (array_like) – mass, momemtum, energy, metal loading factors for total gas
- eta_cool (array_like) – mass, momemtum, energy, metal loading factors for cool gas
- eta_hot (array_like) – mass, momemtum, energy, metal loading factors for hot gas
-
-
twind.
to_time_series
(p, time)¶ Function to convert the particle data into time series
Parameters: - p (dict) – paticle data as returned by TigressWindSampler.draw method
- time (array_like) – time array corresponding to SFR time series used to sample particles
Returns: out – time series of mass, momemtum, energy, and metals carried by sampled particles
Return type: (m, p, E, mZ)
-
class
twind.
TigressSimContainer
(z0='H', modelnames=['R2', 'R4', 'R8', 'R16', 'LGR2', 'LGR4', 'LGR8'])¶ Simulation PDF container for the TIGRESS simulation suite
Load all models at a given height.
Parameters: - z0 (['H','2H','500','1000']) –
- modelnames (['R2','R4','R8','R16','LGR2','LGR4','LGR8']) – list of model names to load
Examples
>>> from twind import * >>> sim = TigressSimContainer(z0='H')
-
class
twind.
TigressSimLoader
(name='R4', z0='H')¶ Simulated PDF loader for the TIGRESS simulation suite
Parameters: - name (['R2','R4','R8','R16','LGR2','LGR4','LGR8']) –
- z0 (['H','2H','500','1000']) –
Examples
>>> from twind import * >>> sim = TigressSimContainer(model='R4',z0='H')
-
download
(source='tigressdata', time_series=False)¶ Download simulation pdf data
Parameters: source (['tigressdata','dataverse','cca']) – Note
‘cca’ server is not yet available as a source
-
load
(download=False, time_series=False)¶ Load simulation PDF
Parameters: download (bool) – automatically call download() method if file doesn’t exist
-
pdf_reconstruction
()¶ PDF reconstruction from mass loading PDF