From e69dd98f9b48da81b925d02a0326edbb6d4b8647 Mon Sep 17 00:00:00 2001 From: jl33ai Date: Fri, 29 May 2026 09:27:13 -0700 Subject: [PATCH] fix algorithm tuple typo and numpy normed kwarg two correctness fixes. 1. _init_decoder's algorithm guard was `in ('clusterless_decoder, clusterless_classifier')` which is a one-element tuple containing one comma-joined string, not two strings. clusterless_classifier could never match it. 2. Encoder.get_joint_prob calls np.histogram with normed=False, which was removed in numpy 1.24+ and raises. dropped the kwarg, default behavior (raw weighted sum per bin) already matches normed=False. --- realtime_decoder/decoder_process.py | 2 +- realtime_decoder/encoder_process.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/realtime_decoder/decoder_process.py b/realtime_decoder/decoder_process.py index 2823924..7eb26de 100644 --- a/realtime_decoder/decoder_process.py +++ b/realtime_decoder/decoder_process.py @@ -518,7 +518,7 @@ def _init_decoder(self): config = self._config rank = self.rank - if config['algorithm'] in ('clusterless_decoder, clusterless_classifier'): + if config['algorithm'] in ('clusterless_decoder', 'clusterless_classifier'): self._decoder = ClusterlessDecoder( rank, config, position.PositionBinStruct( diff --git a/realtime_decoder/encoder_process.py b/realtime_decoder/encoder_process.py index d2161b6..a66fabd 100644 --- a/realtime_decoder/encoder_process.py +++ b/realtime_decoder/encoder_process.py @@ -229,10 +229,14 @@ def get_joint_prob(self, mark): # print("") # print(weights) + # `density=` (formerly `normed=`) intentionally omitted: we want the + # raw weighted sum per bin, which is the default behavior. `normed=` + # was removed in NumPy 1.24, which broke this call on any modern + # install. hist, hist_edges = np.histogram( a=positions, bins=self._pos_bin_struct.pos_bin_edges, - weights=weights, normed=False + weights=weights, ) hist += 0.0000001