def plot_even_odd_lc(self, ax=None, nbin=None): nbin = nbin or self.nbin res = rarr(self.result) period, zero_epoch, duration = res.trf_period, res.trf_zero_epoch, res.trf_duration if duration >= (0.25/24.): hdur = array([-0.5,0.5]) * duration else: hdur = array([-1.,1.]) duration = 0.5 for time,flux_o in ((self.time_even,self.flux_even), (self.time_odd,self.flux_odd)): phase = fold(time, period, zero_epoch, shift=0.5, normalize=False) - 0.5*period flux_m = self.transit_model(self._pv_trf, time) bpd,bfd,bed = uf.bin(phase, flux_o, nbin) bpm,bfm,bem = uf.bin(phase, flux_m, nbin) pmask = abs(bpd) < 1.5*duration omask = pmask & isfinite(bfd) mmask = pmask & isfinite(bfm) ax[0].plot(bpd[omask], bfd[omask], marker='o') ax[1].plot(bpm[mmask], bfm[mmask], marker='o') [a.axvline(0, alpha=0.25, ls='--', lw=1) for a in ax] [[a.axvline(hd, alpha=0.25, ls='-', lw=1) for hd in hdur] for a in ax] setp(ax,xlim=3*hdur, xlabel='Phase [d]', ylim=(0.9998*nanmin(bfd[pmask]), 1.0002*nanmax(bfd[pmask]))) setp(ax[0], ylabel='Normalised flux') setp(ax[1].get_yticklabels(), visible=False)
def plot_even_odd_lc(self, ax=None, nbin=None): nbin = nbin or self.nbin res = rarr(self.result) period, zero_epoch, duration = res.trf_period, res.trf_zero_epoch, res.trf_duration hdur = array([-0.5, 0.5]) * duration for time, flux_o in ((self.time_even, self.flux_even), (self.time_odd, self.flux_odd)): phase = fold(time, period, zero_epoch, shift=0.5, normalize=False) - 0.5 * period flux_m = self.transit_model(self._pv_trf, time) bpd, bfd, bed = uf.bin(phase, flux_o, nbin) bpm, bfm, bem = uf.bin(phase, flux_m, nbin) pmask = abs(bpd) < 1.5 * duration omask = pmask & isfinite(bfd) mmask = pmask & isfinite(bfm) ax[0].plot(bpd[omask], bfd[omask], marker='o') ax[1].plot(bpm[mmask], bfm[mmask], marker='o') [a.axvline(0, alpha=0.25, ls='--', lw=1) for a in ax] [[a.axvline(hd, alpha=0.25, ls='-', lw=1) for hd in hdur] for a in ax] setp(ax, xlim=3 * hdur, xlabel='Phase [d]', ylim=(0.9998 * nanmin(bfd[pmask]), 1.0002 * nanmax(bfd[pmask]))) setp(ax[0], ylabel='Normalised flux') setp(ax[1].get_yticklabels(), visible=False)
def plot_lc(self, ax=None, nbin=None): nbin = nbin or self.nbin r = rarr(self.result) period, t0, trdur = self._rbls['bls_period'], self._rbls[ 'bls_zero_epoch'], self._rbls[ 'bls_duration'] #r.trf_period, r.trf_zero_epoch, r.trf_duration phase = period * (fold(self.time, period, t0, shift=0.5) - 0.5) bp, bfo, beo = uf.bin(phase, self.flux, nbin) bp, bfm, bem = uf.bin(phase, self.transit_model(self._pv_trf), nbin) mo, mm = isfinite(bfo), isfinite(bfm) ax.plot(bp[mo], bfo[mo], '.') ax.plot(bp[mm], bfm[mm], 'k--', drawstyle='steps-mid') if self._rvar: flux_s = self.sine_model([self._rvar['sine_amplitude']], 2 * period, t0) bp, bf, be = uf.bin(phase, flux_s, nbin) ax.plot(bp, bf, 'k:', drawstyle='steps-mid') setp(ax, xlim=bp[[0, -1]], xlabel='Phase [d]', ylabel='Normalised flux') setp(ax.get_yticklabels(), visible=False) ax.get_yaxis().get_major_formatter().set_useOffset(False)
def plot_fit_and_eo(self, ax=None, nbin=None): nbin = nbin or self.nbin res = rarr(self.result) period, zero_epoch, duration = res.trf_period, res.trf_zero_epoch, res.trf_duration if duration >= (0.25/24.): hdur = 24*duration*array([-0.5,0.5]) else: hdur = 24*array([-0.25,0.25]) duration = 0.5 self.plot_transit_fit(ax[0]) for time,flux_o in ((self.time_even,self.flux_even), (self.time_odd,self.flux_odd)): phase = 24*(fold(time, period, zero_epoch, shift=0.5, normalize=False) - 0.5*period) bpd,bfd,bed = uf.bin(phase, flux_o, nbin) pmask = abs(bpd) < 2*24*duration omask = pmask & isfinite(bfd) ax[1].plot(bpd[omask], bfd[omask], marker='o', ms=2) [a.axvline(0, alpha=0.25, ls='--', lw=1) for a in ax] [[a.axvline(24*hd, alpha=0.25, ls='-', lw=1) for hd in hdur] for a in ax] setp(ax[1],xlim=3*hdur, xlabel='Phase [h]') setp(ax[1].get_yticklabels(), visible=False) ax[1].get_yaxis().get_major_formatter().set_useOffset(False)
def plot_fit_and_eo(self, ax=None, nbin=None): nbin = nbin or self.nbin res = rarr(self.result) period, zero_epoch, duration = res.trf_period, res.trf_zero_epoch, res.trf_duration hdur = 24 * duration * array([-0.5, 0.5]) self.plot_transit_fit(ax[0]) for time, flux_o in ((self.time_even, self.flux_even), (self.time_odd, self.flux_odd)): phase = 24 * ( fold(time, period, zero_epoch, shift=0.5, normalize=False) - 0.5 * period) bpd, bfd, bed = uf.bin(phase, flux_o, nbin) pmask = abs(bpd) < 2 * 24 * duration omask = pmask & isfinite(bfd) ax[1].plot(bpd[omask], bfd[omask], marker='o', ms=2) [a.axvline(0, alpha=0.25, ls='--', lw=1) for a in ax] [[a.axvline(24 * hd, alpha=0.25, ls='-', lw=1) for hd in hdur] for a in ax] setp(ax[1], xlim=3 * hdur, xlabel='Phase [h]') setp(ax[1].get_yticklabels(), visible=False) ax[1].get_yaxis().get_major_formatter().set_useOffset(False)
def plot_lc(self, ax=None, nbin=None): nbin = nbin or self.nbin r = rarr(self.result) period, t0, trdur = self._rbls['bls_period'], self._rbls['bls_zero_epoch'], self._rbls['bls_duration'] #r.trf_period, r.trf_zero_epoch, r.trf_duration phase = period*(fold(self.time, period, t0, shift=0.5) - 0.5) bp,bfo,beo = uf.bin(phase, self.flux, nbin) bp,bfm,bem = uf.bin(phase, self.transit_model(self._pv_trf), nbin) mo,mm = isfinite(bfo), isfinite(bfm) ax.plot(bp[mo], bfo[mo], '.') ax.plot(bp[mm], bfm[mm], 'k--', drawstyle='steps-mid') if self._rvar: flux_s = self.sine_model([self._rvar['sine_amplitude']], 2*period, t0) bp,bf,be = uf.bin(phase, flux_s, nbin) ax.plot(bp, bf, 'k:', drawstyle='steps-mid') setp(ax,xlim=bp[[0,-1]], xlabel='Phase [d]', ylabel='Normalised flux') setp(ax.get_yticklabels(), visible=False) ax.get_yaxis().get_major_formatter().set_useOffset(False)