Skip to content

Commit 3006e3f

Browse files
committed
Add docstring to NEI.set_timestep
1 parent e87b182 commit 3006e3f

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

nei/classes/nei.py

+33-1
Original file line numberDiff line numberDiff line change
@@ -1156,8 +1156,40 @@ def _set_adaptive_timestep(self):
11561156
self._dt = new_dt.to(u.s)
11571157

11581158
def set_timestep(self, dt: u.Quantity = None):
1159+
"""
1160+
Set the time step for the next non-equilibrium ionization time
1161+
advance.
1162+
1163+
Parameters
1164+
----------
1165+
dt: ~astropy.units.Quantity, optional
1166+
The time step to be used for the next time advance.
1167+
1168+
Notes
1169+
-----
1170+
If `dt` is not `None`, then the time step will be set to `dt`.
1171+
1172+
If `dt` is not set and the `adapt_dt` attribute of an
1173+
`~nei.classes.NEI` instance is `True`, then this method will
1174+
calculate the time step corresponding to how long it will be
1175+
until the temperature rises or drops into the next temperature
1176+
bin. If this time step is between `dtmin` and `dtmax`, then
1177+
1178+
If `dt` is not set and the `adapt_dt` attribute is `False`, then
1179+
this method will set the time step as what was inputted to the
1180+
`~nei.classes.NEI` class upon instantiation in the `dt` argument
1181+
or through the `~nei.classes.NEI` class's `dt_input` attribute.
1182+
1183+
Raises
1184+
------
1185+
~nei.classes.NEIError
1186+
If the time step cannot be set, for example if the `dt`
1187+
argument is invalid or the time step cannot be adapted.
1188+
1189+
"""
11591190

1160-
if dt is not None: # Allow the time step to set manually.
1191+
if dt is not None:
1192+
# Allow the time step to set as an argument to this method.
11611193
try:
11621194
dt = dt.to(u.s)
11631195
except Exception as exc:

0 commit comments

Comments
 (0)