Error message:
/home/pi/.local/lib/python3.7/site-packages/optical_gating_alignment/multipass_regression.py:27: RuntimeWarning: divide by zero encountered in double_scalars w[n] = 1.0 / score /home/pi/.local/lib/python3.7/site-packages/optical_gating_alignment/multipass_regression.py:36: RuntimeWarning: invalid value encountered in multiply aw = a * np.sqrt(w) Traceback (most recent call last): File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/pi/open-optical-gating/open_optical_gating/cli/pi_optical_gater.py", line 197, in <module> run(sys.argv[1:], "Run optical gater on image data contained in tiff file") File "/home/pi/open-optical-gating/open_optical_gating/cli/pi_optical_gater.py", line 187, in run analyser.run_server() File "/home/pi/open-optical-gating/open_optical_gating/cli/optical_gater_server.py", line 129, in run_server self.run_and_analyze_until_stopped() File "/home/pi/open-optical-gating/open_optical_gating/cli/pi_optical_gater.py", line 134, in run_and_analyze_until_stopped self.camera.wait_recording(0.001) # s File "/usr/lib/python3/dist-packages/picamera/camera.py", line 1167, in wait_recording encoder.wait(timeout) File "/usr/lib/python3/dist-packages/picamera/encoders.py", line 398, in wait raise self.exception File "/usr/lib/python3/dist-packages/picamera/encoders.py", line 267, in _callback stop = self._callback_write(buf) File "/usr/lib/python3/dist-packages/picamera/encoders.py", line 580, in _callback_write return super(PiRawMixin, self)._callback_write(buf, key) File "/usr/lib/python3/dist-packages/picamera/encoders.py", line 921, in _callback_write return super(PiVideoEncoder, self)._callback_write(buf, key) File "/usr/lib/python3/dist-packages/picamera/encoders.py", line 298, in _callback_write written = output.write(buf.data) File "/usr/lib/python3/dist-packages/picamera/array.py", line 726, in write self.analyze(bytes_to_yuv(b, self.size or self.camera.resolution)) File "/home/pi/open-optical-gating/open_optical_gating/cli/pi_optical_gater.py", line 45, in analyze self.gater.analyze_pixelarray(pixelarray) File "/home/pi/open-optical-gating/open_optical_gating/cli/optical_gater_server.py", line 179, in analyze_pixelarray self.adapt_state(pixelArray) File "/home/pi/open-optical-gating/open_optical_gating/cli/optical_gater_server.py", line 434, in adapt_state resampled_period=self.pog_settings["oga_resampled_period"] File "/home/pi/.local/lib/python3.7/site-packages/optical_gating_alignment/optical_gating_alignment.py", line 358, in process_sequence shift_history, len(sequence_history), resampled_period File "/home/pi/.local/lib/python3.7/site-packages/optical_gating_alignment/multipass_regression.py", line 124, in make_shifts_self_consistent shifts, number_of_sequences, 1, ref_seq_id, ref_seq_phase File "/home/pi/.local/lib/python3.7/site-packages/optical_gating_alignment/multipass_regression.py", line 60, in solve_with_maximum_range shifts_to_use, number_of_sequences, ref_seq_id, ref_seq_phase File "/home/pi/.local/lib/python3.7/site-packages/optical_gating_alignment/multipass_regression.py", line 38, in solve_for_shifts (self_consistent_shifts, _, _, _) = np.linalg.lstsq(Mw, aw, rcond=None) File "<__array_function__ internals>", line 6, in lstsq File "/home/pi/.local/lib/python3.7/site-packages/numpy/linalg/linalg.py", line 2306, in lstsq x, resids, rank, s = gufunc(a, b, rcond, signature=signature, extobj=extobj) ValueError: On entry to DLASCL parameter number 4 had an illegal value
It looks like at least one of the score entries passed to solve_for_shifts is zero. This then leads to divide-by-zero.
I've added more debug output to help understand what's going on (log the matrix and vector values with high priority, if an exception occurs), but the solution may well be for the caller (or this module) to impose some sort of a threshold for what values of score are acceptable
Error message:
/home/pi/.local/lib/python3.7/site-packages/optical_gating_alignment/multipass_regression.py:27: RuntimeWarning: divide by zero encountered in double_scalars w[n] = 1.0 / score /home/pi/.local/lib/python3.7/site-packages/optical_gating_alignment/multipass_regression.py:36: RuntimeWarning: invalid value encountered in multiply aw = a * np.sqrt(w) Traceback (most recent call last): File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/pi/open-optical-gating/open_optical_gating/cli/pi_optical_gater.py", line 197, in <module> run(sys.argv[1:], "Run optical gater on image data contained in tiff file") File "/home/pi/open-optical-gating/open_optical_gating/cli/pi_optical_gater.py", line 187, in run analyser.run_server() File "/home/pi/open-optical-gating/open_optical_gating/cli/optical_gater_server.py", line 129, in run_server self.run_and_analyze_until_stopped() File "/home/pi/open-optical-gating/open_optical_gating/cli/pi_optical_gater.py", line 134, in run_and_analyze_until_stopped self.camera.wait_recording(0.001) # s File "/usr/lib/python3/dist-packages/picamera/camera.py", line 1167, in wait_recording encoder.wait(timeout) File "/usr/lib/python3/dist-packages/picamera/encoders.py", line 398, in wait raise self.exception File "/usr/lib/python3/dist-packages/picamera/encoders.py", line 267, in _callback stop = self._callback_write(buf) File "/usr/lib/python3/dist-packages/picamera/encoders.py", line 580, in _callback_write return super(PiRawMixin, self)._callback_write(buf, key) File "/usr/lib/python3/dist-packages/picamera/encoders.py", line 921, in _callback_write return super(PiVideoEncoder, self)._callback_write(buf, key) File "/usr/lib/python3/dist-packages/picamera/encoders.py", line 298, in _callback_write written = output.write(buf.data) File "/usr/lib/python3/dist-packages/picamera/array.py", line 726, in write self.analyze(bytes_to_yuv(b, self.size or self.camera.resolution)) File "/home/pi/open-optical-gating/open_optical_gating/cli/pi_optical_gater.py", line 45, in analyze self.gater.analyze_pixelarray(pixelarray) File "/home/pi/open-optical-gating/open_optical_gating/cli/optical_gater_server.py", line 179, in analyze_pixelarray self.adapt_state(pixelArray) File "/home/pi/open-optical-gating/open_optical_gating/cli/optical_gater_server.py", line 434, in adapt_state resampled_period=self.pog_settings["oga_resampled_period"] File "/home/pi/.local/lib/python3.7/site-packages/optical_gating_alignment/optical_gating_alignment.py", line 358, in process_sequence shift_history, len(sequence_history), resampled_period File "/home/pi/.local/lib/python3.7/site-packages/optical_gating_alignment/multipass_regression.py", line 124, in make_shifts_self_consistent shifts, number_of_sequences, 1, ref_seq_id, ref_seq_phase File "/home/pi/.local/lib/python3.7/site-packages/optical_gating_alignment/multipass_regression.py", line 60, in solve_with_maximum_range shifts_to_use, number_of_sequences, ref_seq_id, ref_seq_phase File "/home/pi/.local/lib/python3.7/site-packages/optical_gating_alignment/multipass_regression.py", line 38, in solve_for_shifts (self_consistent_shifts, _, _, _) = np.linalg.lstsq(Mw, aw, rcond=None) File "<__array_function__ internals>", line 6, in lstsq File "/home/pi/.local/lib/python3.7/site-packages/numpy/linalg/linalg.py", line 2306, in lstsq x, resids, rank, s = gufunc(a, b, rcond, signature=signature, extobj=extobj) ValueError: On entry to DLASCL parameter number 4 had an illegal valueIt looks like at least one of the
scoreentries passed tosolve_for_shiftsis zero. This then leads to divide-by-zero.I've added more debug output to help understand what's going on (log the matrix and vector values with high priority, if an exception occurs), but the solution may well be for the caller (or this module) to impose some sort of a threshold for what values of
scoreare acceptable