I am trying to run an algorithm for a problem with 2 modes. The code fails to run with the below error. There seems to be some issue with the Homodyne measurement. Could you tell me where the problem might stem from? Unfortunately, I am unable to track. The code used to work without any issues in the past.
/Users/anaconda3/envs/project/lib/python3.11/site-packages/strawberryfields/backends/fockbackend/circuit.py:763: RuntimeWarning: invalid value encountered in divide
Traceback (most recent call last):
result = eng.run(prog)
^^^^^^^^^^^^^
File "/Users/anaconda3/envs/project/lib/python3.11/site-packages/strawberryfields/engine.py", line 570, in run
return super()._run(
^^^^^^^^^^^^^
File "/Users/anaconda3/envs/project/lib/python3.11/site-packages/strawberryfields/engine.py", line 306, in _run
_, self.samples, self.samples_dict = self._run_program(p, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/anaconda3/envs/project/lib/python3.11/site-packages/strawberryfields/engine.py", line 430, in _run_program
val = cmd.op.apply(cmd.reg, self.backend, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/anaconda3/envs/project/lib/python3.11/site-packages/strawberryfields/ops.py", line 325, in apply
values = super().apply(reg, backend, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/anaconda3/envs/project/lib/python3.11/site-packages/strawberryfields/ops.py", line 228, in apply
return self._apply(temp, backend, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/anaconda3/envs/project/lib/python3.11/site-packages/strawberryfields/ops.py", line 1276, in _apply
return s * backend.measure_homodyne(p[0], *reg, shots=shots, select=select, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/anaconda3/envs/project/lib/python3.11/site-packages/strawberryfields/backends/fockbackend/backend.py", line 198, in measure_homodyne
return self.circuit.measure_homodyne(phi, self._remap_modes(mode), select=select, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/anaconda3/envs/project/lib/python3.11/site-packages/strawberryfields/backends/fockbackend/circuit.py", line 770, in measure_homodyne
sample_hist = np.random.multinomial(1, probs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "mtrand.pyx", line 4337, in numpy.random.mtrand.RandomState.multinomial
File "_common.pyx", line 391, in numpy.random._common.check_array_constraint
File "_common.pyx", line 377, in numpy.random._common._check_array_cons_bounded_0_1
ValueError: pvals < 0, pvals > 1 or pvals contains NaNs