Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Photonics tool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bernabeu Lou
Photonics tool
Commits
a1f803a1
Commit
a1f803a1
authored
4 years ago
by
Bernabeu Lou
Browse files
Options
Downloads
Patches
Plain Diff
Trailing spaces
parent
1136ed51
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
definition.py
+6
-14
6 additions, 14 deletions
definition.py
interface.py
+2
-2
2 additions, 2 deletions
interface.py
with
8 additions
and
16 deletions
definition.py
+
6
−
14
View file @
a1f803a1
...
...
@@ -19,14 +19,6 @@ class Plate:
self
.
theta
=
theta
self
.
orientation
=
orientation
def
coef
(
real
,
imag
):
a
=
0
if
real
!=
0
:
a
=
real
if
imag
!=
0
:
a
+=
imag
*
1j
return
(
a
)
class
Photon
:
def
__init__
(
self
,
state0
,
state1
):
self
.
state0
=
[
state0
]
...
...
@@ -36,24 +28,24 @@ class Photon:
print
(
self
.
state0
[
-
1
],
"
|0> +
"
,
self
.
state1
[
-
1
],
"
|1>
"
)
def
round_state
(
self
,
decimal
,
i
):
s_0r
=
round
((
self
.
state0
[
i
]).
real
,
decimal
)
s_0r
=
round
((
self
.
state0
[
i
]).
real
,
decimal
)
s_0i
=
round
((
self
.
state0
[
i
]).
imag
,
decimal
)
s_1r
=
round
((
self
.
state1
[
i
]).
real
,
decimal
)
s_1i
=
round
((
self
.
state1
[
i
]).
imag
,
decimal
)
s_1i
=
round
((
self
.
state1
[
i
]).
imag
,
decimal
)
return
(
s_0r
,
s_0i
,
s_1r
,
s_1i
)
def
is_2D
(
self
,
i
):
s_0r
=
round
((
self
.
state0
[
i
]).
real
,
3
)
s_0r
=
round
((
self
.
state0
[
i
]).
real
,
3
)
s_0i
=
round
((
self
.
state0
[
i
]).
imag
,
3
)
s_1r
=
round
((
self
.
state1
[
i
]).
real
,
3
)
s_1i
=
round
((
self
.
state1
[
i
]).
imag
,
3
)
s_1i
=
round
((
self
.
state1
[
i
]).
imag
,
3
)
return
(
s_0r
*
s_0i
==
0
and
s_1r
*
s_1i
==
0
and
s_0r
*
s_1i
==
0
and
s_1r
*
s_0i
==
0
)
def
pur
(
self
,
i
):
rho0
,
phi0
=
polar
(
self
.
state0
[
i
])
rho1
,
phi1
=
polar
(
self
.
state1
[
i
])
return
(
2
*
acos
(
rho0
),
phi1
-
phi0
)
def
gate
(
self
,
plate
):
alpha
=
self
.
state0
[
-
1
]
beta
=
self
.
state1
[
-
1
]
...
...
@@ -72,7 +64,7 @@ class Photon:
self
.
state1
.
append
(
1
/
2
*
(
beta
+
1j
*
alpha
))
def
representation
(
self
,
i
):
#Bloch Sphere
fig
=
plt
.
figure
()
...
...
This diff is collapsed.
Click to expand it.
interface.py
+
2
−
2
View file @
a1f803a1
...
...
@@ -155,7 +155,7 @@ def optical_path(window, photon):
length
=
len
(
photon
.
state0
)
for
i
in
range
(
length
):
time
=
Time
(
i
,
photon
,
window
)
time
.
do
()
time
.
do
()
if
i
!=
length
-
1
:
plate_number
=
Label
(
window
,
text
=
'
Plate
'
+
str
(
i
+
1
),
font
=
(
'
Bahnschrift Semibold
'
,
'
15
'
),
fg
=
'
#000000
'
,
bg
=
'
#ffffff
'
,
relief
=
'
raised
'
)
plate_number
.
grid
(
column
=
2
*
i
+
1
,
row
=
0
)
...
...
@@ -206,4 +206,4 @@ def graphical_grid_init():
button_simulate
.
grid
(
column
=
7
,
row
=
6
)
root
.
mainloop
()
graphical_grid_init
()
\ No newline at end of file
graphical_grid_init
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment