Skip to content

Commit bb6a687

Browse files
committed
Add documentation
1 parent a41c86a commit bb6a687

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

doc/source/analyzing/time_series_analysis.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,29 @@ see:
7777
* The cookbook recipe for :ref:`cookbook-time-series-analysis`
7878
* :class:`~yt.data_objects.time_series.DatasetSeries`
7979

80+
In addition, the :class:`~yt.data_objects.time_series.DatasetSeries` object allows to
81+
select an output based on its time or by its redshift (if defined) as follows:
82+
83+
.. code-block:: python
84+
85+
import yt
86+
87+
ts = yt.load("*/*.index")
88+
# Get output at 3 Gyr
89+
ds = ts.get_by_time((3, "Gyr"))
90+
# This will fail if no output is found within 100 Myr
91+
ds = ts.get_by_time((3, "Gyr"), tolerance=(100, "Myr"))
92+
# Get the output at the time right before and after 3 Gyr
93+
ds_before = ts.get_by_time((3, "Gyr"), side="smaller")
94+
ds_after = ts.get_by_time((3, "Gyr"), side="larger")
95+
96+
# For cosmological simulations, you can also select an output by its redshift
97+
# with the same options as above
98+
ds = ts.get_by_redshift(0.5)
99+
100+
For more information, see :meth:`~yt.data_objects.time_series.DatasetSeries.get_by_time` and
101+
:meth:`~yt.data_objects.time_series.DatasetSeries.get_by_redshift`.
102+
80103
.. _analyzing-an-entire-simulation:
81104

82105
Analyzing an Entire Simulation

0 commit comments

Comments
 (0)