Skip to content

Instantly share code, notes, and snippets.

View FilipDominec's full-sized avatar
🙂
Happy. Basically whenever I code, I am working on something I love

Filip Dominec FilipDominec

🙂
Happy. Basically whenever I code, I am working on something I love
View GitHub Profile
@FilipDominec
FilipDominec / SVD_for_plotcommander.py
Created June 21, 2017 16:22
Example of singular value decomposition applied or real spectral data, ready to be copied&pasted into https://github.com/FilipDominec/plotcommander
plotstyle = "basis"
#plotstyle = "amplitude"
decimatex = 20
ncomponents = 5
a = ys[:, ::decimatex]
xs = xs[:, ::decimatex]
U, s, V = np.linalg.svd(a, full_matrices=True)
if plotstyle=="basis":
for x, y, label in zip(xs[:ncomponents], V[:ncomponents], range(ncomponents)):
@FilipDominec
FilipDominec / manualdetox.py
Created June 9, 2017 13:25
(not fully working) Manual character replacement in file names - if "chardet" and "convmv" fail
#!/usr/bin/env python3
#-*- coding: utf-8 -*-
import os, sys
#import fileinput
AAA, BBB = u'‚¬…Ÿì¡ ýØçæ§£Ÿ§çç嬅Øý', u'éčůčýíář욊žÚčžššňČěřň'
filelist = [os.path.join(dp, f) for dp, dn, fn in os.walk('.') for f in fn]
filelist.sort()
@FilipDominec
FilipDominec / F-P-resonance-filter
Last active October 20, 2017 10:07
Filter Fabry-Pérot resonance from luminescence spectra shown in Plotcommander
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)
@FilipDominec
FilipDominec / hamiltonian1D_eigenstates.py
Last active September 6, 2019 13:25
Playground for visualisation of the Schrödinger equation solutions in one dimension
#!/usr/bin/python3
import matplotlib.pyplot as plt
import numpy as np
import numpy.linalg as la
width, n= 1., 500 ## width of the 1D quantum system, and number of points
nplot = 10 ## number of quantum states to plot
h = 1e-4 ## our definition of "Planck constant" determines the density of states
psiscale = .01 ## for plotting only: approximate matching of probability and potential scales
@FilipDominec
FilipDominec / tb-update.py
Created November 2, 2016 12:35
Crystal band structure by R. Muller - update
#!/usr/bin/env python
# tb.py Richard P. Muller, 5/2000
# Updated for numpy.linalg and matplotlib by Filip Dominec, 2016
# This program is the tight-binding program for Diamond/Zincblende
# structures that is presented in Chadi and Cohen's paper
# "Tight-Binding Calculations of the Valence Bands of Diamond and
# Zincblende Crystals", Phys. Stat. Soli. (b) 68, 405 (1975). This
# program is written for diamond and zincblende structures only.
@FilipDominec
FilipDominec / matplotlib-dual_axis-nice_numbers.py
Last active November 4, 2018 11:20
Functional dependence of right y-axis on the left one in Matplotlib: how to get nice numbers on both axes
#!/usr/bin/python3
#-*- coding: utf-8 -*-
import numpy as np
import scipy.constants as sc
import matplotlib.pyplot as plt
import matplotlib
@FilipDominec
FilipDominec / owon_wave.py
Last active May 31, 2024 13:22 — forked from aniline/owon_wave.py
Make a wave file from owon oscilloscope wave dump. It just does one channel. Not tested with numerous other combinations. Note that slow "running-wave" records fail to be properly saved due to Owon firmware bug.
#!/usr/bin/env python
#
# Makes a wav file out of owon oscilloscope waveform save file.
# Tested with SDS6062 only.
#
# Used:
# http://bikealive.nl/owon-bin-file-format.html and
# http://bikealive.nl/tl_files/EmbeddedSystems/Test_Measurement/owon/OWON%20Oscilloscope%20PC%20Guidance%20Manual.pdf
#
@FilipDominec
FilipDominec / Abbreviate Journal Names in Bibtex Database.py
Last active October 15, 2023 08:13
Using the translation table from the Jabref program, finds and replaces all scientific journal names to their standardized abbreviated form. First argument is the file to be processed; outputs safely to 'abbreviated.bib'
#!/usr/bin/env python
#-*- coding: utf-8 -*-
# Supporting Python 3
import sys, os, re
try: bibtexdb = open(sys.argv[1]).read()
except: print("Error: specify the file to be processed!")
if not os.path.isfile('journalList.txt'):
@FilipDominec
FilipDominec / camera2slideshow.sh
Last active March 10, 2016 08:11
When a digital camera is connected to your computer, it automatically downloads and displays the last shot.
#!/bin/bash
cd /home/SLIDESHOW
sleep 60
gphoto2 --capture-tethered --keep &
# geeqie -f latest/slideshow.jpg &
geeqie -f -s &
while true ; do cp `ls *JPG -1tr | tail -n 1` latest/slideshow.jpg ; sleep 2 ; done
#!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
Download and unpack the Hipparcos star catalog from www.astronexus.com/files/downloads/hygfull.csv.gz
Run in python to show interactive sky map with apparent star magnitude and approximate colour.
About 90000 stars are plotted within a second, you can pan and zoom the view.
Run with "--interactive no" to generate a big PDF file for printing. I could not find anything with this