Commit 8847c145 authored by Nicolas Nunez Barreto's avatar Nicolas Nunez Barreto

saque la barra superior, arregle el invert, y arregle los Nx y Ny

parent 284d7b21
Pipeline #80 canceled with stages
......@@ -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 = 600
Ny = 800
Nx = 800
Ny = 600
linewidth = 150
linewidth = 300
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}')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment