-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmod_benchmarks.py
More file actions
74 lines (59 loc) · 2.2 KB
/
mod_benchmarks.py
File metadata and controls
74 lines (59 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# This script makes a version of a benchmark file with just a subset of the bins which would normally be included, for the purpose of testing accuracy in these modified configurations
import numpy as np
import sys
filename = sys.argv[1]
outputfile = sys.argv[2]
type_of_corr = sys.argv[3] # should be gg, gs or ss
# The default configuration has 10 clustering bins and 5 source bins.
# Set the number of bins you want to keep
# For now, these need to be starting from the HIGHEST redshift bin and not skipping any bins.
cl_keep = 7
sh_keep = 2
cl_tot = 10
sh_tot = 5
d = np.load(filename)
ls = d['ls']
cls =d['cls']
print(ls.shape)
print(cls.shape)
# Work out how many to cut:
if type_of_corr=='gg':
# Correlations are symmetric so have only stored unique ones, need to account for this. I'm sure there is a better way to do this.
num_spec = 0
for i in range(0,cl_keep):
for j in range(i, cl_keep):
num_spec=num_spec+1
# Now, cut the clgs to this:
cls_cut = cls[-num_spec:,:]
elif type_of_corr=='gs':
# Correlations are not symmetric, need to be a bit more careful.
# This is a faff so I'm just going to put in by hand which elements I want.
# Needs to be manually modified each time
# cls_cut = cls[[32,33,34,37,38,39,42,43,44,47,48, 49]] : this is for shear 3-5 and clustering 7-10
cls_cut = cls[[18,19,23,24,28,29,33,34,38,39,43,44,48,49]] # this is for shear 4-5 and clustering 4-10
elif type_of_corr=='ss':
#Correlations are symmetric:
num_spec=0
for i in range(0,sh_keep):
for j in range(i, sh_keep):
num_spec=num_spec+1
# Now, cut the clgs to this:
cls_cut = cls[-num_spec:,:]
print(cls_cut.shape)
# Now save the cut benchmarks into a new file.
np.savez(outputfile, cls=cls_cut, ls=ls)
"""# First put the whole input thing in matrix form:
indices=[]
if type_of_corr== 'gg':
for i1 in range(10):
for i2 in range(i1, 10):
indices.append((i1, i2))
elif type_of_corr=='gs':
for i1 in range(10):
for i2 in range(5):
indices.append((i1, i2))
elif type_of_corr=='ss':
for i1 in range(5):
for i2 in range(i1, 5):
indices.append((i1, i2))
print(indices)"""