-
Notifications
You must be signed in to change notification settings - Fork 0
/
trilegalisl.py
61 lines (36 loc) · 1.76 KB
/
trilegalisl.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import numpy as np
def jades_trilegalisl(paths, data, tri_gaia, tri_mag, max_mag, save_file, flag_method, tri_type):
fieldnum = data.header.fieldnum
# step 1: compute the area of a JADES image and pull out that many stars
# from the list at random
surveyarea = num_pixels * (PIXAR_A2/ 3600**2)
# step 2: read in the trilegal information
nfiles = len(V)
isltot = np.zeros(nfiles)
islmasked = np.zeros(nfiles)
islghost = np.zeros(nfiles)
for jfile in range(0, nfiles):
# If using trilegal catalog based on UBVRI magnitudes
if tri_type == 'ubvri':
mag = V[jfile - 1].mlf
# step 3: convert from mag to flux
# Flux calculation
Fcat = 10 ** (m / (-2.5)) / PIXAR_SR * vega_sirius_Jy
# step 4: make a mask function
whpl = V[jfile - 1].V > Max_Mag
# If using trilegal catalog based on G magnitudes
# step 5: convert to surface brightness
magcat = mag[whpl]
#lIltot = 1e-26 * 1e9 * data.cal.nu * Fcat / (surveyarea * (np.pi / 180) ** 2)
lIlcat = 1e-26 * 1e9 * data.cal.nu * Fcat[whpl] / (surveyarea * (np.pi / 180) ** 2) # this one is ISL - per radian squared
#isltot[jfile - 1] = np.sum(lIltot)
islmasked[jfile - 1] = np.sum(lIlcat) # this is ISL
islout['isltotmean'] = np.mean(isltot)
islout['isltoterr'] = np.std(isltot)
islout['islmaskedmean'] = np.mean(islmasked) # this is ISL
islout['islmaskederr'] = np.std(islmasked)
data['isl']['tritotmean'] = islout['isltotmean']
data['isl']['tritoterr'] = islout['isltoterr']
data['isl']['trimean'] = islout['islmaskedmean'] # this is used as ISL subtraction
data['isl']['trierr'] = islout['islmaskederr']
return data