Commit 7a93c8a7 authored by Sudarshan Ghonge's avatar Sudarshan Ghonge
Browse files

Making final changes to moving from pylal to lal. Remove stray comments.

parent e0a25fdf
......@@ -10,8 +10,6 @@ import sys
from lal import GreenwichSiderealTime
from bayeswave_plot import find_trig as ft
import healpy as hp
# from scipy.optimize import curve_fit
#import acor
import sky_area.sky_area_clustering as sky
import getopt
from bayeswave_plot.readbwb import BwbParams
......@@ -30,11 +28,9 @@ class LIGOLWContentHandler(ligolw.LIGOLWContentHandler):
lsctables.use_in(LIGOLWContentHandler)
#import lalinference.fits as lf
import lalinference.io.fits as lf
import lalinference.plot as lp
import lalinference.plot.cmap
#import lalinference.cmap
def parser():
"""
Parser for input (command line and ini file)
......@@ -160,7 +156,6 @@ def make_skyview(directory='.', mdc=None, NSIDE=128, inj=None, npost=5000):
# -- Enter requested directory
os.chdir(directory)
print "Entered", os.getcwd()
#jobname = glob.glob('*bayeswave.run')[0]
try:
jobname = 'bayeswave.run'
......@@ -202,7 +197,6 @@ def make_skyview(directory='.', mdc=None, NSIDE=128, inj=None, npost=5000):
# --------------------------------
# -- Input skymap data
# num, L, ralist, sin_dec, psi, e, dA, dphi, dt = np.loadtxt(filename, unpack=True)
print "Extracting RA/DEC samples"
filename = './chains/' + 'signal_params.dat.0'
data = np.loadtxt(filename, unpack=True,usecols=(0,1,2))
......@@ -230,9 +224,8 @@ def make_skyview(directory='.', mdc=None, NSIDE=128, inj=None, npost=5000):
print "Finding sidereal time"
print "Using GPS {0}".format(gps)
trigtime = float(gps)
#lalgps = LIGOTimeGPS(trigtime)
#sidtime = XLALGreenwichSiderealTime(lalgps, 0)
sidtime = GreenwichSiderealTime(gps, 0)
lalgps = lal.LIGOTimeGPS(trigtime)
sidtime = GreenwichSiderealTime(lalgps, 0)
sidtime = sidtime % (np.pi*2)
# -- Get the injection location
......@@ -275,7 +268,6 @@ def make_skyview(directory='.', mdc=None, NSIDE=128, inj=None, npost=5000):
plt.savefig(plotsDir+'/skymap.png')
plt.close()
# lf.write_sky_map('skymap_{0}.fits'.format(gps), skymap, nest=True, gps_time=trigtime)
# Meg's hacky way to get sky maps to work, because this: lf.write_sky_map('skymap_{0}.fits'.format(gps), skymap, nest=True, gps_time=trigtime) doesn't work anymore
......@@ -346,7 +338,10 @@ if __name__ == "__main__":
NSIDE = opts.nside
injpos = None
# Checl if injection file is present
if opts.inj is not None:
# If present, check if event id is provided
# If yes, proceed. If no, throw error message and exit
if(opts.eventnum is None):
print >> sys.stderr, "Provide event num if giving injfile"
sys.exit()
......@@ -370,9 +365,11 @@ if __name__ == "__main__":
injpos = {'ra': inj.ra, 'dec': inj.dec, 'id': inj.simulation_id}
print(' yes')
# If ra and dec provided manually, use those
if ra is not None and dec is not None:
injpos ={'ra': ra, 'dec':dec, 'id':0}
# If md log provided, use that. Currently,
# there is no scheme to assert exclusivity of injection and mdcs
if mdc is not None:
print 'Reading mdc log {0}'.format(mdc)
try:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment