Skip to content

Instantly share code, notes, and snippets.

@evanbiederstedt
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evanbiederstedt/9193cef3729d7480e59b to your computer and use it in GitHub Desktop.
Save evanbiederstedt/9193cef3729d7480e59b to your computer and use it in GitHub Desktop.
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
#CODE
#https://gist.github.com/evanbiederstedt/a763375f068b05167c26
#
# Hold sigma^2 constant, vary C3
#
OUTPUT
m^T c^-1 m terms are
[ 6063.03944238 6239.6867014 6186.70223744 6238.94664056 6191.4244392
6176.35233904 6169.08917136 6168.06081044 6160.040556 6161.52378429
6161.94142132 6159.40639312 6158.72308258 6159.40443733 6158.8283143
6159.45252001 6159.05305479 6159.32630012 6158.87793763 6158.98306791
6159.08544029 6158.81735827 6158.96626508 6158.89501335 6158.97620424
6158.9274596 6158.88636871 6158.90387669 6158.91760602 6158.90812902
6158.90325582 6158.90071489 6158.90624671 6158.89835533 6158.90613525
6158.89200745 6158.89331928 6158.89317107 6158.89402207 6158.89378695]
******************
logdetC terms are
[-1910.79269502 -1899.49346143 -1894.31400072 -1893.9865907 -1890.0321336
-1889.55785882 -1889.79498435 -1890.52858638 -1891.04930553 -1892.56437866
-1893.64297778 -1895.06109716 -1896.61902812 -1898.36601353 -1899.78459156
-1901.39518245 -1903.05163531 -1904.67733691 -1906.32176722 -1907.95386497
-1909.59522293 -1911.21625436 -1912.86998408 -1914.50988852 -1916.15690315
-1917.81120861 -1919.462296 -1921.10832586 -1922.76238417 -1924.41349353
-1926.06744684 -1927.71856858 -1929.37104233 -1931.02466563 -1932.67642731
-1934.32805631 -1935.98147704 -1937.63429343 -1939.28755537 -1940.94054106]
******************
Npix2pi term is
19301.9452637
*******************************************************************************
*******************************************************************************
# Test 2
vary_x_samples123 = np.logspace(-8, -12, num=40) # C3 parameter, vary from e-08 to e-12
sigma123 = 5e-22 # chose this sigma^2 parameter, hold constant
#SECOND, THERE IS A PEAK CODE, i.e. scale covariance matrix by e+22
#CODE
#
# Hold sigma^2 constant, vary C3
#
OUTPUT:
m^T c^-1 m terms are
[ 619.62979688 630.75762714 624.33641024 646.42781419 630.83033316
628.42196746 628.01224636 627.30792608 627.08883245 626.63108718
626.86471702 626.58633689 626.45310587 626.48049364 626.49818424
626.41093951 626.44859437 626.38258585 626.37143213 626.3696847
626.35372623 626.35473303 626.34452735 626.35210835 626.34802669
626.34394785 626.34583766 626.33944449 626.34105563 626.34079913
626.33981216 626.33885527 626.33921146 626.33861005 626.33822696
626.33776682 626.33786979 626.33772158 626.33777337 626.33755162]
******************
logdetC terms are
[ 5162.11916985 5174.89668376 5179.54501215 5178.57071109 5182.81051551
5184.46873299 5183.19398907 5183.19703352 5182.37013867 5181.01067721
5179.97913256 5178.52226416 5176.80653401 5175.16623507 5173.76193185
5172.11691893 5170.45643259 5168.87473124 5167.23262542 5165.6055479
5163.95696043 5162.3116691 5160.67301514 5159.02720484 5157.37926926
5155.73010752 5154.07978174 5152.43292945 5150.77874406 5149.12856074
5147.47438028 5145.82296635 5144.17003878 5142.51772009 5140.86502619
5139.21290009 5137.56004832 5135.9069266 5134.25393896 5132.60101615]
******************
Npix2pi term is
19301.9452637
*******************************************************************************
*******************************************************************************
# Test 3
vary_x_samples125 = 5e-10
sigma125 = np.logspace(-21, -23, num=40)
#We can do the same tests with holding C3 and varying the sigma^2 noise parameter:
#
#First use C3 = 5e-10, and then try 10% less, i.e. C3=4.5e-10
#
#FIRST CODE, fix C3 = 5e-10
#
#Hold C3 fixed, then do test again with 10% less C3 value
#We use C3 = 5e-10
#
OUTPUT:
m^T c^-1 m terms are
[ 3056.20931539 3439.33358524 3870.46710341 4355.78041819
4902.49532247 5516.49235235 6207.96349215 6986.28116913
7863.01494373 8849.09701467 9958.5489499 11208.36540772
12619.22019092 14197.26767573 15981.25054659 17990.42802844
20245.96573985 22786.47797877 25658.41585925 28882.50986532
32508.44324612 36620.25796131 41214.54053757 46451.3399304
52451.3607927 59281.97126605 58140.43064709 73849.68519667
83596.33544031 94564.52774417 106607.70915675 120938.12045667
136999.05138901 155621.00980102 172488.83210862 197269.6566713
226064.62122472 258114.03947093 304914.6451813 341068.83724127]
****************
logdetC terms are
[ 226.9052794 -135.07131727 -496.90121724 -858.84168741
-1220.95683913 -1583.00135661 -1944.915235 -2306.69141473
-2668.93133159 -3030.70976015 -3393.04701702 -3754.86449285
-4117.08237295 -4478.81252165 -4840.70266103 -5203.60698497
-5565.30740991 -5927.80221985 -6289.9127427 -6652.62034049
-7016.06626191 -7378.97770017 -7739.66767859 -8103.60482614
-8468.13642146 -8832.06627575 -9201.75852318 -9558.79338163
-9920.82765381 -10286.47587538 -10655.88535624 -11026.26666575
-11395.66670283 -11762.37585804 -12132.20128441 -12499.66763487
-12883.12465843 -13266.56868972 -13654.89410426 -14040.44010189]
******************
Npix2pi term is
19301.9452637
*******************************************************************************
*******************************************************************************
# Test 4
vary_x_samples125 = 5e-10
sigma125 = np.logspace(-21, -23, num=40)
#SECOND CODE, C3 fixed to 4.5e-10
#
#Hold C3 fixed, then do test again with 10% less C3 value
#Now use C3 = 4.5e-10
#
OUTPUT:
m^T c^-1 m terms are
[ 2912.91163678 3278.29157663 3688.78891476 4151.43962411
4672.16804496 5257.82792359 5917.08851782 6658.35637171
7494.04238153 8433.17194244 9490.53562282 10680.1940994
12022.83862483 13528.0477834 15222.62005293 17146.82186255
19285.36520843 21716.90840606 24438.46964114 27520.0535268
30984.41701002 34901.11856995 39270.20493271 44270.69528356
49941.7331173 56628.65356416 59901.59201949 70814.71217834
80031.30268259 90459.24816214 102436.94217516 116056.63249007
131915.66126694 156694.59393477 152811.80664743 183689.92516624
211790.65295544 243259.40026702 285462.99321654 341562.38606682]
****************
logdetC terms are
[ 226.9052794 -135.07131727 -496.90121724 -858.84168741
-1220.95683913 -1583.00135661 -1944.915235 -2306.69141473
-2668.93133159 -3030.70976015 -3393.04701702 -3754.86449285
-4117.08237295 -4478.81252165 -4840.70266103 -5203.60698497
-5565.30740991 -5927.80221985 -6289.9127427 -6652.62034049
-7016.06626191 -7378.97770017 -7739.66767859 -8103.60482614
-8468.13642146 -8832.06627575 -9201.75852318 -9558.79338163
-9920.82765381 -10286.47587538 -10655.88535624 -11026.26666575
-11395.66670283 -11762.37585804 -12132.20128441 -12499.66763487
-12883.12465843 -13266.56868972 -13654.89410426 -14040.44010189]
******************
Npix2pi term is
19301.9452637
*******************************************************************************
*******************************************************************************
# Test 5
vary_x_samples123 = 5e-10
sigma123 = np.logspace(-22, -24, num=40)
#FIRST, FIND NO PEAK IN LF, NOISE PARAMETERS E-22 TO E-24
#
#CODE, C3 = 5e-10:
#
#Hold C3 fixed, then do test again with 10% less C3 value
#Use C3=5e-10
#
#Noise is now varied from e-22 to e-24
#
OUTPUT:
m^T c^-1 m terms are
[ 3115.80676984 3509.43859015 3951.18169027 4450.30837947
5018.22687418 5669.12296358 6512.39354618 7035.64871188
8017.42106036 9081.78915341 10246.3544283 11614.36145183
12813.43506509 14816.26445455 10972.80849967 18727.36016301
21228.15458374 24314.36538203 27914.83552674 30777.17018509
37065.30435071 45042.76970101 63665.81035839 66193.98108607
-222373.06068062 69519.41277427 134234.75456565 105181.51667804
90691.96135331 86196.57060379 -97323.35753444 113565.86041873
2965.81147655 193051.18658492 99617.72031856 119141.30217934
-95961.19547079 -33984.2067834 -8309.41726665 -4336.92334402]
******************
logdetC terms are
[ 239.71699157 -122.71079135 -486.33852385 -849.25504606
-1212.4921126 -1576.26351061 -1944.85327619 -2305.753459
-2669.13822474 -3030.65420367 -3396.41771088 -3763.82736171
-4131.60575246 -4506.35071982 -4889.11466545 -5248.4037388
-5612.4490359 -5995.67825433 -6385.48032885 -6779.9332622
-7172.39370076 -7581.395549 -8041.60387949 -8517.11067861
-9002.83276846 -9446.49442793 -9839.83647962 -10172.92306214
-10420.76829252 -10623.50283171 -10792.24792309 -10928.10844176
-11027.19559602 -11100.06733525 -11170.65063404 -11215.66540551
-11261.93661065 -11284.43614935 -11306.60681018 -11326.08454794]
******************
Npix2pi term is
19301.9452637
*******************************************************************************
*******************************************************************************
# Test 6
vary_x_samples123 = 4.5e-10
sigma123 = np.logspace(-22, -24, num=40)
#SECOND CODE,
#C3 = 4.5e-10
#
#Hold C3 fixed, then do test again with 10% less C3 value
#Now use C3=4.5e-10
#
#Noise is now varied from e-22 to e-24
#
m^T c^-1 m terms are
[ 2.98296571e+03 3.36090866e+03 3.78476827e+03 4.26532893e+03
4.80494553e+03 5.41825219e+03 6.13718240e+03 7.32181220e+03
7.58478814e+03 8.64215882e+03 9.76004961e+03 1.10981090e+04
1.27425089e+04 1.35173429e+04 1.58250781e+04 1.78044260e+04
1.99491636e+04 2.29589521e+04 2.61711220e+04 3.03112591e+04
2.79374840e+04 4.00573536e+04 4.84547156e+04 4.88975460e+04
6.47920720e+04 1.05957459e+05 9.17710292e+04 1.41471647e+03
5.31272340e+04 1.17311577e+05 4.41539020e+04 -1.20015118e+05
2.81598852e+04 -1.51603586e+03 1.80542789e+05 -4.05951829e+04
2.93604015e+05 -4.78810033e+04 -6.22225138e+03 -1.71448966e+06]
******************
logdetC terms are
[ 238.87906146 -123.59978549 -486.97635053 -849.54919459
-1212.63010956 -1576.01604717 -1942.33073337 -2309.73321034
-2670.91431763 -3031.09627919 -3396.32588831 -3762.14204865
-4128.07960518 -4502.34341668 -4872.33980536 -5255.02597355
-5607.79232715 -5986.94061374 -6370.62068917 -6753.73665052
-7147.26442618 -7537.878678 -7981.39859695 -8433.45165572
-8907.83987127 -9384.80250567 -9848.92410084 -10252.021386
-10558.32732388 -10804.17249772 -11029.95815536 -11179.59272393
-11324.19494314 -11416.3809462 -11503.90735819 -11568.77486146
-11622.48104156 -11656.23132841 -11687.85082231 -11713.95931238]
******************
Npix2pi term is
19301.9452637
*******************************************************************************
*******************************************************************************
@evanbiederstedt
Copy link
Author

How the covariance matrix is scaled:

Test 1 scales Cij by (1e21)
Test 2 scales Cij by (1e22)
Test 3 and Test 4 scales by (1e21)
Test 4 and Test 5 scales by (1e22).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment