-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
01a84d3
commit 29dda77
Showing
39 changed files
with
1,392 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from .simple_trigger import SimpleTrigger | ||
from .clock_trigger import ClockTrigger |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
""" | ||
Clock Trigger | ||
""" | ||
from quasi.devices import (GenericDevice, | ||
wait_input_compute, | ||
coordinate_gui, | ||
ensure_output_compute) | ||
from quasi.devices.port import Port | ||
from quasi.signals import (GenericSignal, | ||
GenericFloatSignal, | ||
GenericBoolSignal, | ||
GenericQuantumSignal) | ||
|
||
from quasi.gui.icons import icon_list | ||
|
||
|
||
class ClockTrigger(GenericDevice): | ||
""" | ||
Implements Simple Trigger, | ||
Trigger turns on at the start of simulation. | ||
""" | ||
ports = { | ||
"T": Port(label="T", | ||
direction="output", | ||
signal=None, | ||
signal_type=GenericBoolSignal, | ||
device=None), | ||
"frequency": Port( | ||
label="frequency", | ||
direction="input", | ||
signal=None, | ||
signal_type=GenericFloatSignal, | ||
device=None), | ||
|
||
} | ||
|
||
# Gui Configuration | ||
gui_icon = icon_list.CLOCK_TRIGGER | ||
gui_tags = ["control"] | ||
gui_name = "Clock Trigger" | ||
power = 0 | ||
power_average = 0 | ||
power_peak = 0 | ||
reference = None | ||
|
||
@ensure_output_compute | ||
@coordinate_gui | ||
@wait_input_compute | ||
def compute_outputs(self, *args, **kwargs): | ||
""" | ||
Reimplement this, | ||
This component is a currently implemented as a visual | ||
demo only. | ||
""" | ||
self.ports["T"].signal.set_bool(True) | ||
self.ports["T"].signal.set_computed() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .excitation_device import Excitation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
""" | ||
Excaitation | ||
QDCamNetz | ||
""" | ||
from quasi.devices import (GenericDevice, | ||
wait_input_compute, | ||
coordinate_gui, | ||
ensure_output_compute) | ||
from quasi.devices.port import Port | ||
from quasi.signals import (GenericSignal, | ||
GenericFloatSignal, | ||
GenericBoolSignal, | ||
GenericQuantumSignal) | ||
|
||
from quasi.gui.icons import icon_list | ||
|
||
|
||
class Excitation(GenericDevice): | ||
""" | ||
Implements Simple Trigger, | ||
Trigger turns on at the start of simulation. | ||
""" | ||
ports = { | ||
"in": Port(label="in", | ||
direction="input", | ||
signal=None, | ||
signal_type=GenericQuantumSignal, | ||
device=None), | ||
"out1": Port(label="out1", | ||
direction="output", | ||
signal=None, | ||
signal_type=GenericQuantumSignal, | ||
device=None), | ||
"out2": Port(label="out2", | ||
direction="output", | ||
signal=None, | ||
signal_type=GenericQuantumSignal, | ||
device=None), | ||
} | ||
|
||
# Gui Configuration | ||
gui_icon = icon_list.EXCITATION | ||
gui_tags = ["extra"] | ||
gui_name = "Excitation" | ||
power = 0 | ||
power_average = 0 | ||
power_peak = 0 | ||
reference = None | ||
|
||
@ensure_output_compute | ||
@coordinate_gui | ||
@wait_input_compute | ||
def compute_outputs(self, *args, **kwargs): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from .ideal_single_photon_source import IdealSinglePhotonSource | ||
from .ideal_coherent_source import IdealCoherentSource | ||
from .ideal_n_photon_source import IdealNPhotonSource | ||
from .ideal_squeezed_photon_source import IdealSqueezedPhotonSource |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
|
||
""" | ||
Ideal Coherent Source Implementation | ||
""" | ||
import numpy as np | ||
from math import factorial | ||
|
||
from quasi.devices import (GenericDevice, | ||
wait_input_compute, | ||
coordinate_gui, | ||
ensure_output_compute) | ||
from quasi.devices.port import Port | ||
from quasi.signals import (GenericSignal, | ||
GenericFloatSignal, | ||
QuantumContentType, | ||
GenericBoolSignal, | ||
GenericQuantumSignal) | ||
|
||
from quasi.gui.icons import icon_list | ||
from quasi.simulation import ModeManager, Simulation | ||
|
||
from quasi._math.fock.ops import adagger, a, coherent_state | ||
|
||
|
||
|
||
class IdealSqueezedPhotonSource(GenericDevice): | ||
""" | ||
COHERENT | ||
""" | ||
ports = { | ||
"control": Port( | ||
label="control", | ||
direction="input", | ||
signal=None, | ||
signal_type=GenericBoolSignal, | ||
device=None), | ||
"squeezing": Port( | ||
label="squeezing", | ||
direction="input", | ||
signal=None, | ||
signal_type=GenericFloatSignal, | ||
device=None), | ||
"offset": Port( | ||
label="offset", | ||
direction="input", | ||
signal=None, | ||
signal_type=GenericFloatSignal, | ||
device=None), | ||
"output": Port( | ||
label="output", | ||
direction="output", | ||
signal=None, | ||
signal_type=GenericQuantumSignal, | ||
device=None), | ||
} | ||
|
||
# Gui Configuration | ||
gui_icon = icon_list.SQUEEZED_PHOTON_SOURCE | ||
gui_tags = ["ideal"] | ||
gui_name = "Ideal Squeezed Photon Source" | ||
gui_documentation = "ideal_coherent_photon_source.md" | ||
|
||
power_peak = 0 | ||
power_average = 0 | ||
|
||
reference = None | ||
|
||
@ensure_output_compute | ||
@coordinate_gui | ||
@wait_input_compute | ||
def compute_outputs(self, *args, **kwargs): | ||
mm = ModeManager() | ||
m_id = mm.create_new_mode() | ||
AD = adagger(mm.simulation.dimensions) | ||
A = a(mm.simulation.dimensions) | ||
density_matrix = np.zeros(( | ||
mm.simulation.dimensions, | ||
mm.simulation.dimensions), dtype=np.complex128) | ||
alpha = 10 | ||
|
||
for m in range(mm.simulation.dimensions): | ||
for n in range(mm.simulation.dimensions): | ||
density_matrix[m, n] = ((alpha**m * np.conj(alpha)**n) / | ||
np.sqrt(factorial(m) * factorial(n))) | ||
|
||
density_matrix /= np.pi | ||
|
||
mm.modes[m_id] = density_matrix | ||
print(mm.modes[m_id]) | ||
|
||
self.ports["output"].signal.set_contents( | ||
content_type=QuantumContentType.FOCK, | ||
mode_id=m_id) | ||
self.ports["output"].signal.set_computed() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.