Skip to content

Instantly share code, notes, and snippets.

View jenncross's full-sized avatar

Jennifer Cross jenncross

View GitHub Profile
@jenncross
jenncross / samples.m
Last active April 22, 2019 16:13
Example primer for MATLAB from python
%Get started by opening MATLAB and clicking "New Script" then paste this code in the script window.
% Run the code by clicking "Run" in the editor tab.
%In MATLAB, comments are marked with percent signs instead of # (hash signs) or """
%(triple quotes).
%Code that is saved in a file and performs some actions is called a script.
%MATLAB scripts are saved with the suffix .m
%Assignment is still done with an equals sign and linspace works basically
@jenncross
jenncross / project2_kmeans_starter.py
Last active April 1, 2020 20:40
starter code for project 2
import numpy as np
import matplotlib.pyplot as plt
import random
def openckdfile():
glucose, hemoglobin, classification = np.loadtxt('ckd.csv', delimiter=',', skiprows=1, unpack=True)
return glucose, hemoglobin, classification
@jenncross
jenncross / sympydemo.py
Created April 17, 2019 15:42
SymPy Demo
import sympy as sym
import math
def title(s):
print("\n")
print("*******")
print(s)
title("Square Root of 9")
print("Math: " + str(math.sqrt(9)))
@jenncross
jenncross / matrixmultiplication.py
Created April 10, 2019 18:12
matrix multiplication
"""
Created on Wed Apr 10 13:27:17 2019
@author: jenncross
"""
import numpy as np
@jenncross
jenncross / edges.py
Created April 8, 2019 18:29
Edge Detection Examples
"""
Created on Mon Apr 8 12:32:37 2019
@author: jenncross
"""
import imageio
from scipy import ndimage
import matplotlib.pyplot as plt
import numpy as np
import numpy as np
import matplotlib.pyplot as plt
import scipy.signal as sig
x = np.linspace(1,100,200)
error = (np.random.normal(size=200))*1000 #generate random errror centered at 0
@jenncross
jenncross / bikeshare.py
Last active March 13, 2019 17:16
Data Parsing of the Bike Share Data
"""
Data Parsing of the Bike Share Data
Available at https://archive.ics.uci.edu/ml/datasets/Bike+Sharing+Dataset
"""
#Here is a little magic that clears out your variables and console in Spyder
from IPython import get_ipython
get_ipython().magic('reset -sf') #deletes variables
get_ipython().magic('clear') #clears console
@jenncross
jenncross / dicedata.py
Last active March 12, 2019 15:50
Dice Roll Data
import random
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import dice # My custom module
rollsums = testSums(1, 100)
@jenncross
jenncross / dice.py
Created March 12, 2019 15:42
Dice Functions
import random
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
def rolldice(number):
rolls = np.zeros((number,), int)
for i in range(number):
die = random.randint(1,6)
rolls[i] = die
@jenncross
jenncross / balloon.py
Last active March 12, 2019 15:47
Balloon Data Parsing Code
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
fin = open("balloon.csv")
data = []
for line in fin:
data.append(float(line[1:6]))