Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
structured_beams
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nicolas Nunez Barreto
structured_beams
Commits
8847c145
Commit
8847c145
authored
Nov 06, 2024
by
Nicolas Nunez Barreto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
saque la barra superior, arregle el invert, y arregle los Nx y Ny
parent
284d7b21
Pipeline
#80
canceled with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
23 deletions
+25
-23
fullcode_patterns.py
fullcode_patterns.py
+25
-23
No files found.
fullcode_patterns.py
View file @
8847c145
...
...
@@ -11,13 +11,16 @@ import matplotlib.pyplot as plt
from
scipy
import
signal
def
Grating
(
k
,
l
,
size
,
Binary
=
True
,
Blaze
=
False
,
powerblaze
=
1
,
BinaryFactor
=
0.25
,
Nx
=
10000
,
Ny
=
5000
,
phase1storder
=
0
,
mini
=
0
,
maxi
=
255
,
x0
=
0
,
y0
=
0
):
def
Grating
(
k
,
l
,
size
,
Binary
=
True
,
Blaze
=
False
,
Inverted
=
False
,
powerblaze
=
1
,
BinaryFactor
=
0.25
,
Nx
=
10000
,
Ny
=
5000
,
phase1storder
=
0
,
mini
=
0
,
maxi
=
255
,
x0
=
0
,
y0
=
0
):
x
=
np
.
linspace
(
-
size
,
size
,
Nx
)
y
=
np
.
linspace
(
-
size
,
size
,
Ny
)
if
Binary
:
Pattern
=
[[
maxi
if
0.5
*
(
1
-
np
.
cos
(
k
*
xi
-
l
*
np
.
arctan2
(
xi
,
yj
)
-
phase1storder
))
>
BinaryFactor
else
mini
for
xi
in
x
]
for
yj
in
y
]
if
not
Inverted
:
Pattern
=
[[
maxi
if
0.5
*
(
1
-
np
.
cos
(
k
*
xi
-
l
*
np
.
arctan2
(
xi
,
yj
)
-
phase1storder
))
>
BinaryFactor
else
mini
for
xi
in
x
]
for
yj
in
y
]
else
:
Pattern
=
[[
maxi
if
0.5
*
(
1
-
np
.
cos
(
k
*
xi
-
l
*
np
.
arctan2
(
xi
,
yj
)
-
phase1storder
))
>
BinaryFactor
else
mini
for
yj
in
y
]
for
xi
in
x
]
else
:
if
Blaze
:
...
...
@@ -67,13 +70,13 @@ def on_key(event):
step_sizey
=
(
max
(
ylim
)
-
min
(
ylim
))
/
len
(
y
)
if
event
.
key
==
"right"
:
ax
.
set_xlim
(
xlim
[
0
]
+
step_sizex
,
xlim
[
1
]
+
step_sizex
)
# Mover derecha
ax
.
set_xlim
(
xlim
[
0
]
-
step_sizex
,
xlim
[
1
]
-
step_sizex
)
# Mover derecha
elif
event
.
key
==
"left"
:
ax
.
set_xlim
(
xlim
[
0
]
-
step_sizex
,
xlim
[
1
]
-
step_sizex
)
# Mover izquierda
ax
.
set_xlim
(
xlim
[
0
]
+
step_sizex
,
xlim
[
1
]
+
step_sizex
)
# Mover izquierda
elif
event
.
key
==
"up"
:
ax
.
set_ylim
(
ylim
[
0
]
+
step_sizey
,
ylim
[
1
]
+
step_sizey
)
# Mover arriba
ax
.
set_ylim
(
ylim
[
0
]
-
step_sizey
,
ylim
[
1
]
-
step_sizey
)
# Mover arriba
elif
event
.
key
==
"down"
:
ax
.
set_ylim
(
ylim
[
0
]
-
step_sizey
,
ylim
[
1
]
-
step_sizey
)
# Mover abajo
ax
.
set_ylim
(
ylim
[
0
]
+
step_sizey
,
ylim
[
1
]
+
step_sizey
)
# Mover abajo
fig
.
canvas
.
draw_idle
()
# Redibujar la imagen sin regenerarla
...
...
@@ -82,10 +85,10 @@ def on_key(event):
#%%
size
=
1
#esto en realidad no cambia absolutamente nada
Nx
=
6
00
Ny
=
8
00
Nx
=
8
00
Ny
=
6
00
linewidth
=
15
0
linewidth
=
30
0
k
=
1
*
np
.
pi
/
((
linewidth
/
10000
)
*
size
)
...
...
@@ -94,13 +97,12 @@ l = 1 #para usar redes comunes pone l=0
mini
,
maxi
=
0
,
255
#numeros de 0 a 255 que definen los tonos de gris de las franjas
binary
=
'binary'
#posibles: binary o notbinary. para usar blaze usa notbinary
'''
si pones inverted cambiá Nx y Ny también!! Ny 800, Nx 600
'''
orientation
=
'inverted'
#posibles: inverted o notinverted si se quiere poner a 90° el patron
Inverted
=
True
Blaze
=
False
bfactor
=
2
print
(
"aguante boca"
)
# Phase = [0,45,90,135,180]
...
...
@@ -111,17 +113,12 @@ for p in Phase:
binaryfactor
=
0.5
if
binary
==
'binary'
:
Pattern
,
x
,
y
=
Grating
(
np
.
pi
/
((
linewidth
/
10000
)
*
size
),
l
,
size
,
Binary
=
True
,
Blaze
=
Blaze
,
powerblaze
=
bfactor
,
BinaryFactor
=
binaryfactor
,
Nx
=
Nx
,
Ny
=
Ny
,
phase1storder
=
phase
,
mini
=
mini
,
maxi
=
maxi
)
Pattern
,
x
,
y
=
Grating
(
np
.
pi
/
((
linewidth
/
10000
)
*
size
),
l
,
size
,
Binary
=
True
,
Blaze
=
Blaze
,
Inverted
=
Inverted
,
powerblaze
=
bfactor
,
BinaryFactor
=
binaryfactor
,
Nx
=
Nx
,
Ny
=
Ny
,
phase1storder
=
phase
,
mini
=
mini
,
maxi
=
maxi
)
else
:
Pattern
,
x
,
y
=
Grating
(
np
.
pi
/
((
linewidth
/
10000
)
*
size
),
l
,
size
,
Binary
=
False
,
Blaze
=
Blaze
,
powerblaze
=
bfactor
,
BinaryFactor
=
binaryfactor
,
Nx
=
Nx
,
Ny
=
Ny
,
phase1storder
=
phase
,
mini
=
mini
,
maxi
=
maxi
)
Pattern
,
x
,
y
=
Grating
(
np
.
pi
/
((
linewidth
/
10000
)
*
size
),
l
,
size
,
Binary
=
False
,
Blaze
=
Blaze
,
Inverted
=
Inverted
,
powerblaze
=
bfactor
,
BinaryFactor
=
binaryfactor
,
Nx
=
Nx
,
Ny
=
Ny
,
phase1storder
=
phase
,
mini
=
mini
,
maxi
=
maxi
)
if
orientation
==
'inverted'
:
fig
,
ax
=
plt
.
subplots
(
figsize
=
(
6
,
8
),
dpi
=
100
)
c
=
plt
.
pcolor
(
np
.
transpose
(
Pattern
),
cmap
=
'gray'
,
vmin
=
0
,
vmax
=
255
)
else
:
fig
,
ax
=
plt
.
subplots
(
figsize
=
(
8
,
6
),
dpi
=
100
)
c
=
plt
.
pcolor
(
Pattern
,
cmap
=
'gray'
,
vmin
=
0
,
vmax
=
255
)
fig
,
ax
=
plt
.
subplots
(
figsize
=
(
8
,
6
),
dpi
=
100
)
c
=
plt
.
pcolor
(
Pattern
,
cmap
=
'gray'
,
vmin
=
0
,
vmax
=
255
)
plt
.
xticks
([])
plt
.
yticks
([])
...
...
@@ -130,7 +127,12 @@ plt.gca().set_position([0,0,1,1])
#plt.subplots_adjust(left=0, right=1, top=1. bottom=0)
#plt.rcParams["figure.autolayout"] = False
manager
=
plt
.
get_current_fig_manager
()
manager
.
full_screen_toggle
()
manager
.
full_screen_toggle
()
#con f o ctrl+f se sale del full screen
fig
.
canvas
.
window
()
.
statusBar
()
.
setVisible
(
False
)
manager
.
toolbar
.
hide
()
print
(
f
'done {p}'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment