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 sys | |
from numpy import NaN, Inf, arange, isscalar, array, asarray | |
def peakdet(v, delta, x = None): | |
""" | |
Converted from MATLAB script at http://billauer.co.il/peakdet.html | |
Returns two arrays | |
function [maxtab, mintab]=peakdet(v, delta, x) |
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
class MainWindow(QMainWindow, Ui_MainWindow): | |
def __init__(self,parent=None): | |
QDialog.__init__(self,parent) | |
self.setupUi(self) | |
self.mpl.canvas.ax.clear() | |
ds=dicom.read_file("slice.dcm") | |
#self.mpl.canvas.ax.imshow(self.image1, cmap=pylab.cm.bone) | |
self.mpl.canvas.ax.imshow(ds.pixel_array, cmap=pylab.cm.bone) | |
self.mpl.canvas.ax.xaxis.set_visible(False) |
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
self.cal_curve_widget.canvas.ax.clear() | |
self.cal_curve_widget.canvas.ax.plot(self.cal_MU,self.cal_density) | |
self.cal_curve_widget.canvas.draw() |
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
try: | |
with open('filename'): pass | |
except IOError: | |
print 'Oh dear.' |
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 sys | |
import numpy as np | |
from PyQt4.QtCore import * | |
from PyQt4.QtGui import * | |
#from xlwt import * | |
from pylab import plot, show | |
from matplotlib.figure import Figure | |
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas | |
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar2 |
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/python | |
import os | |
import sys | |
files = os.listdir(sys.argv[1]) | |
for f in files: | |
os.rename(f, f.replace(' ', '_')) |
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
# | |
# ~/.bashrc | |
# | |
# If not running interactively, don't do anything | |
[[ $- != *i* ]] && return | |
alias designer='designer -qt=4' | |
alias python='python2' | |
alias ipython='ipython2' |
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
{%- extends 'html_full.tpl' -%} | |
{% block input_group -%} | |
<div class="input_hidden"> | |
{{ super() }} | |
</div> | |
{% endblock input_group %} | |
{%- block header -%} | |
{{ super() }} |
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 as np | |
from math import pi, log | |
import pylab | |
from scipy import fft, ifft | |
from scipy.optimize import curve_fit | |
i = 10000 | |
x = np.linspace(0, 3.5 * pi, i) | |
y = (0.3*np.sin(x) + np.sin(1.3 * x) + 0.9 * np.sin(4.2 * x) + 0.06 * | |
np.random.randn(i)) |
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
%%HTML | |
<script> | |
var code_show=true; //true -> hide code at first | |
function code_toggle() { | |
$('div.prompt').hide(); // always hide prompt | |
if (code_show){ | |
$('div.input').hide(); | |
} else { |
OlderNewer