Conversation
ihosten
commented
Jul 21, 2025
- implementation of lt1 identification method based on standard increment
- implementation of lt1 identification method based on standard increment starting from the lowest registered lactate measurement
- start of implementation of the log-log method --> still in the works
| pw_fit = piecewise_regression.Fit(self.X, self.y, n_breakpoints=2) | ||
| pw_results = pw_fit.get_results() | ||
|
|
||
| if "breakpoint1" not in pw_results.get("estimates", {}): |
There was a problem hiding this comment.
maybe also a good idea to add "breakpoint2"
| self.y_raw_for_plot = y | ||
|
|
||
| # Ensure working on copies | ||
| self.X = np.asarray(copy.deepcopy(X)) |
There was a problem hiding this comment.
no need. is already implemented in the base class. np.array returns a copy of the data and not a reference.
There was a problem hiding this comment.
modified (also for loglog, lt1_si_lowest, lt1_si, lt2 breakpoint
|
|
||
|
|
||
| class LT1_loglog(BaseModel): | ||
| """ |
There was a problem hiding this comment.
this class does not contain logic for the log log method
There was a problem hiding this comment.
modified the loglog and seems to work and give an acceptable outcome but peerreview is absolutely needed on this one!!!!!!
| self, | ||
| X: ArrayLike, | ||
| y: ArrayLike, | ||
| si: float = 0.5, |
There was a problem hiding this comment.
si is not used inside this function
| si: the standard increment, defaults to 0.5 | ||
|
|
||
| threshold_above_baseline (float, optional): Threshold above baseline | ||
| for filtering in the "modified" implementation. Defaults to 0.5. |
There was a problem hiding this comment.
no modified implementation inside this class
| if si > 0 : | ||
| X, y = copy.deepcopy(X), copy.deepcopy(y) | ||
| y_lt1 = y[0] + si | ||
| self.y_lt1 = y_lt1 |
There was a problem hiding this comment.
good idea to add the lactate threshold as a instance based variable but should probably be defined in the base class.
There was a problem hiding this comment.
it's just a naming to keep the function easy to read, it uses the predefined working of the base class
src/lactopy/lactate_models/lt1_si.py
Outdated
| else: | ||
| raise ValueError(f"Impossible lactate change to find LT1: {si}") | ||
|
|
||
| self.X = X |
| from lactopy.plots.lt2_breakpoint_plot import LT2_breakpoint_Plot | ||
|
|
||
|
|
||
| class LT2_breakpoint(BaseModel): |
There was a problem hiding this comment.
is not needed already implemented in the LT1_LT2 breakpoint class.
There was a problem hiding this comment.
true, was just a seperate extra can be deleted if we want, might be usefull for only determining 1 of the tresholds
src/lactopy/plots/lt1_loglog_plot.py
Outdated
| Plot the lt1_loglog model fit. | ||
| """ | ||
| ax = super().plot_fit() | ||
| ax.set_title("LT1 Log-Log Model Fit") |
There was a problem hiding this comment.
I'm not sure if we need seprate titles for different plots. if so we should implement this in the base class and not in the all childeren to avoid tight coupling with maptlot lib
There was a problem hiding this comment.
^might be interesting yes
src/lactopy/plots/lt1_loglog_plot.py
Outdated
| ax.set_title("LT1 Log-Log Model Fit") | ||
| return ax | ||
|
|
||
| def plot_predictions(self): |
There was a problem hiding this comment.
this is a rather reoccuring function in differen classes. i think we should add this logic in the base class
There was a problem hiding this comment.
the quickstart notebook is for the docs only change it for docs. if you want to create some test notebooks create one in notebooks/trash/
…sses patch for base classes
…g method using the piecewise regression module
…ed determination of lt1
…curve breakpoints using piecewise regression
…2_breakpoint method but only returning and plotting LT
…the base class bot for fitting and plotting should probably be discussed together
e80a7e2 to
ac946e7
Compare
|
just some general toughts we need to fix before we can merge this update:
|