@@ -321,31 +321,31 @@ def _get_od_blank_from_cache(self) -> dict[pt.PdChannel, float]:
321321 result = cache .get (self .experiment )
322322
323323 if result is not None :
324- od_blanks = result
324+ od_blanks = cast ( bytes | str , result )
325325 return loads (od_blanks )
326326 else :
327327 return defaultdict (lambda : 0.0 )
328328
329329 def _get_growth_rate_from_cache (self ) -> float :
330330 with local_persistent_storage ("growth_rate" ) as cache :
331- return cache .get (self .experiment , 0.0 )
331+ return float ( cast ( float | int , cache .get (self .experiment , 0.0 )) )
332332
333333 def _get_filtered_od_from_cache (self ) -> float :
334334 with local_persistent_storage ("od_filtered" ) as cache :
335- return cache .get (self .experiment , 1.0 )
335+ return float ( cast ( float | int , cache .get (self .experiment , 1.0 )) )
336336
337337 def _get_filtered_od_from_iterator (self , od_iter : Iterator [structs .ODReadings ]) -> float :
338338 scaled_od_readings = self .scale_raw_observations (next (od_iter ))
339339 return mean (scaled_od_readings [channel ] for channel in scaled_od_readings .keys ())
340340
341341 def _get_od_normalization_from_cache (self ) -> dict [pt .PdChannel , float ]:
342342 with local_persistent_storage ("od_normalization_mean" ) as cache :
343- result = cache [self .experiment ]
343+ result = cast ( bytes | str , cache [self .experiment ])
344344 return loads (result )
345345
346346 def _get_od_variances_from_cache (self ) -> dict [pt .PdChannel , float ]:
347347 with local_persistent_storage ("od_normalization_variance" ) as cache :
348- result = cache [self .experiment ]
348+ result = cast ( bytes | str , cache [self .experiment ])
349349 return loads (result )
350350
351351 @staticmethod
@@ -402,7 +402,9 @@ def _update_state_from_observation(
402402 updated_state_ , covariance_ = self .ekf .update (
403403 list (scaled_observations .values ()), dt , self ._recent_dilution
404404 )
405- latest_od_filtered , latest_growth_rate = float (updated_state_ [0 ]), float (updated_state_ [1 ])
405+ updated_state = cast (Any , updated_state_ )
406+ covariance = cast (Any , covariance_ )
407+ latest_od_filtered , latest_growth_rate = float (updated_state [0 ]), float (updated_state [1 ])
406408
407409 if self ._obs_since_last_dose is not None and self ._obs_required_to_reset is not None :
408410 self ._obs_since_last_dose += 1
@@ -422,8 +424,8 @@ def _update_state_from_observation(
422424 )
423425
424426 kf_outputs = structs .KalmanFilterOutput (
425- state = self .ekf .state_ .tolist (),
426- covariance_matrix = covariance_ .tolist (),
427+ state = cast ( Any , self .ekf .state_ ) .tolist (),
428+ covariance_matrix = covariance .tolist (),
427429 timestamp = timestamp ,
428430 )
429431
@@ -539,6 +541,7 @@ def click_growth_rate_calculating(ctx: click.Context, ignore_cache: bool) -> Non
539541 experiment = whoami .get_assigned_experiment_name (unit )
540542
541543 use_fused_od = _should_use_fused_od (unit )
544+ od_stream : MqttODSource | MqttODFusedSource
542545 if use_fused_od :
543546 od_stream = MqttODFusedSource (unit = unit , experiment = experiment , skip_first = 5 )
544547 else :
0 commit comments