cwitools.kinematics.closing_window_moments¶
-
cwitools.kinematics.closing_window_moments(x, y, m1_init=None, window_max=25, window_min=15, window_step_size=1, y_var=[], get_err=True)¶ Calculate first and second moments using the ‘closing-window method’ (O’Sullivan et al. 2020).
- Args:
x (np.array): Input coordinate values (e.g. wavelength). y (np.array): Input weights (i.e. intensity) m1_init (float): Initial guess for first moment, used to center window.
If none given, center value of x will be used.window_max (float): Starting window size for calculation (in same unit as x) window_min (float): Minimum window size for calculation. (same units as x) window_step_size (float): Decrease in window size for each step (same units as x).
- Returns:
- float: The first moment in x. float: Error on the final first moment calculation (if get_err is True) float: The second moment in x float: Error on the final second moment calculation (if get_err is True)