Count scheduler timesteps below a threshold.
(pipe, threshold)
| 203 | |
| 204 | |
| 205 | def _count_steps_below(pipe, threshold): |
| 206 | """Count scheduler timesteps below a threshold.""" |
| 207 | timesteps = getattr(getattr(pipe, 'scheduler', None), 'timesteps', None) |
| 208 | if timesteps is None: |
| 209 | return 1 |
| 210 | count = sum(1 for t in timesteps.tolist() if t < threshold) |
| 211 | return max(count, 1) |
| 212 | |
| 213 | |
| 214 | def correction_callback(p, timestep, kwargs, pipe=None, initial: bool = False, step: int = 0): |
no outgoing calls
no test coverage detected