@@ -57,29 +57,32 @@ def fit(
5757 """
5858
5959 def t (g : np .ndarray ) -> np .ndarray :
60- """Transpose for external API compliance."""
60+ """Transpose (permute) axes for external API compliance."""
6161 return np .moveaxis (g , 0 , - 1 ) if g .ndim > 1 else g
6262
6363 def r (
6464 _ : np .ndarray , shape : tuple = (), copy : bool = False
6565 ) -> np .ndarray :
66- """Ravel for external API compliance."""
66+ """Ravel (reshape) for external API compliance."""
6767 return (
6868 np .reshape (_ , shape = (- 1 ,) + shape , copy = copy )
6969 if _ .ndim - 1 > len (shape )
7070 else _
7171 )
7272
7373 def u (_ : np .ndarray , shape : tuple , copy : bool = False ) -> np .ndarray :
74- """Unravel for external API compliance ."""
74+ """Unravel (revert) to original shape ."""
7575 return (
7676 np .reshape (_ , shape = shape , copy = copy )
7777 if _ .ndim < len (shape )
7878 else _
7979 )
8080
8181 def w (u : np .ndarray ) -> np .ndarray :
82- """Convert for external API compliance."""
82+ """
83+ Convert sample uncertainties to inverse variance weights
84+ for external API compliance.
85+ """
8386 return 1.0 / np .square (u )
8487
8588 def eval (x : np .ndarray , p : np .ndarray ) -> np .ndarray :
@@ -105,8 +108,8 @@ def jac_x(x: np.ndarray, p: np.ndarray) -> np.ndarray:
105108
106109 res = odrpack .odr_fit (
107110 f = eval ,
108- xdata = r (x , m_r , copy = True ).T ,
109- ydata = r (y , n_r , copy = True ).T ,
111+ xdata = r (x , m_r ).T ,
112+ ydata = r (y , n_r ).T ,
110113 beta0 = r (p ),
111114 weight_x = r (w (ux ), m_r ).T if ux is not None else None ,
112115 weight_y = r (w (uy ), n_r ).T if uy is not None else None ,
0 commit comments