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
""" | |
Log file parser, based on http://stackoverflow.com/a/17776027/323100 | |
""" | |
import re | |
def str2dict(filename='LogFile.log'): | |
results = {} | |
with open(filename, "r") as cache: |
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
import time | |
import numpy # not really needed for the printing, but for nice percentage :) | |
import sys | |
print 'Ciao Fede' | |
print 'Here is a percentage, on the same line' | |
for i in numpy.arange(0, 100, 0.1): | |
print '\r', # Comma is needed. | |
print 'Doing something. I am now %s%% done' % i, # Comma is needed | |
time.sleep(0.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
import numpy | |
from scipy.optimize import curve_fit | |
import matplotlib.pyplot as plt | |
# Define model function to be used to fit to the data above: | |
def gauss(x, *p): | |
A, mu, sigma = p | |
return A*numpy.exp(-(x-mu)**2/(2.*sigma**2)) | |
xdata = numpy.linspace(-5,5,100) |
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/env python | |
# -*- coding: utf-8 -*- | |
""" | |
GetCurrentImage.py | David Haberthür <david.haberthuer@psi.ch> | |
Minimal script to get current camera image from EPICS and display it | |
""" | |
# Import necessary modules |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# -*- coding: utf8 -*- | |
""" | |
Da ich keine Ahnung von Fussball habe, tippe ich bei unserem EM-Tippspiel so... | |
""" | |
import random | |
AnzahlTipps = 36 | |
# Tipp 1 |
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
from scipy import ndimage | |
import numpy | |
def shiftimagetocentroid(image): | |
imagecenter = [l/2 for l in numpy.shape(image)] | |
centroid = ndimage.measurements.center_of_mass(image) | |
print(centroid) | |
shift = numpy.subtract(imagecenter, centroid) | |
print(shift) | |
image = scipy.ndimage.interpolation.shift(image, shift, mode='wrap') |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.