def ComputeArrivalTimeDifference(RA, Dec, GPSTime, Det1Pos, Det2Pos=([0,0,0])):
    """ ComputeArrivalTimeDifference - function to compute the difference in
	arrival times in a GW signal from a source located at celestial coordinates
	(RA,Dec) that reaches the geocenter at GPSTime, between two detectors 
	located at Det1Pos and Det2Pos.

	RA - Right ascension of source [radians].
	Dec - Declination of source [radians].
        GPSTime - GPS time that the GW signal from the source reached the
		  geocenter.
	Det1Pos - (3,) array. Position vector of detector 1.

	################ Optional inputs #####################
	Det2Pos - (3,) array. Position vector of detector 2 (default =
	          ([0,0,0]), the position vector of the geocenter.  In this
		  case, ComputeArrivalTimeDifference returns the time delay of 
		  the source arrival time from the geocenter).

	Returns deltaT - the difference in arrival times between detectors
			 located at Det1Pos and Det2Pos.  This is positive when
			 the signal arrives at Det1Pos *after* Det2Pos, and negative 
			 when the signal arrives at Det1Pos before Det2Pos.

        Sarah Gossan 2012.  Adapted from TimeDelay.c, written by Jolien Creighton, 
	David Chin, Steven Fairhurst, Kipp Cannon, Alexander Dietz, Drew Keppel
	2007. Last updated 02/18/14. """

    # Compute GMST for GPSTime
    GMST = ComputeGMST(GPSTime)

    # Get Greenwich hour angle from RA and GMST
    GHA = GMST - RA

    # Compute unit vector pointing from geocenter to source
    eHatSrc = np.zeros(3)
    eHatSrc[0] = np.cos(Dec)*np.cos(GHA)
    eHatSrc[1] = -np.cos(Dec)*np.sin(GHA)
    eHatSrc[2] = np.sin(Dec)

    # Get position of detector 2 with respect to detector 1
    Det21Pos = Det2Pos - Det1Pos

    # Dot source vector into relative detector position and divide by speed of
    # light to get difference in arrival time
    deltaT = np.dot(eHatSrc,Det21Pos)/c

    return deltaT
ComputeArrivalTimeDifference - function to compute the difference in
	arrival times in a GW signal from a source located at celestial coordinates
	(RA,Dec) that reaches the geocenter at GPSTime, between two detectors 
	located at Det1Pos and Det2Pos.

	RA - Right ascension of source [radians].
	Dec - Declination of source [radians].
        GPSTime - GPS time that the GW signal from the source reached the
		  geocenter.
	Det1Pos - (3,) array. Position vector of detector 1.

	################ Optional inputs #####################
	Det2Pos - (3,) array. Position vector of detector 2 (default =
	          ([0,0,0]), the position vector of the geocenter.  In this
		  case, ComputeArrivalTimeDifference returns the time delay of 
		  the source arrival time from the geocenter).

	Returns deltaT - the difference in arrival times between detectors
			 located at Det1Pos and Det2Pos.  This is positive when
			 the signal arrives at Det1Pos *after* Det2Pos, and negative 
			 when the signal arrives at Det1Pos before Det2Pos.

        Sarah Gossan 2012.  Adapted from TimeDelay.c, written by Jolien Creighton, 
	David Chin, Steven Fairhurst, Kipp Cannon, Alexander Dietz, Drew Keppel
	2007. Last updated 02/18/14.