Skip to content

Instantly share code, notes, and snippets.

View evanbiederstedt's full-sized avatar

evanbiederstedt

View GitHub Profile
@evanbiederstedt
evanbiederstedt / discordant_methylation_project_April27_2016_moresamples.ipynb
Created April 27, 2016 23:23
more samples, approx. 20-25 GD27 and IGD cell samples
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@evanbiederstedt
evanbiederstedt / discordant_methylation_project_April25_2016.ipynb
Created April 26, 2016 20:30
Beginning plots for discordant methylation mini-project
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@evanbiederstedt
evanbiederstedt / gist:092866cc951dd0d8e490
Created November 22, 2015 18:43
-2LogLF function with Planck map values
# The -2 log-likelihood
#
# -2lnL \propto m^T C^-1 m + ln det C + N ln (2pi)
#
# First term, m^T C^-1 m is the "model fit term"
# Second term, lndetC is the "complexity penalty"
# Third term, N ln 2pi, a constant
#
# m = tempval
# C = Sij + N_ij
@evanbiederstedt
evanbiederstedt / gist:9193cef3729d7480e59b
Last active August 29, 2015 14:25
values of m^T C^-1 m for array mean=0, variance=1
Repeat of https://gist.github.com/evanbiederstedt/a763375f068b05167c26
with vector array of shape (3072,), mean=0, variance=1
tempp = np.random.normal(0.0, 1.0, 3072) # mean = 0, std = 1 = var = 1
# Test 1
vary_x_samples125 = np.logspace(-8, -12, num=40) # C3 parameter, vary from e-08 to e-12
sigma125 = 5e-22 # chose this sigma^2 parameter, hold constant
#FIRST, NO PEAK CODE, i.e. scale covariance matrix by e+21
@evanbiederstedt
evanbiederstedt / gist:64207101f1cea0ab796a
Created July 16, 2015 15:24
Hogg test, array 3072, mean = 0, var = 1
CODE:
""""
#
# Create an array shaped (3000,), mean = 0.0, variance = 1.0, and compute a_lm values.
# use np.random.normal(mean, std, size)
# http://docs.scipy.org/doc/numpy/reference/generated/numpy.random.normal.html
#
hoggarray = np.random.normal(0.0, 1.0, 3072) # mean = 0, std = 1 = var = 1
print hoggarray
@evanbiederstedt
evanbiederstedt / gist:a763375f068b05167c26
Last active August 29, 2015 14:25
m^t C^-1 m, vary C3 from e-08 to e-12, hold C3
Same as https://gist.github.com/evanbiederstedt/72b0035ca4b9fce830c3
except vary C3, hold sigma^2 fixed
FIRST, NO PEAK CODE, i.e. scale covariance matrix by e+21
CODE
""""
#
# Hold sigma^2 constant, vary C3
#
vary_x_samples125 = np.logspace(-8, -12, num=40) # C3 parameter, vary from e-08 to e-12
@evanbiederstedt
evanbiederstedt / gist:2c4a4c9c1494383dd0e5
Created July 15, 2015 22:16
Properties of CMB map array
import numpy as np
tempp = (1e6)*tempval # multiply CMB maps by 1e6
print tempp.shape # array shape
OUTPUT:
(3072,)
print np.median(tempp) # median
OUTPUT:
@evanbiederstedt
evanbiederstedt / gist:72b0035ca4b9fce830c3
Created July 15, 2015 21:47
m^T C^-1 m values and scaling Civ
FIRST, FIND NO PEAK IN LF, NOISE PARAMETERS E-21 TO E-23
CODE:
""""
vary_x_samples125 = np.logspace(-8, -12, num=40) #num = 40
sigma125 = np.logspace(-21, -23, num=40)
Sij = vary_x_samples125[:, None, None] * norm_matrix[1][None, :, :]
newSij = (1e21)*Sij # multiply S_ij by 1e12
@evanbiederstedt
evanbiederstedt / gist:27e52a63ebbe2d297017
Last active August 29, 2015 14:25
What is the value of the x^T C^-1 x term at the best-fit point? And what is its value when you reduce C_3 by ten percent?
C3_sample1 = 4e-8
sigma2samples1 = np.linspace(1e-22, 6e-23, num=40)
# param is our parameter, C_3
Sij = C3_sample1 * norm_matrix[1][None, :, :]
newSij = (1e22)*Sij # multiply S_ij by 1e12
Nij = sigma2samples1[:, None, None] * id_mat[None, :, :]
newNij = (1e22)*Nij
# Format 7/4pi * param * P_3(M) where param is the parameter we vary, C_l
@evanbiederstedt
evanbiederstedt / gist:857e6480f9e374aeeffa
Created July 2, 2015 16:51
np.linalg.inv() numerical errors
testmattt = Sij[13]
testmattt_inv = np.linalg.inv(Sij[13])
print testmattt
OUTPUT
[[ 3.60611595e-10 3.54999009e-10 3.49422963e-10 ..., -3.54999009e-10
-3.60611595e-10 -3.54999009e-10]
[ 3.54999009e-10 3.60611595e-10 3.54999009e-10 ..., -3.49422963e-10
-3.54999009e-10 -3.60611595e-10]