This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
#-*- coding: utf-8 -*- | |
""" | |
Batch fitting of multiple spectra - evaluation of spectroscopic response of InGaN/GaN quantum-well sensors to the | |
presence of surface charges induced by gases or liquids. | |
Invocation: | |
./multifit.py <filename>.dat | |
where |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
#-*- coding: utf-8 -*- | |
""" | |
Parses one or more XLS files, each containing arbitrary number of sheets, and filters all rows for a | |
pattern as determined by filter_lines=... below. Prints matching names. | |
Typical invocation | |
python3 ./xlsfilter.py *201{6,7,8}.{1,2}.xlsx | vi - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
#-*- coding: utf-8 -*- | |
import re, sys | |
with open(sys.argv[1]) as inputf: | |
c = 1 | |
ls = inputf.readlines() | |
fromline = 1 | |
for splitter in sys.argv[2:]: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
#-*- coding: utf-8 -*- | |
import numpy as np | |
import scipy.constants as sc | |
import matplotlib.pyplot as plt | |
import matplotlib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
#-*- coding: utf-8 -*- | |
## Import common moduli | |
import matplotlib, sys, os, time | |
import matplotlib.pyplot as plt | |
import numpy as np | |
from scipy.constants import c, hbar, pi | |
from scipy.misc import imread |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fw=int(len(xs[0])/30) # filter width | |
fl=int(len(xs[0])/20) # filter limit: minimum position of the Fabry-Pérot peak in correlation function | |
skippoints = 0 # sometimes the first point is some header | |
def nGaN(energies): | |
## returns index of refraction in GaN according to [Tisch et al., JAP 89 (2001)] | |
eV = [1.503, 1.655, 1.918, 2.300, 2.668, 2.757, 2.872, 3.006, 3.136, 3.229, 3.315, 3.395, 3.422] | |
n = [2.359+0.08, 2.366+0.04, 2.383+0.02, 2.419, 2.470, 2.486, 2.511, 2.549, 2.596, 2.643, 2.711-.01, 2.818-.045, 2.893-.100] | |
return np.interp(energies, eV, n) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3.003903829999999857e+02 1.640232643851876337e-01 | |
3.006813710000000128e+02 1.663268589412743859e-01 | |
3.009723399999999742e+02 1.676764695268916916e-01 | |
3.012632909999999811e+02 1.669212216194967402e-01 | |
3.015542229999999790e+02 1.670782231063905887e-01 | |
3.018451360000000250e+02 1.743939035195906928e-01 | |
3.021360310000000027e+02 1.665717034735433866e-01 | |
3.024269070000000283e+02 1.757442043184819225e-01 | |
3.027177649999999858e+02 1.777328050331506148e-01 | |
3.030086029999999937e+02 1.730466534811957724e-01 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
matplotlib.rc('font', size=12) | |
ys = np.array(ys)[:, :1024] | |
ys /= 5782000/.1517*0.02301 # np.max(ys) # fixed normalization for all samples | |
x = np.poly1d([4.64708212e-15, -1.65806129e-05, 5.20397778e-01, 3.53568373e+02])(range(1024)) | |
for yy in ys: | |
yy[:] = np.convolve(yy, 2**(-np.linspace(-2,2,15)**2),mode='same') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
#-*- coding: utf-8 -*- | |
import liborigin | |
opj = liborigin.parseOriginFile('../test.opj') | |
coloured = True | |
if coloured: | |
normal = "\033[1;0m" | |
bold = "\033[1;1m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
#-*- coding: utf-8 -*- | |
""" | |
Do you have some "outlier" noise in your experimental data, e.g. due to "hot pixels" in spectrometer? | |
Run | |
python3 rm_outliers.py my_file.dat | |
and the new "my_file.dat_corrected.dat" will be free of these errors. |