-
Notifications
You must be signed in to change notification settings - Fork 3
/
tmr_ecorr.py
38 lines (25 loc) · 962 Bytes
/
tmr_ecorr.py
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
import numpy as np
from data.ke_params import *
def tmr_ecorr(redshift, restframe_colour, aall=False):
if aall:
result = -Qall*redshift
else:
result = np.zeros_like(redshift)
result[restframe_colour > redblue_split] = -Qred*redshift[restframe_colour > redblue_split]
result[restframe_colour <= redblue_split] = -Qblue*redshift[restframe_colour <= redblue_split]
return result
def tmr_q(restframe_colour, aall=False):
if aall:
result = Qall * np.ones_like(restframe_colour)
else:
result = np.zeros_like(restframe_colour)
result[restframe_colour > redblue_split] = Qred
result[restframe_colour <= redblue_split] = Qblue
return result
if __name__ == '__main__':
import numpy as np
zs = np.arange(0.0, 1.0, 0.01)
cols = 0.5 * np.ones_like(zs)
Es = tmr_ecorr(zs, cols, aall=False)
Qs = tmr_q(cols, aall=True)
print(Qs)