vice.toolkit.hydrodisk.hydrodiskstars ===================================== A stellar migration scheme informed by the ``h277`` simulation, a zoom-in hydrodynamic simulation of a Milky Way like galaxy ran from cosmological initial conditions (a part of the ``g14`` simulation suite, Christensen et al 2012 [1]_). **Signature**: vice.toolkit.hydrodisk.hydrodiskstars(radial_bins, N = 1e5, mode = "diffusion") .. versionadded:: 1.2.0 .. warning:: Simulations which adopt this model that run for longer than 13.2 Gyr are not supported. Stellar populations in the built-in hydrodynamical simulation data span 13.2 Gyr of ages; simulations on longer timescales are highly likely to produce a ``segmentation fault``. Parameters ---------- radial_bins : array-like [elements must be positive real numbers] The bins in galactocentric radius in kpc describing the disk model. This must extend from 0 to at least 20. Need not be sorted in any way. Will be stored as an attribute. N : int [default : 1e5] An approximate number of star particles from the hydrodynamical simulation to include in the sample of candidate analogs. Their data are not stored in a single file, but split across random subsamples to decrease computational overhead when the full sample is not required. In practice, this number should be slightly larger than the number of (relevant) stellar populations simulated by a multizone model. .. note:: There are 3,102,519 star particles available for this object. Any more stellar populations than this would oversample these data. mode : str [case-insensitive] or ``None`` [default : "diffusion"] The attribute 'mode', initialized via keyword argument. Attributes ---------- radial_bins : list The bins in galactocentric radius in kpc describing the disk model. analog_data : dataframe The raw star particle data from the hydrodynamical simulation. analog_index : int The index of the star particle acting as the current analog. -1 if the analog has not yet been set (see note below under `Calling`_). mode : str or ``None`` The mode of stellar migration, describing the approximation of how stars move from birth to final radii. Either "diffusion", "sudden", or "linear". See property docstring for more details. .. note:: Only subclasses may set this attribute ``None``, in which case it is assumed that a custom migration approximation is employed by an overridden ``__call__`` function. In this case, if this attribute is not set to ``None``, multizone simulations will *still* use the approximation denoted by this property. Calling ------- As all stellar migration prescriptions must, this object can be called with three parameters, in the following order: zone : int The zone index of formation of the stellar population. Must be non-negative. tform : float The time of formation of the stellar population in Gyr. time : float The simulation time in Gyr (i.e. not the age of the star particle). .. note:: The search for analog star particles is ran when the formation time and simulation time are equal. Therefore, calling this object with the second and third parameters equal resets the star particle acting as the analog, and the data for the corresponding star particle can then be accessed via the attribute ``analog_index``. Functions --------- decomp_filter : [instancemethod] Filter the star particles based on their kinematic decomposition. Raises ------ * ValueError - Minimum radius does not equal zero - Maximum radius < 20 * ScienceWarning - This object is called with a time larger than 13.2 Gyr - The number of analog star particles requested is larger than the number available from the hydrodynamical simulation (3,102,519) Notes ----- This object requires VICE's supplementary data sample, available in its GitHub repository at ./vice/toolkit/hydrodisk/data. The first time a ``hydrodiskstars`` object is constructed, VICE will download the additional data automatically. If this process fails, it may be due to not having administrator's privileges on your system; in this event, users should speak with their administrator, who would then be able to download their data by running the following on their system: >>> import vice >>> vice.toolkit.hydrodisk.data.download() This migration scheme works by assigning each stellar population in the simulation an analog star particle from the hydrodynamical simulation. The analog is randomly drawn from a sample of star particles which formed at a similar radius and time, and the stellar population then assumes the change in orbital radius of its analog. VICE first searches for analogs in the ``h277`` data for star particles which formed at a radius of :math:`R \pm` 250 pc and at a time of :math:`T \pm` 250 Myr. If no analogs are found that satisfy this requirement, the search is widened to :math:`R \pm` 500 pc and :math:`T \pm` 500 Myr. If still no analog is found, then the time restriction of :math:`T \pm` 500 Myr is maintained, and VICE finds the star particle with the smallest difference in birth radius, assigning it as the analog. These values parameterizing this search algorithm are declared in ``vice/src/toolkit/hydrodiskstars.h`` in the VICE source tree. For further details, see "Milky Way-Like Galaxies" under VICE's science documentation. This object can be subclassed to implement a customized migration approximation by overriding the ``__call__`` function. However, in this case, users must also set the attribute ``mode`` to ``None``. If this requirement is not satisfied, multizone simulations will **still** use the approximation denoted by the ``mode`` attribute, **not** their overridden ``__call__`` function. The ``h277`` galaxy had a weak and transient bar, but does not have one at the present day. This is one notable difference between it and the Milky Way. Example Code ------------ >>> from vice.toolkit.hydrodisk import hydrodiskstars >>> import numpy as np >>> example = hydrodiskstars(np.linspace(0, 20, 81), N = 5e5) >>> example.radial_bins [0.0, 0.25, 0.5, ... 19.5, 19.75, 20.0] >>> example.analog_data.keys() ['id', 'tform', 'rform', 'rfinal', 'zfinal', 'vrad', 'vphi', 'vz'] >>> example.analog_index -1 >>> example(5, 7.2, 7.2) 5 >>> example.analog_index 200672 >>> example.analog_data["vrad"][example.analog_index] 5.6577 >>> example.mode "diffusion" .. [1] Christensen et al. (2012), MNRAS, 425, 3058 .. toctree:: :titlesonly: :maxdepth: 5 vice.toolkit.hydrodisk.hydrodiskstars.radial_bins vice.toolkit.hydrodisk.hydrodiskstars.analog_data vice.toolkit.hydrodisk.hydrodiskstars.analog_index vice.toolkit.hydrodisk.hydrodiskstars.mode vice.toolkit.hydrodisk.hydrodiskstars.decomp_filter