Skip to content

Instantly share code, notes, and snippets.

View evanhazey's full-sized avatar

Evan Haze Nunez evanhazey

View GitHub Profile
@evanhazey
evanhazey / split_cccp_xspec_sourcelist.pro
Created December 14, 2017 18:05
Splits a source list into different possible classifications
;Split the huge CCCP sourcelist into
;just IR matched sources and further
;into their classifications
pro split_cccp_xspec_sourcelist,ir_sav,all_srclist,srclist_out,subset_type
;SUBSET_TYPE = 1 for all IR matches, 2 for IMPS, 3 for TTauri
;4 for AB, 5 for OB and 6 for unc.
;test call--> split_cccp_xspec_sourcelist,'xsed_collation_cccp.sav','all.srclist','test',2
@evanhazey
evanhazey / lum_temp_calc.pro
Created December 14, 2017 17:43
Script to convert flux (ergs/s/cm^2) to luminosity in different forms, also converts KeV to kelvin
;Program to convert flux (ergs/s/cm^2) from xspec
;to luminosity and logluminosity
function convert_kev_temp, kev
temp = 1.*kev/(8.617*10.^(-8)) ;units for k are kev/K
return, temp
end
function convert_flux_lum, flux, distance
lum = flux*4.*!pi*distance*distance ;flux in ergs/s*cm^2
@evanhazey
evanhazey / radioactiveisotopes.py
Created December 14, 2017 17:40
Script used in the 2016 University Physics Competition (where my team and I won silver) to plot yield and cost of different radioactive elements
import numpy as np
import matplotlib.pyplot as plt
#Medium Lived Isotopes
Eu_155 = (0.0803, 252)
Kr_85 = (0.2180, 687)
Cd_113 = (0.0008, 316)
Sr_90 = (4.505, 2826)
Cs_137 = (6.337, 1176)
Sn_121 = (0.00005, 390)
@evanhazey
evanhazey / lab_f-5_drag_force.py
Created December 14, 2017 17:25
Script to plot lab data of the drag force of glycerin on different materials
import math
import numpy as np
import matplotlib.pyplot as plt
#Want to plot Drag Force vs Velocity for the five balls
drag_bearings = np.array([25.5, 53.6, 120])
velocity = np.array([1.84, 3.86, 8.44])
log_drag = np.log(drag_bearings)
log_velocity = np.log(velocity)
@evanhazey
evanhazey / lab_f-4-surface_tension.py
Created December 14, 2017 17:22
Script to plot data from an undergraduate lab showcasing the surface tension force of water
import numpy as np
import matplotlib.pyplot as plt
#Distance reading on a vernier caliper in mm
#Force reading from a spring scale in Newtons
water_distance = np.array([0, 6.68, 12.10, 18.24, 24.82, 28.88, 32.58, 37.00, 41.24, 45.40, 48.00, 50.82, 54.41])
water_force = np.array([0.032, 0.032, 0.036, 0.042, 0.048, 0.052, 0.055, 0.058, 0.061, 0.063, 0.066, 0.067, 0.043])
soap_distance = np.array([0, 6.68, 12.10, 18.24, 24.82, 28.88, 32.58, 37.00, 41.24, 45.40, 48.00, 50.82, 54.41])
soap_force = np.array ([0.032, 0.032, 0.036, 0.042, 0.046, 0.049, 0.051, 0.053, 0.055, 0.059, 0.059, 0.043, 0])
@evanhazey
evanhazey / high_z_color_zJ_iY.py
Created December 14, 2017 17:19
Creates color-color (z-J v i-Y) plot for high redshift quasar candidates
import numpy as np
import matplotlib.pyplot as plt
from astropy.io import fits
def mag(flux):
x = 22.5 - 2.5*np.log10(flux)
return x
#Loading in fits files
observed_data = fits.getdata('/Users/enunez/Documents/python/reu.followup.lite.fits',1)
@evanhazey
evanhazey / high_z_color_iz_zJ.py
Last active December 14, 2017 17:20
Creates color-color (i-z v z-J) plot of high redshift quasar candidates
import numpy as np
import matplotlib.pyplot as plt
from astropy.io import fits
def mag(flux):
x = 22.5 - 2.5*np.log10(flux)
return x
#Loading in fits files
observed_data = fits.getdata('/Users/enunez/Documents/python/reu.followup.lite.fits',1)
@evanhazey
evanhazey / high_z_color_YJ_zY.py
Created December 14, 2017 17:17
Creates color-color (Y-J v z-Y) plot of high redshift quasar candidates
import numpy as np
import matplotlib.pyplot as plt
from astropy.io import fits
def mag(flux):
x = 22.5 - 2.5*np.log10(flux)
return x
#Loading in fits files
observed_data = fits.getdata('/Users/enunez/Documents/python/reu.followup.lite.fits',1)
@evanhazey
evanhazey / high_z_color_W1W2_zW2.py
Created December 14, 2017 17:16
Creates color-color (W1-W2 v z-W2) plot of high redshift quasar candidates
import numpy as np
import matplotlib.pyplot as plt
from astropy.io import fits
def mag(flux):
x = 22.5 - 2.5*np.log10(flux)
return x
#Loading in fits files
observed_data = fits.getdata('/Users/enunez/Documents/python/reu.followup.lite.fits',1)
@evanhazey
evanhazey / einstein_solid.py
Created December 14, 2017 17:13
Calculates multiplicity, entropy, energy and other important numbers for an Einstein solid of given q (energy) and N (number of oscillators)
#Einstein Solid Script
#Plot the multiplicty of
#two Einstein solids with oscillators
#Nan Nb with Q units of energy,
#print entropy and muplicity
#at each q value and more
from decimal import Decimal
import math
import numpy as np