neclib.coordinates.optimize#
Aliases#
Value range bound by 2 values. |
|
Get logger instance which prints operation logs to console. |
- class DriveLimitChecker(limit, preferred_limit=None, *, unit=None, max_observation_size=<Quantity 5. deg>)[source]#
Bases:
object
Find optimum and safe angle to drive to.
The optimization includes:
Apply drive range constraint
Avoid direction unwrapping (360deg drive) during observation
Avoid over-180deg drive
- Parameters:
limit (ValueRange[Union[Quantity, int, float, ndarray[Any, dtype[number]], Array[Union[int, float]]]]) – Drive range limit, the optimization result never go out of this range.
preferred_limit (Optional[ValueRange[Union[Quantity, int, float, ndarray[Any, dtype[number]], Array[Union[int, float]]]]]) – Drive range limit, which can be violated to continue observation or no other choice found.
unit (Optional[Union[UnitBase, str]]) – Angular unit in which the parameters are given.
max_observation_size (Union[Quantity, int, float, ndarray[Any, dtype[number]], Array[Union[int, float]]]) – If separation between current and target coordinates is smaller than this value, direction unwrapping won’t occur, possibly violating
preferred_limit
, to not interrupt observation.
Examples
>>> checker = neclib.coordinates.DriveLimitChecker( ... [-260 << u.deg, 260 << u.deg], [-250 << u.deg, 250 << u.deg] ... ) >>> checker.optimize(current=-200 << u.deg, target=170 << u.deg) <Quantity -190. deg>
- optimize(current, target, unit=None)[source]#
Optimize the coordinate to command.
- Parameters:
current (Union[Quantity, int, float, ndarray[Any, dtype[number]], Array[Union[int, float]]]) – Current coordinate, scalar or n-d array of shape […, N].
target (Union[Quantity, int, float, ndarray[Any, dtype[number]], Array[Union[int, float]]]) – Target coordinate to be optimized, scalar or n-d array of shape […, N] or […, N, T], where T is time series length.
unit (Optional[Union[UnitBase, str]]) – Angular unit in which the
current
andtarget
are given.
- Return type:
Optional[Quantity]