From 80ca2c5f7b789add50039267b14dd3444352c5d5 Mon Sep 17 00:00:00 2001 From: Isaac McMahon <isaac.mcmahon@ligo.org> Date: Tue, 11 Jun 2024 13:31:58 +0000 Subject: [PATCH] HealPixMapPriorDist Redundancy Fix --- AUTHORS.md | 1 + bilby/gw/prior.py | 5 ++--- test/check_author_list.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/AUTHORS.md b/AUTHORS.md index 1c137a2aa..8c227ed6f 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -29,6 +29,7 @@ Gregory Ashton Hank Hua Hector Estelles Ignacio Magaña Hernandez +Isaac McMahon Isobel Marguarethe Romero-Shaw Jack Heinzel Jacob Golomb diff --git a/bilby/gw/prior.py b/bilby/gw/prior.py index 5e9f670d5..217674111 100644 --- a/bilby/gw/prior.py +++ b/bilby/gw/prior.py @@ -1362,6 +1362,7 @@ class HealPixMapPriorDist(BaseJointPriorDist): else: self.distance = False self.prob = self.hp.read_map(hp_file) + self.prob = self._check_norm(self.prob) super(HealPixMapPriorDist, self).__init__(names=names, bounds=bounds) self.distname = "hpmap" @@ -1501,9 +1502,7 @@ class HealPixMapPriorDist(BaseJointPriorDist): sample : array_like sample of ra, and dec (and distance if 3D=True) """ - pixel_choices = np.arange(self.npix) - pixel_probs = self._check_norm(self.prob) - sample_pix = random.rng.choice(pixel_choices, size=size, p=pixel_probs, replace=True) + sample_pix = random.rng.choice(self.npix, size=size, p=self.prob, replace=True) sample = np.empty((size, self.num_vars)) for samp in range(size): theta, ra = self.hp.pix2ang(self.nside, sample_pix[samp]) diff --git a/test/check_author_list.py b/test/check_author_list.py index c04932d5e..95d5be1ca 100644 --- a/test/check_author_list.py +++ b/test/check_author_list.py @@ -3,7 +3,7 @@ import re import subprocess -special_cases = ["plasky", "thomas", "mj-will", "richard", "douglas"] +special_cases = ["plasky", "thomas", "mj-will", "richard", "douglas", "nixnyxnyx"] AUTHORS_list = [] with open("AUTHORS.md", "r") as f: AUTHORS_list = " ".join([line for line in f]).lower() -- GitLab