Skip to content

Instantly share code, notes, and snippets.

View daguiam's full-sized avatar

Diogo Aguiam daguiam

View GitHub Profile
import numpy as np
def blazed_profile(XX,YY, grating_pitch, wavelength, n1, n0=1, m=1, direction="right", blaze_arrow_angle=0, round_decimals=7):
"""
Returns the height profile of a blazed gratin
Args:
:XX: x array from meshgrid
:YY: y array from meshgrid
:grating_pitch: pitch of the grating, that sets the diffraction angle and blaze angle
:wavelength: wavelength of design
from PIL import Image
Image.MAX_IMAGE_PIXELS = 933120000
def join_masks_with_template(filename_mask, filename_template, filename_output, center=True):
import pya
import sys
import os
from matplotlib import pyplot as plt
import numpy as np
Software name Software Purpose Link
AutoCAD CAD According to our licenses
Ansys Lumerical CAD According to our licenses
KLayout CAD https://www.klayout.de/build.html
Altium Designer CAD \\inl-fps01\Data\Nanofab\8 - Other\1 - Software\Altium
National Instruments NI-DAQ mx Electronics Programming https://www.ni.com/en-sg/support/downloads/drivers/download.ni-daq-mx.html
Inkscape Image/video manipulation https://inkscape.org/
GIMP Image/video manipulation https://www.gimp.org/
Blender Image/video manipulation https://www.blender.org/download/
ImageJ Image/video manipulation https://imagej.nih.gov/ij/download.html
def interpolate_data(x,y,z, step_y, mincount=400):
""" Assumes the x is repeated samples and y is the non-periodic signal
"""
step = step_y
x_list = []
y_list = []
z_list = []
import numpy as np
import matplotlib.pyplot as plt
import os
from scipy import interpolate
@daguiam
daguiam / save_load_json_dict.py
Created May 3, 2023 10:04
Saves and loads python dictionaries to json
import json
import numpy as np
from json import JSONEncoder
def open_data_file(filename):
# Load data from json file
with open(filename, 'r') as fp:
json_dict = json.load(fp)
return json_dict
import sounddevice as sd
import numpy as np
import scipy.io.wavfile as wav
# print(sd.query_devices())
device_list = sd.query_devices()
# find and select index of Line (UMIK-2)
import numpy as np
import matplotlib.pyplot as plt
from scipy import constants as const
import nidaqmx
# Creating the actuation signal
max_displacement = 250*1e-9
f_displacement = 10000
plt.grid()
plt.minorticks_on()
plt.grid(True, which='minor', linestyle='-', lw=0.1)