def plot(self,pointsPerBin=10): """ Produce a plot of the light curve, show it. Over-plot 10-point median binning of the light curve. Parameters ---------- pointsPerBin : int, optional (default=10) Integer number of points to accumulate per bin. """ plt.close() times = self.getTimes() meanComparisonStar, meanComparisonStarError = self.calcMeanComparison(ccdGain = self.ccdGain) lightCurve, lightCurveErr = self.computeLightCurve(meanComparisonStar, meanComparisonStarError) binnedTime, binnedFlux, binnedStd = mathMethods.medianBin(times,lightCurve,pointsPerBin) fig = plt.figure(num=None, figsize=(10, 8), facecolor='w',edgecolor='k') fig.canvas.set_window_title('OSCAAR') axis = fig.add_subplot(111) def format_coord(x, y): '''Function to give data value on mouse over plot.''' return 'JD=%1.5f, Flux=%1.4f' % (x, y) axis.format_coord = format_coord axis.errorbar(times,lightCurve,yerr=lightCurveErr,fmt='k.',ecolor='gray') axis.errorbar(binnedTime, binnedFlux, yerr=binnedStd, fmt='rs-', linewidth=2) axis.axvline(ymin=0,ymax=1,x=self.ingress,color='k',ls=':') axis.axvline(ymin=0,ymax=1,x=self.egress,color='k',ls=':') axis.set_title('Light Curve') axis.set_xlabel('Time (JD)') axis.set_ylabel('Relative Flux') plt.ioff() plt.show()
def plotLightCurve(self,pointsPerBin=10,apertureRadiusIndex=0): """ Produce a plot of the light curve, show it. Over-plot 10-point median binning of the light curve. Parameters ---------- pointsPerBin : int, optional (default=10) Integer number of points to accumulate per bin. apertureRadiusIndex : int, optional (default=0) Index of the aperture radius list corresponding to the aperture radius from which to produce the plot. """ binnedTime, binnedFlux, binnedStd = mathMethods.medianBin(self.times,self.lightCurves[apertureRadiusIndex],pointsPerBin) fig = plt.figure(num=None, figsize=(10, 8), facecolor='w',edgecolor='k') fig.canvas.set_window_title('OSCAAR') axis = fig.add_subplot(111) def format_coord(x, y): '''Function to give data value on mouse over plot.''' return 'JD=%1.5f, Flux=%1.4f' % (x, y) axis.format_coord = format_coord axis.errorbar(self.times,self.lightCurves[apertureRadiusIndex],yerr=self.lightCurveErrors[apertureRadiusIndex],fmt='k.',ecolor='gray') axis.errorbar(binnedTime, binnedFlux, yerr=binnedStd, fmt='rs-', linewidth=2) axis.axvline(ymin=0,ymax=1,x=self.ingress,color='k',ls=':') axis.axvline(ymin=0,ymax=1,x=self.egress,color='k',ls=':') axis.set_title(('Light curve for aperture radius %s' % self.apertureRadii[apertureRadiusIndex])) axis.set_xlabel('Time (JD)') axis.set_ylabel('Relative Flux') plt.ioff() plt.show()
def plotLightCurve(self,pointsPerBin=10,apertureRadiusIndex=0): binnedTime, binnedFlux, binnedStd = mathMethods.medianBin(self.times,self.lightCurves[apertureRadiusIndex],pointsPerBin) fig = plt.figure(num=None, figsize=(10, 8), facecolor='w',edgecolor='k') fig.canvas.set_window_title('OSCAAR') axis = fig.add_subplot(111) def format_coord(x, y): '''Function to give data value on mouse over plot.''' return 'JD=%1.5f, Flux=%1.4f' % (x, y) axis.format_coord = format_coord axis.errorbar(self.times,self.lightCurves[apertureRadiusIndex],yerr=self.lightCurveErrors[apertureRadiusIndex],fmt='k.',ecolor='gray') axis.errorbar(binnedTime, binnedFlux, yerr=binnedStd, fmt='rs-', linewidth=2) axis.axvline(ymin=0,ymax=1,x=self.ingress,color='k',ls=':') axis.axvline(ymin=0,ymax=1,x=self.egress,color='k',ls=':') axis.set_title(('Light curve for aperture radius %s' % self.apertureRadii[apertureRadiusIndex])) axis.set_xlabel('Time (JD)') axis.set_ylabel('Relative Flux') plt.ioff() plt.show()
def plotLightCurve_multirad(self,pointsPerBin=10): for apertureRadiusIndex in range(len(self.apertureRadii)): meanTimeInt = int(np.rint(np.mean(self.times))) offsetTimes = self.times - meanTimeInt binnedTime, binnedFlux, binnedStd = mathMethods.medianBin(offsetTimes,self.lightCurves[apertureRadiusIndex],pointsPerBin) fig = plt.figure(num=None, figsize=(10, 8), facecolor='w',edgecolor='k') fig.canvas.set_window_title('OSCAAR') axis = fig.add_subplot(111) def format_coord(x, y): '''Function to give data value on mouse over plot.''' return 'JD=%1.5f, Flux=%1.4f' % (meanTimeInt+x, y) axis.format_coord = format_coord axis.errorbar(offsetTimes,self.lightCurves[apertureRadiusIndex],yerr=self.lightCurveErrors[apertureRadiusIndex],fmt='k.',ecolor='gray') axis.errorbar(binnedTime, binnedFlux, yerr=binnedStd, fmt='rs-', linewidth=2) axis.axvline(ymin=0,ymax=1,x=self.ingress-meanTimeInt,color='k',ls=':') axis.axvline(ymin=0,ymax=1,x=self.egress-meanTimeInt,color='k',ls=':') axis.set_title('Light curve for aperture radius: %s' % self.apertureRadii[apertureRadiusIndex]) axis.set_xlabel(('Time - %i (JD)' % meanTimeInt)) axis.set_ylabel('Relative Flux') plt.ioff() self.plotLightCurve_multirad_output()
def plotLightCurve_multirad(self,pointsPerBin=10): for apertureRadiusIndex in range(len(self.apertureRadii)): meanTimeInt = int(np.rint(np.mean(self.times))) offsetTimes = self.times - meanTimeInt binnedTime, binnedFlux, binnedStd = mathMethods.medianBin(offsetTimes,self.lightCurves[apertureRadiusIndex],pointsPerBin) fig = plt.figure(num=None, figsize=(10, 8), facecolor='w',edgecolor='k') fig.canvas.set_window_title('OSCAAR') axis = fig.add_subplot(111) def format_coord(x, y): '''Function to give data value on mouse over plot.''' return 'JD=%1.5f, Flux=%1.4f' % (meanTimeInt+x, y) axis.format_coord = format_coord axis.errorbar(offsetTimes,self.lightCurves[apertureRadiusIndex],yerr=self.lightCurveErrors[apertureRadiusIndex],fmt='k.',ecolor='gray') axis.errorbar(binnedTime, binnedFlux, yerr=binnedStd, fmt='rs-', linewidth=2) axis.axvline(ymin=0,ymax=1,x=self.ingress-meanTimeInt,color='k',ls=':') axis.axvline(ymin=0,ymax=1,x=self.egress-meanTimeInt,color='k',ls=':') axis.set_title('Light curve for aperture radius: %s' % self.apertureRadii[apertureRadiusIndex]) axis.set_xlabel(('Time - %i (JD)' % meanTimeInt)) axis.set_ylabel('Relative Flux') plt.ioff() plt.show()