Skip to content

Instantly share code, notes, and snippets.

View shane5ul's full-sized avatar

Sachin Shanbhag shane5ul

View GitHub Profile
@shane5ul
shane5ul / TrapezoidalLogSpace.ipynb
Last active October 19, 2020 20:29
Evaluating integrals of functions with smoothness properties in log-log space using trapezoidal rule
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shane5ul
shane5ul / matrixTeX.py
Last active October 21, 2017 15:57
Given a numpy array or matrix, returns a LaTeX bmatrix or bmatrix* environment. Has some bells and whistles to help with formatting.
def matrixTeX(a, decimal=0, justifyRight=False, suppress=True, formatString=None):
"""
Returns a LaTeX bmatrix or bmatrix* environment
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
: Input :
: a : numpy array or matrix
: decimal : 0 or # of decimal digits
: (default: inherit from numpy array)
@shane5ul
shane5ul / figureCaption.tex
Created September 8, 2017 18:32
Adjusting figure captions in LaTeX using the caption command. A minimal working example.
\documentclass[11pt,letterpaper]{article}
\usepackage{caption}
\usepackage{graphicx}
\pagestyle{empty}
\begin{document}
\begin{figure}
\begin{center}
\includegraphics[scale=0.3]{fsu}
@shane5ul
shane5ul / beamerHeader.tex
Created July 27, 2017 12:15
This is the standard beamer preamble I use for my slides
% toggle to ignore \pause in handout slides
%\documentclass[xcolor=dvipsnames,onlymath,12pt]{beamer}
\documentclass[xcolor=dvipsnames,onlymath,12pt,handout]{beamer}
% standard tools for graphics, math, and hyperlinks
\usepackage{graphics,amsmath,url,mathtools}
\usepackage{hyperref}
% package to pretty print code
\usepackage{minted}
@shane5ul
shane5ul / prony.py
Last active November 27, 2024 23:51
This program uses the Prony method to fit data to F(t) = \sum_{i=1}^{m} a_i e^{b_i t}.
def prony(t, F, m):
"""Input : real arrays t, F of the same size (ti, Fi)
: integer m - the number of modes in the exponential fit
Output : arrays a and b such that F(t) ~ sum ai exp(bi*t)"""
import numpy as np
import numpy.polynomial.polynomial as poly
# Solve LLS problem in step 1
@shane5ul
shane5ul / MPLSubplots.ipynb
Created June 6, 2017 17:38
A jupyter notebook demonstrating inset plots, subplots, and twin yaxis plots in Matplotlib.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shane5ul
shane5ul / MPLStyle.ipynb
Created May 15, 2017 18:08
Using built-in and user-defined styles in Matplotlib
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shane5ul
shane5ul / VizODE.ipynb
Created November 5, 2016 20:15
A jupyter notebook to understand IVPs graphically.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shane5ul
shane5ul / blockAverage.py
Last active September 15, 2023 02:48
This program computes the block average of a potentially correlated timeseries "x", and provides error bounds for the estimated mean <x>. As input provide a vector or timeseries "x", and the largest block size.
def blockAverage(datastream, isplot=True, maxBlockSize=0):
"""This program computes the block average of a potentially correlated timeseries "x", and
provides error bounds for the estimated mean <x>.
As input provide a vector or timeseries "x", and the largest block size.
Check out writeup in the following blog posts for more:
http://sachinashanbhag.blogspot.com/2013/08/block-averaging-estimating-uncertainty_14.html
http://sachinashanbhag.blogspot.com/2013/08/block-averaging-estimating-uncertainty.html
"""
@shane5ul
shane5ul / f2pyExample.ipynb
Last active April 10, 2019 19:58
A jupyter notebook which demonstrates the use of f2py for computing radial distribution functions
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.