Skip to content

Commit

Permalink
[minor] fix the direct conversion quantum tranduction protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
caitaozhan committed Dec 20, 2024
1 parent e38922a commit 0e74ef3
Show file tree
Hide file tree
Showing 6 changed files with 176 additions and 165 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
all: jupyter

setup:
pip3 install -r ./requirements.txt
pip install -r ./requirements.txt

install:
pip3 install .
pip install .

install_editable:
pip3 install --editable . --config-settings editable_mode=strict
pip install --editable . --config-settings editable_mode=strict

jupyter:
jupyter notebook ./example/two_node_eg.ipynb

test:
pip3 install .
pip install .
pytest ./tests
40 changes: 18 additions & 22 deletions example/Transducer_Examples/ConversionProtocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,17 @@ def get_conversion_matrix(efficiency: float) -> Qobj:


class EmittingProtocol(Protocol):
"""Protocol for emission of single microwave photon by transmon.
"""

"Protocol for emission of single microwave photon by transmon"

def __init__(self, own: "Node", name: str, tl: "Timeline", transmon="Transmon", transducer="Transducer"):
super().__init__(own, name)
self.owner = own
def __init__(self, owner: "Node", name: str, tl: "Timeline", transmon="Transmon", transducer="Transducer"):
super().__init__(owner, name)
self.owner = owner
self.name = name
self.tl = tl
self.transmon = transmon
self.transducer = transducer


def start(self) -> None:

self.transmon.get()
Expand All @@ -68,35 +67,32 @@ def start(self) -> None:
self.transmon.photon_counter += 1
else:
pass

else:
print("The transmon is in the state 00, or 01, it doesn't emit microwave photons")
print("The transmon is in the state 00, or 01, it doesn't emit microwave photons")

print(f"Microwave photons emitted by the Transmon at Tx: {self.transmon.photon_counter}")



def received_message(self, src: str, msg):
pass



class UpConversionProtocol(Protocol):
"""Protocol for Up-conversion of an input microwave photon into an output optical photon.
"""

"Protocol for Up-conversion of an input microwave photon into an output optical photon"

def __init__(self, own: "Node", name: str, tl: "Timeline", transducer: "Transducer", node: "Node", transmon: "Transmon"):
super().__init__(own, name)
self.owner = own
def __init__(self, owner: "Node", name: str, tl: "Timeline", transducer: "Transducer", node: "Node", transmon: "Transmon"):
super().__init__(owner, name)
self.owner = owner
self.name = name
self.tl = tl
self.transducer = transducer
self.transmon = transmon
self.node = node

def start(self, photon: "Photon") -> None:


"""start the protocol"""
if self.transducer.photon_counter > 0:
custom_gate = get_conversion_matrix(self.transducer.efficiency)

Expand Down Expand Up @@ -127,20 +123,20 @@ def received_message(self, src: str, msg):


class DownConversionProtocol(Protocol):
"""Protocol for Down-conversion of an input optical photon into an output microwave photon.
"""

"Protocol for Down-conversion of an input optical photon into an output microwave photon"

def __init__(self, own: "Node", name: str, tl: "Timeline", transducer: "Transducer", transmon: "Transmon"):
super().__init__(own, name)
self.owner = own
def __init__(self, owner: "Node", name: str, tl: "Timeline", transducer: "Transducer", transmon: "Transmon"):
super().__init__(owner, name)
self.owner = owner
self.name = name
self.tl = tl
self.transducer = transducer

def start(self, photon: "Photon") -> None:
"""start the protocol"""
if self.transducer.photon_counter > 0:


transducer_state = [0.0 + 0.0j, 0.0 + 0.0j, 1.0 + 0.0j, 0.0 + 0.0j]
custom_gate = get_conversion_matrix(self.transducer.efficiency)

Expand Down
Loading

0 comments on commit 0e74ef3

Please # to comment.