Skip to content

Commit

Permalink
Randomify RA for prepared catalogues.
Browse files Browse the repository at this point in the history
  • Loading branch information
robertdstein committed May 10, 2020
1 parent 5f7c5d2 commit cbcf88c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions flarestack/utils/prepare_catalogue.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import numpy as np
import os
import logging
import random
from flarestack.shared import catalogue_dir
import zlib

cat_dtype = [
("ra_rad", np.float), ("dec_rad", np.float),
Expand All @@ -22,18 +22,21 @@
]


def single_source(sindec):
def single_source(sindec, ra_rad=np.pi):
"""Produces a catalogue with a single source_path.
:param sindec: Sin(Declination) of Source
:param ra: Right Ascension in radians
:return: Source Array
"""
sources = np.empty(
1, dtype=cat_dtype)

ref_time = 55800.4164699

sources['ra_rad'] = np.array([np.deg2rad(180.)])
print(np.deg2rad(180.), ra_rad)

sources['ra_rad'] = np.array([ra_rad])
sources['dec_rad'] = np.arcsin(sindec)
sources['base_weight'] = np.array([1.])
sources['injection_weight_modifier'] = np.array([1.])
Expand Down Expand Up @@ -76,7 +79,10 @@ def make_stacked_source(sindecs):
cat = []

for sindec in sindecs:
cat.append(single_source(sindec))

ra_rad = random.random() ** 2 * np.pi

cat.append(single_source(sindec, ra_rad=ra_rad))

cat = np.array(cat, dtype=cat[0].dtype).T[0]

Expand Down

0 comments on commit cbcf88c

Please sign in to comment.