Bell-state on sim:ascella

Can you help me with fixing this code which should construct Bell-state on sim:ascella?

I’m seeing error:

perceval.components._mode_connector.UnavailableModeException: Mode(s) 2 not available

How can I set the number of modes for the remote simulator?
I’m using: perceval-quandela 0.12.0

Below is reproducer

Thanks

Jan

import perceval as pcvl
cnot = pcvl.catalog["heralded cnot"].build_processor()
#proc = pcvl.Processor("SLOS",4)
proc = pcvl.RemoteProcessor("sim:ascella",m=4). # FIXED HERE
proc.min_detected_photons_filter(2)
proc.add(0, pcvl.BS.H())
proc.add(0, cnot)
pcvl.pdisplay(proc)

Hello,

You have three more or less identical ways to do this. You can either:

  • Give m = 4 when instanciating the RemoteProcessor then add the components as in your script.
  • Or give a circuit that has your wanted m modes as the first circuit (the circuit size is inferred from it and cannot be changed afterward). In your example, this is what you see: the first BS you add sets the number of modes to 2 so you can’t add the cnot that spans over 4 modes.
  • Or create a local processor that contains all you want then create your RemoteProcessor with RemoteProcessor.from_local_processor(processor, platform, token).

Hope this will help you,

Regards,

Thank you - I used the 1st solution and it works now. I’m good