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
def readpng(filename, hotpixelremove=False): | |
''' | |
Reads a png file and returns appropriate count vales, even if a bit depth | |
other than 8 or 16 is used. An example this might be needed is having a | |
12-bit png recorded from a 12-bit camera using LabViews IMAQ toolset. | |
In this case the PIL (python image library) fails to retrieve the | |
original count values. | |
''' | |
import png # pypng | |
import scipy.misc as sm |
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
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:47fd176dfa0c93311b89f99a57b966e98062a2e958745ba99fd68a4f7f94ed68" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ |
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 python2 | |
import numpy as np | |
import timeit | |
datax = np.random.random(50e6) | |
datay = np.random.random(50e6) | |
print 'creating histogram' | |
hist, edx, edy = np.histogram2d(datax, datay, bins=[700,700]) |
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 python2 | |
# argparse demo with multiple arguments. Try the following | |
# python2 argparsedemo.py xx yy --optional 5 6 7 | |
if __name__ == '__main__': | |
import argparse | |
parser = argparse.ArgumentParser() |
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 python3 | |
#Stephan Kuschel, 2014 | |
import timeit | |
s=''' | |
import numpy as np | |
a = np.random.random(int(5e7)) | |
b = np.random.random(int(5e7)) |
Loading
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
#!/bin/env python | |
# Stephan Kuschel, 2016 | |
def f(x): | |
return x + y | |
if __name__=='__main__': | |
y = 2 | |
print(f(5)) |
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
def addcolorbar(ax, im, pos='right', size='5%', pad=0.05, orientation='vertical', | |
stub=False, max_ticks=None, label=None): | |
''' | |
add a colorbar to a matplotlib image. | |
ax -- the axis object the image is drawn in | |
im -- the image (return value of ax.imshow(...)) | |
When changed, please update: | |
https://gist.github.com/skuschel/85f0645bd6e37509164510290435a85a |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file has been truncated, but you can view the full file.
OlderNewer