-
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
3e5f659
commit a5c5d96
Showing
27 changed files
with
382 additions
and
73 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
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
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
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 .wigner_control import WignerControl | ||
from .photon_distribution import PhotonDistribution |
61 changes: 61 additions & 0 deletions
61
quasi/devices/investigation_devices/photon_distribution.py
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,61 @@ | ||
""" | ||
Photon Distribution | ||
""" | ||
import plotly.express as px | ||
import numpy as np | ||
|
||
from quasi.devices import (GenericDevice, | ||
wait_input_compute, | ||
ensure_output_compute) | ||
from quasi.devices.port import Port | ||
from quasi.signals import (GenericSignal, | ||
GenericQuantumSignal) | ||
|
||
from quasi.gui.icons import icon_list | ||
from quasi.simulation import ModeManager | ||
|
||
|
||
class PhotonDistribution(GenericDevice): | ||
""" | ||
Implements Photon Distribution Grapphing device | ||
""" | ||
ports = { | ||
"IN": Port( | ||
label="IN", | ||
direction="input", | ||
signal=None, | ||
signal_type=GenericQuantumSignal, device=None), | ||
} | ||
|
||
# Gui Configuration | ||
gui_icon = icon_list.HISTOGRAM | ||
gui_tags = ["investigate"] | ||
gui_name = "Photon Distribution" | ||
|
||
power_average = 0 | ||
power_peak = 0 | ||
reference = 0 | ||
|
||
|
||
|
||
@wait_input_compute | ||
def compute_outputs(self, *args, **kwargs): | ||
mm = ModeManager() | ||
m_id = self.ports["IN"].signal.mode_id | ||
mode = mm.get_mode(m_id) | ||
print(mode) | ||
probabilities = np.real(np.diag(mode)) | ||
|
||
histogram_data = { | ||
'State': [str(i) for i in range(len(probabilities))], | ||
'Probability': probabilities} | ||
|
||
# Create a histogram using Plotly Express | ||
fig = px.bar(histogram_data, x='State', y='Probability', | ||
labels={'Probability': 'Probability Amplitude', 'State': 'Fock State'}, | ||
title='Fock State Density Matrix Histogram') | ||
|
||
# Show the plot | ||
fig.show() | ||
|
||
|
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,34 +1,62 @@ | ||
""" | ||
Ideal Single Photon Source implementation | ||
""" | ||
import numpy as np | ||
|
||
from quasi.devices import (GenericDevice, | ||
wait_input_compute, | ||
ensure_output_compute) | ||
from quasi.devices.port import Port | ||
from quasi.signals import (GenericSignal, | ||
QuantumContentType, | ||
GenericBoolSignal, | ||
GenericQuantumSignal) | ||
|
||
from quasi.gui.icons import icon_list | ||
from quasi.simulation import ModeManager | ||
|
||
from quasi._math.fock.ops import adagger, a | ||
|
||
class IdealSinglePhotonSource(GenericDevice): | ||
""" | ||
Implements Ideal Single Photon Source | ||
""" | ||
ports = { | ||
"control": Port(label="A", direction="input", signal=None, | ||
signal_type=GenericSignal, device=None), | ||
"output": Port(label="A", direction="output", signal=None, | ||
signal_type=GenericQuantumSignal, device=None), | ||
"control": Port( | ||
label="control", | ||
direction="input", | ||
signal=None, | ||
signal_type=GenericBoolSignal, | ||
device=None), | ||
"output": Port( | ||
label="output", | ||
direction="output", | ||
signal=None, | ||
signal_type=GenericQuantumSignal, | ||
device=None), | ||
} | ||
|
||
# Gui Configuration | ||
gui_icon = icon_list.SINGLE_PHOTON_SOURCE | ||
gui_tags = ["ideal"] | ||
gui_name = "Ideal Single Photon Source" | ||
|
||
power_peak = 0 | ||
power_average = 0 | ||
|
||
reference = None | ||
|
||
@ensure_output_compute | ||
@wait_input_compute | ||
def compute_outputs(self): | ||
pass | ||
def compute_outputs(self, *args, **kwargs): | ||
mm = ModeManager() | ||
m_id = mm.create_new_mode() | ||
AD = adagger(mm.simulation.dimensions) | ||
A = a(mm.simulation.dimensions) | ||
mode = mm.get_mode(m_id) | ||
mm.modes[m_id] = np.matmul(AD, np.matmul(mode, A)) | ||
self.ports["output"].signal.set_contents( | ||
content_type=QuantumContentType.FOCK, | ||
mode_id=m_id) | ||
self.ports["output"].signal.set_computed() | ||
|
This file was deleted.
Oops, something went wrong.
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 .experiment_manager import Experiment |
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
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.