def lunarDistance(fld, startTime, endTime): """Calculate the distance to the moon at starttime and end time.""" # Position of the target cast into pyeEphem Angle tarRa = pyEphem.hours(fld['ra'].values[0]) tarDec = pyEphem.degrees(fld['dec'].values[0]) # Moon Position moonRa1, moonDec1 = MMTEphem.moonPosition(startTime) moonRa2, moonDec2 = MMTEphem.moonPosition(endTime) dist1 = angSep(moonRa1, moonDec1, tarRa, tarDec) dist2 = angSep(moonRa2, moonDec2, tarRa, tarDec) return (dist1+dist2)/2.0
def lunarDistance(fld, startTime, endTime): """Calculate the distance to the moon at starttime and end time.""" # Position of the target cast into pyeEphem Angle tarRa = pyEphem.hours(fld['ra'].values[0]) tarDec = pyEphem.degrees(fld['dec'].values[0]) # Moon Position moonRa1, moonDec1 = MMTEphem.moonPosition(startTime) moonRa2, moonDec2 = MMTEphem.moonPosition(endTime) dist1 = angSep(moonRa1, moonDec1, tarRa, tarDec) dist2 = angSep(moonRa2, moonDec2, tarRa, tarDec) return (dist1 + dist2) / 2.0