petpal 0.5.4__py3-none-any.whl → 0.5.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- petpal/kinetic_modeling/graphical_analysis.py +44 -0
- {petpal-0.5.4.dist-info → petpal-0.5.5.dist-info}/METADATA +1 -1
- {petpal-0.5.4.dist-info → petpal-0.5.5.dist-info}/RECORD +6 -6
- {petpal-0.5.4.dist-info → petpal-0.5.5.dist-info}/WHEEL +0 -0
- {petpal-0.5.4.dist-info → petpal-0.5.5.dist-info}/entry_points.txt +0 -0
- {petpal-0.5.4.dist-info → petpal-0.5.5.dist-info}/licenses/LICENSE +0 -0
|
@@ -91,6 +91,50 @@ def fit_line_to_data_using_lls_with_rsquared(xdata: np.ndarray,
|
|
|
91
91
|
return fit_ans[0][0], fit_ans[0][1], r_squared
|
|
92
92
|
|
|
93
93
|
|
|
94
|
+
@numba.njit()
|
|
95
|
+
def linear_least_squares_fit_with_stats(xdata: np.ndarray,
|
|
96
|
+
ydata: np.ndarray) -> tuple[float, float, float, float, float]:
|
|
97
|
+
"""Fits a line to the data using least squares and explicitly computes:
|
|
98
|
+
- Fit R^2
|
|
99
|
+
- Standard error of the intercept
|
|
100
|
+
- Standard error of the slope
|
|
101
|
+
|
|
102
|
+
Args:
|
|
103
|
+
xdata (np.ndarray): X-coordinates of the data.
|
|
104
|
+
ydata (np.ndarray): Y-coordinates of the data.
|
|
105
|
+
|
|
106
|
+
Returns:
|
|
107
|
+
tuple: A tuple containing five float values: the intercept of the fitted line, the slope
|
|
108
|
+
of the fitted line, the r-squared value, the intercept standard error, and the slope
|
|
109
|
+
standard error.
|
|
110
|
+
|
|
111
|
+
See:
|
|
112
|
+
- https://mathworld.wolfram.com/LeastSquaresFitting.html
|
|
113
|
+
"""
|
|
114
|
+
make_2d_matrix = _line_fitting_make_rhs_matrix_from_xdata
|
|
115
|
+
matrix = make_2d_matrix(xdata)
|
|
116
|
+
fit_ans = np.linalg.lstsq(matrix, ydata)
|
|
117
|
+
|
|
118
|
+
x_mean = np.mean(xdata)
|
|
119
|
+
y_mean = np.mean(ydata)
|
|
120
|
+
|
|
121
|
+
ss_res = fit_ans[1][0]
|
|
122
|
+
ss_tot = np.sum((y_mean - ydata) ** 2.)
|
|
123
|
+
|
|
124
|
+
n = len(xdata)
|
|
125
|
+
|
|
126
|
+
sum_square_xdiff = np.sum(xdata**2)-n*x_mean**2
|
|
127
|
+
sum_square_ydiff = np.sum(ydata**2)-n*y_mean**2
|
|
128
|
+
sum_square_xydiff = np.sum(xdata*ydata)-n*y_mean*x_mean
|
|
129
|
+
|
|
130
|
+
s = np.sqrt((sum_square_ydiff-sum_square_xydiff**2/sum_square_xdiff)/(n-2))
|
|
131
|
+
|
|
132
|
+
r_squared = 1.0 - ss_res / ss_tot
|
|
133
|
+
|
|
134
|
+
se_intercept = s*np.sqrt(1/n+np.mean(xdata)**2/sum_square_xdiff)
|
|
135
|
+
se_slope = s*sum_square_xdiff**(-0.5)
|
|
136
|
+
return fit_ans[0][0], fit_ans[0][1], r_squared, se_intercept, se_slope
|
|
137
|
+
|
|
94
138
|
@numba.njit()
|
|
95
139
|
def cumulative_trapezoidal_integral(xdata: np.ndarray,
|
|
96
140
|
ydata: np.ndarray,
|
|
@@ -19,7 +19,7 @@ petpal/input_function/idif_necktangle.py,sha256=o5kyAqyT4C6o7zELY4EjyHrkJyX1BWcx
|
|
|
19
19
|
petpal/input_function/pca_guided_idif.py,sha256=MPB59K5Z5oyIunIWFqFQts61z647xawLNkv8wICrKYM,44821
|
|
20
20
|
petpal/kinetic_modeling/__init__.py,sha256=tW4yRH3TwaXPwKPqdkrbQmSk9hjrF1yRkV_C59PPboQ,382
|
|
21
21
|
petpal/kinetic_modeling/fit_tac_with_rtms.py,sha256=HpK7VWVCCNoSQABY9i28vYpZsMRmvgs4vdcM_ZbdaYE,20971
|
|
22
|
-
petpal/kinetic_modeling/graphical_analysis.py,sha256=
|
|
22
|
+
petpal/kinetic_modeling/graphical_analysis.py,sha256=a7IOwYnG3Wao2XTjFgsPK563txm7s4lpMbaqUMQ5wUQ,51003
|
|
23
23
|
petpal/kinetic_modeling/parametric_images.py,sha256=sXYracBFUtFyttO-6oiDAldnU8hPN6Y4vKOD1V-DnlE,47301
|
|
24
24
|
petpal/kinetic_modeling/reference_tissue_models.py,sha256=FkLziIgtpA8tOL2gZJFg_nB8VPEBs40T7RsDAJ3nJ-A,39510
|
|
25
25
|
petpal/kinetic_modeling/rtm_analysis.py,sha256=e3EuaHXml4PDALEczwyOPpnThINAGh41UKNlOQHAPqc,25945
|
|
@@ -63,8 +63,8 @@ petpal/visualizations/graphical_plots.py,sha256=ZCKUeLX2TAQscuHjA4bzlFm1bACHIyCw
|
|
|
63
63
|
petpal/visualizations/image_visualization.py,sha256=Ob6TD4Q0pIrxi0m9SznK1TRWbX1Ea9Pt4wNMdRrTfTs,9124
|
|
64
64
|
petpal/visualizations/qc_plots.py,sha256=iaCPe-LWWyM3OZzDPZodHZhP-z5fRdpUgaH7QS9VxPM,1243
|
|
65
65
|
petpal/visualizations/tac_plots.py,sha256=zSGdptL-EnqhfDViAX8LFunln5a1b-NJ5ft7ZDcxQ38,15116
|
|
66
|
-
petpal-0.5.
|
|
67
|
-
petpal-0.5.
|
|
68
|
-
petpal-0.5.
|
|
69
|
-
petpal-0.5.
|
|
70
|
-
petpal-0.5.
|
|
66
|
+
petpal-0.5.5.dist-info/METADATA,sha256=RPzJJzXXau935KVTE1i0V7VsfqJJNmGyWWcEzROuivc,2478
|
|
67
|
+
petpal-0.5.5.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
68
|
+
petpal-0.5.5.dist-info/entry_points.txt,sha256=-AAg5GCaTRuwcLR7QWKPuKyBo8mTEMzspRmcBwaPdLo,692
|
|
69
|
+
petpal-0.5.5.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
70
|
+
petpal-0.5.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|