Skip to content

Instantly share code, notes, and snippets.

View daguiam's full-sized avatar

Diogo Aguiam daguiam

View GitHub Profile
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)
import os
import re
def read_optical_profilometer_data(filename):
with open(filename, "r") as f:
line = f.readline()
# reading the resolutuon line
line = f.readline()
! ZPL macro for Zemax to initialize multiconfiguration setup for arrangements of angles x and y
! with the help from https://osphotonics.wordpress.com/2015/05/21/zemax-programming-language-3-11-multi-configuration/
FOR i, 1, 4, 1
DELETEMCO 1
NEXT
! delete all existing configurations
FOR i, 1, NCON(), 1
DELETECONFIG 1
import os
def walk_levels(inputpath, outputpath, levels=1):
if levels==0:
return
else:
if not os.path.isdir(outputpath):
os.mkdir(outputpath)
for dirpath in os.listdir(inputpath):