fdtdx.OnOffSwitch#
- class fdtdx.OnOffSwitch(*, start_time=None, start_after_periods=None, end_time=None, end_after_periods=None, on_for_time=None, on_for_periods=None, period=None, fixed_on_time_steps=None, is_always_off=False, interval=1)[source]#
Bases:
TreeClass
Quick Reference#
Attributes
Methods
Attributes#
-
OnOffSwitch.end_after_periods:
float|None# end time after the period
-
OnOffSwitch.end_time:
float|None# end time of the switch
-
OnOffSwitch.fixed_on_time_steps:
list[int] |None# list of fixed time steps
-
OnOffSwitch.interval:
int# interval of the switch
-
OnOffSwitch.is_always_off:
bool# whether switch is always off
-
OnOffSwitch.on_for_periods:
float|None# period when the switch is active
-
OnOffSwitch.on_for_time:
float|None# time when the switch is active
-
OnOffSwitch.period:
float|None# period of the switch
-
OnOffSwitch.start_after_periods:
float|None# start time after the period
-
OnOffSwitch.start_time:
float|None# start time of the switch
Methods#
- OnOffSwitch.aset(attr_name, val, create_new_ok=False)#
Sets an attribute of this class. In contrast to the classical .at[].set(), this method updates the class attribute directly and does not only operate on jax pytree leaf nodes. Instead, replaces the full attribute with the new value.
The attribute can either be the attribute name of this class, or for nested classes it can also be the attribute name of a class, which itself is an attribute of this class. The syntax for this operation could look like this: “a->b->[0]->[‘name’]”. Here, the current class has an attribute a, which has an attribute b, which is a list, which we index at index 0, which is an element of type dictionary, which we index using the dictionary key ‘name’.
Note that dictionary keys cannot contain square brackets or single quotes (even if they are escaped).
- Parameters:
attr_name (str) – Name of attribute to set
val (Any) – Value to set the attribute to
create_new_ok (bool, optional) – If false (default), throw an error if the attribute does not exist. If true, creates a new attribute if the attribute name does not exist yet.
- Returns:
Updated instance with new attribute value
- Return type:
Self
- OnOffSwitch.calculate_on_list(num_total_time_steps, time_step_duration)[source]#
- Return type:
list[bool]
- OnOffSwitch.calculate_time_step_to_on_arr_idx(num_total_time_steps, time_step_duration)[source]#
- Return type:
list[int]
- OnOffSwitch.get_class_fields()#
- Return type:
list[TreeClassField]
- OnOffSwitch.get_public_fields()#
- Return type:
list[TreeClassField]
If you find any errors in the documentation, please report them in the Github Issues!