RotatedFrameFitter¶
-
class trackstream.preprocess.RotatedFrameFitter(data:
astropy.coordinates.BaseCoordinateFrame, origin:astropy.coordinates.builtin_frames.ICRS, **kwargs)[source]¶ Bases:
objectClass to Fit Rotated Frames.
Todo
include errors.
- Parameters
- data
BaseCoordinateFrame In ICRS coordinates.
- origin
ICRS location of point on sky about which to rotate.
- data
- Other Parameters
- rot_lower, rot_upper
Quantity, (optional, keyword-only) The lower and upper bounds in degrees. Default is (-180, 180] degree.
- origin_lim
Quantity, (optional, keyword-only) The symmetric lower and upper bounds on origin in degrees. Default is 0.005 degree.
- fix_originbool (optional, keyword-only)
Whether to fix the origin point. Default is False.
- use_lmfitbool or None, (optional, keyword-only)
Whether to use
lmfitpackage. None (default) falls back to config file.- leastsquaresbool (optional, keyword-only)
If
use_lmfitis False, whether to to useleast_square()orminimize()Default is False- align_vbool
Whether to align by the velocity.
- rot_lower, rot_upper
Attributes Summary
Methods Summary
align_v_positive_lon(fit_values[, subsel])Align the velocity along the positive Longitudinal direction.
fit([rot0, bounds, fix_origin, use_lmfit, ...])Find Best-Fit Rotated Frame.
plot_residual([fitresult, num_rots, scalar])Plot Residual as a function of rotation angle.
residual(rotation, *[, scalar])How close phi2, the rotated latitude (dec), is to flat.
set_bounds([rot_lower, rot_upper, origin_lim])Make bounds on Rotation parameter.
Attributes Documentation
- default_fit_options¶
Methods Documentation
- align_v_positive_lon(fit_values: Dict[str, Any], subsel: Union[ellipsis, Sequence, slice] = Ellipsis)[source]¶
Align the velocity along the positive Longitudinal direction.
- Parameters
- fit_valuesdict
The rotation and origin. Output of
minimize- subselslice
sub-select a portion of the
pm_lon_coslatfor determining the average velocity.
- Returns
- valuesdict
fit_valueswith “rotation” adjusted.
- fit(rot0: Optional[astropy.units.quantity.Quantity] = None, bounds: Optional[Sequence] = None, *, fix_origin: Optional[bool] = None, use_lmfit: Optional[bool] = None, leastsquares: Optional[bool] = None, align_v: Optional[bool] = None, **kwargs)[source]¶
Find Best-Fit Rotated Frame.
- Parameters
- rot0
Quantity, optional Initial guess for rotation
- boundsarray-like, optional
Parameter bounds.
[[rot_low, rot_up], [lon_low, lon_up], [lat_low, lat_up]]
- rot0
- Returns
- resAny
The result of the minimization. Depends on arguments.
- Dict[str, Any]
Has fields “rotation” and “origin”.
- Other Parameters
- fix_originbool (optional, keyword-only)
Whether to fix the origin.
- use_lmfitbool (optional, keyword-only)
Whether to use
lmfitpackage- leastsquaresbool (optional, keyword-only)
If
use_lmfitis False, whether to to useleast_square()orminimize()(default)- align_vbool (optional, keyword-only)
Whether to align velocity to be in positive direction
- fit_kwargs:
Into whatever minimization package / function is used.
- Raises
- ImportError
If
use_lmfitandlmfitis not installed.
- plot_residual(fitresult=None, num_rots: int = 3600, scalar: bool = True)[source]¶
Plot Residual as a function of rotation angle.
- residual(rotation, *, scalar: bool = False)[source]¶
How close phi2, the rotated latitude (dec), is to flat.
- Parameters
- rotationfloat
The final rotation of the frame about the
origin. The sign of the rotation is the left-hand rule. That is, an object at a particular position angle in the un-rotated system will be sent to the positive latitude (z) direction in the final frame. In degrees.
- Returns
- resfloat or Sequence
\(\rm{lat} - 0\). If
scalaris True, then sum array_like to return float.
- Other Parameters
- scalarbool (optional, keyword-only)
Whether to sum
resinto a float. Note that ifresis also a float, it is unaffected.