Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gal_catalog_config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CREDZONE = 0.5
NSIGMAS_IN_D = 3
COMPLETENESSP = 0.5
MINGALAXIES = 100
NGALAXIES = 10000
NGALAXIES = 1000
MINL = 1e40 ; expected min luminosity of event in r-band
MAXL = 1e42 ; expected max luminosity of event in r-band
SENSITIVITY = 22 ; LCO limiting magnitude in r-band
Expand Down
22 changes: 11 additions & 11 deletions src/gwtm_cron/gwtm_listener/find_galaxies.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def generate_galaxy_list(eventlocalization: EventLocalization, galaxy_config_pat
minL = float(galaxy_config.get('GALAXIES', 'MINL')) # Estimated brightest KN luminosity
maxL = float(galaxy_config.get('GALAXIES', 'MAXL')) # Estimated faintest KN luminosity
sensitivity = float(galaxy_config.get('GALAXIES', 'SENSITIVITY')) # Estimatest faintest app mag we can see
#ngalaxtoshow = int(galaxy_config.get('GALAXIES', 'NGALAXIES')) # Number of galaxies to show
ngalaxtoshow = int(galaxy_config.get('GALAXIES', 'NGALAXIES')) # Number of galaxies to show

mindistFactor = float(galaxy_config.get('GALAXIES', 'MINDISTFACTOR')) #reflecting a small chance that the theory is comletely wrong and we can still see something

Expand Down Expand Up @@ -163,25 +163,25 @@ def generate_galaxy_list(eventlocalization: EventLocalization, galaxy_config_pat
distanceFactor[absolute_sensitivity>maxL] = mindistFactor

# Sorting glaxies by probability
ii = np.argsort(p*massNorm*distanceFactor,kind="mergesort")[::-1]
sorted_gal_ind = np.argsort(p*massNorm*distanceFactor,kind="mergesort")[::-1]

####counting galaxies that constitute 50% of the probability(~0.5*0.98)
summ = 0
galaxies50per = 0
sum_seen = 0
while summ<0.5:
if galaxies50per>= len(ii):
if galaxies50per>= len(sorted_gal_ind):
break
summ = summ + (p[ii[galaxies50per]]*massNorm[ii[galaxies50per]])/float(normalization)
sum_seen = sum_seen + (p[ii[galaxies50per]]*massNorm[ii[galaxies50per]]*distanceFactor[ii[galaxies50per]])/float(normalization)
summ = summ + (p[sorted_gal_ind[galaxies50per]]*massNorm[sorted_gal_ind[galaxies50per]])/float(normalization)
sum_seen = sum_seen + (p[sorted_gal_ind[galaxies50per]]*massNorm[sorted_gal_ind[galaxies50per]]*distanceFactor[sorted_gal_ind[galaxies50per]])/float(normalization)
galaxies50per = galaxies50per+1

#if want to limit by number of galaxies in .ini file

# if len(ii) > ngalaxtoshow:
# n = ngalaxtoshow
# else:
# n = len(ii)
if len(sorted_gal_ind) > ngalaxtoshow:
list_length = ngalaxtoshow
else:
list_length = len(sorted_gal_ind)

score=(p * massNorm / normalization)
ra=galaxies['ra']
Expand All @@ -192,9 +192,9 @@ def generate_galaxy_list(eventlocalization: EventLocalization, galaxy_config_pat

print('INFO: Finished creating ranked galaxy list for EventLocalization {}'.format(eventlocalization))

iter = ii.tolist()
iter = sorted_gal_ind.tolist()
galaxy_list = []
for i in range(len(iter)):
for i in range(list_length):
ind = iter[i]
galaxy_list.append({
"ra":ra[ind],
Expand Down