Skip to content

Instantly share code, notes, and snippets.

View benjaminrose's full-sized avatar

Benjamin Rose benjaminrose

View GitHub Profile
@benjaminrose
benjaminrose / scale_conversion.py
Created January 2, 2015 17:47
Convert [0,36-) to [-180,180)
'this still needs better testing, espcially to work with numpy'
'needs to work with degrees and radians'
def convert(x):
'x is a list, would like it to work with numpy'
ind = x>180
for i,j in enumerate(ind):
if j:
l[i]-=360
return x
@benjaminrose
benjaminrose / ScatterToContour.py
Last active August 29, 2015 13:59
Creating a function that takes two vectors used to make a scatter plot and converts them into the three arrays need for a contour plot.
import numpy as np
import matplotlib.pyplot as plt
def ScatterToContour(x,y, bins=[10,10]):
'''
x is the x location of the points
y is the y location of the points
len(x) needs to equal len(y)
bins determins the refinement of the histogram and line edges.
All contour plot perameters (levels, ect.) are defined outside