ArraySelectable
- class PlasmaCalcs.tools.array_select.ArraySelectable
Bases:
objectclass which adds select_… methods to a listlike object.
Methods
select_after(x)returns the value closest to x, but not smallerthan x.
returns listlike, sliced starting from the value closest to x, but not smaller than x.
returns listlike, sliced until the value closest to x, but not larger than x.
returns the value closest to x, but not larger than x.
select_between(x1, x2)returns the list of values with x1 <= value <= x2.
select_closest(x[, force_relative])returns the value closest to x.
returns the index of the value closest to x, but not smaller than x.
returns the index of the value closest to x, but not larger than x.
select_i_between(x1, x2)returns the list of indices for all values x1 <= value <= x2.
select_i_closest(x[, force_relative])returns the index of the value closest to x.
- select_after(x)
returns the value closest to x, but not smallerthan x.
If x iterable, [select_after(y) for y in x]
- select_all_after(x)
returns listlike, sliced starting from the value closest to x, but not smaller than x.
- select_all_before(x)
returns listlike, sliced until the value closest to x, but not larger than x.
- select_before(x)
returns the value closest to x, but not larger than x.
If x iterable, [select_before(y) for y in x]
- select_between(x1, x2)
returns the list of values with x1 <= value <= x2.
- select_closest(x, force_relative=None)
returns the value closest to x.
If x iterable, [select_closest(y) for y in x]- force_relative: None, ‘before’, ‘after’, ‘equal’, or ‘isclose’
- whether to also force a certain relationship between result and x:result <= x (if ‘before),result >= x (if ‘after’),result == x (if ‘equal’),np.isclose(result, x, atol=0) (if ‘isclose’).
- select_i_after(x)
returns the index of the value closest to x, but not smaller than x.
If x iterable, [select_i_after(y) for y in x]
- select_i_before(x)
returns the index of the value closest to x, but not larger than x.
If x iterable, [select_i_before(y) for y in x]
- select_i_between(x1, x2)
returns the list of indices for all values x1 <= value <= x2.
- select_i_closest(x, force_relative=None)
returns the index of the value closest to x. If x iterable, [select_i_closest(y) for y in x]
raise ValueError if that is impossible (e.g. if force_relative=’equal’ and no value == x).- force_relative: None, ‘before’, ‘after’, ‘equal’, or ‘isclose’
- whether to also force a certain relationship between result and x:result <= x (if ‘before),result >= x (if ‘after’),result == x (if ‘equal’),np.isclose(result, x, atol=0) (if ‘isclose’).