Skip to content

Commit

Permalink
Merge pull request #5 from dirac-institute/cchris28/uniform_spherical…
Browse files Browse the repository at this point in the history
…_random_surface

changed random cluster generator
  • Loading branch information
cchris28 authored Jul 20, 2023
2 parents ad26b1d + b44b7ad commit d7dea40
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/kbmod/regionsearch/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
EarthLocation,
SkyCoord,
solar_system_ephemeris,
uniform_spherical_random_surface,
)


Expand Down Expand Up @@ -80,7 +81,7 @@ def __init__(
The version is checked when reading the file.
"""
# See https://docs.astropy.org/en/stable/io/unified.html#table-serialization-methods
self.version = "1"
self.version = "2"
# seed for random number generator
self.seed = seed
# number of clusters in test
Expand Down Expand Up @@ -248,9 +249,11 @@ def _generate_data(self):
self.clusterdistances = [2]
self.clusterdistances.extend([random.randrange(2, 10000) for _ in range(self.clustercnt - 1)])

clusters = [[random.uniform(0.0, 360.0), random.uniform(0, 180.0)] for _ in range(self.clustercnt)]

self.clusters = [[i[0] - 180.0, i[1] - 90.0] for i in clusters]
_clusters = uniform_spherical_random_surface(self.clustercnt)
self.clusters = [
[i.value - 180.0, j.value] for i, j in zip(_clusters.lon.to(u.deg), _clusters.lat.to(u.deg))
]
clusters = np.stack([_clusters.lon.to(u.deg).value, _clusters.lat.to(u.deg).value + 90.0], axis=1)

# the number of rows in the test dataset
self.rowcnt = self.clustercnt * self.samplespercluster
Expand Down

0 comments on commit d7dea40

Please sign in to comment.