# Single photon generation on hardware

**URL:** <https://discuss.pennylane.ai/t/single-photon-generation-on-hardware/1248>\
**Category:** Strawberry Fields\
**Created:** [August 3, 2021, 4:59pm UTC](https://discuss.pennylane.ai/t/single-photon-generation-on-hardware/1248 "2021-08-03T16:59:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bgard3](https://avatars.discourse-cdn.com/v4/letter/b/f07891/32.png) [@bgard3](https://discuss.pennylane.ai/u/bgard3)\
**Post date:** [August 3, 2021, 4:59pm UTC](https://discuss.pennylane.ai/t/single-photon-generation-on-hardware/1248/1 "2021-08-03T16:59:47Z")

</div>

I am attempting to run some single photon experiments on hardware but it appears as if creating a single photon state may not be supported on the `X8` device? I have a simple example below which errors with the message ` CircuitError: The operation Ket cannot be used with the compiler 'Xunitary'.` . Forcing other compilers also doesn’t seem to fix this issue. The program itself works fine in a local simulator with the `'fock'` engine. Is currently anyway to create single photon states when operating on hardware?

 ![sf_img1](https://canada1.discourse-cdn.com/flex012/uploads/pennylane/original/1X/ba842f098a74b24dc6b9f36dc6a96709bb395cd9.png)

---

<div class="post-metadata">

**Author:** ![jmarrazola](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/jmarrazola/32/255_2.png) [@jmarrazola](https://discuss.pennylane.ai/u/jmarrazola)\
**Post date:** [August 3, 2021, 7:55pm UTC](https://discuss.pennylane.ai/t/single-photon-generation-on-hardware/1248/2 "2021-08-03T19:55:23Z")

</div>

Hi @bgard3,

Welcome to the forum!

Indeed, the X8 device can only implement a specific type of circuit: two-mode squeezing gates followed by identical and fully-programmable interferometers acting on each half of the modes. More details on the types of circuits that can be run on X8 can be found in this [tutorial](https://strawberryfields.ai/photonics/demos/tutorial_X8.html).

Physically, the reason is that creating deterministic sources of single photons is extremely challenging, so instead this device focuses on deterministic sources of squeezed light.

Please let me know if you have any questions!

Best,

Juan Miguel

---

<div class="post-metadata">

**Author:** ![bgard3](https://avatars.discourse-cdn.com/v4/letter/b/f07891/32.png) [@bgard3](https://discuss.pennylane.ai/u/bgard3)\
**Post date:** [August 4, 2021, 12:20pm UTC](https://discuss.pennylane.ai/t/single-photon-generation-on-hardware/1248/3 "2021-08-04T12:20:45Z")

</div>

I see. Thanks for the explanation! Are there any plans to allow for single photon creation in terms of heralding (not on-demand)? In particular I am interested in the ability to create only a single photon in one mode and it need not be on demand.

In the mean time I will try to adjust my topic of interest to work with the current capability. Thanks!

---

<div class="post-metadata">

**Author:** ![jmarrazola](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/jmarrazola/32/255_2.png) [@jmarrazola](https://discuss.pennylane.ai/u/jmarrazola)\
**Post date:** [August 4, 2021, 8:37pm UTC](https://discuss.pennylane.ai/t/single-photon-generation-on-hardware/1248/4 "2021-08-04T20:37:19Z")

</div>

I believe that you should be able to implement a heralded single-photon source using X8.

The way I would approach it would be to squeeze only the first pair of modes and set the interferometer to the identity. Loss will affect the results, but you should be able to see that conditional on detecting 1 photon in one of the modes, there will also be a heralded photon on the other mode.

What may be more challenging is to then perform transformations on that single photon, since the interferometers are applied equally to both signal and idler modes.

---

<div class="post-metadata">

**Author:** ![bgard3](https://avatars.discourse-cdn.com/v4/letter/b/f07891/32.png) [@bgard3](https://discuss.pennylane.ai/u/bgard3)\
**Post date:** [August 5, 2021, 11:40am UTC](https://discuss.pennylane.ai/t/single-photon-generation-on-hardware/1248/5 "2021-08-05T11:40:36Z")

</div>

Thanks Juan. I ended up doing exactly this yesterday.

In effect, due to the required copy of the interferometer portion of the circuit, I can generate the single photon state I want, on both copies of the upper and lower portion of the device (up to losses). Additionally, the actual process I want to run is also copied in the interferometer stage, so in a sense, I run the task twice per circuit execution (once on the upper half and once on the lower half).

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![jmarrazola](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/jmarrazola/32/255_2.png) [@jmarrazola](https://discuss.pennylane.ai/u/jmarrazola)\
**Post date:** [August 5, 2021, 2:37pm UTC](https://discuss.pennylane.ai/t/single-photon-generation-on-hardware/1248/6 "2021-08-05T14:37:41Z")

</div>

Any time! If you have any further questions, let us know! 🚀
