def plot_transit_fit(self, ax=None): 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 flux_m = self.transit_model(self._pv_trf) phase = 24*(fold(self.time, period, zero_epoch, 0.5, normalize=False) - 0.5*period) sids = argsort(phase) phase = phase[sids] pmask = abs(phase) < 2*24*duration flux_m = flux_m[sids] flux_o = self.flux[sids] ax.plot(phase[pmask], flux_o[pmask], '.') ax.plot(phase[pmask], flux_m[pmask], 'k') ax.text(2.5*hdur[0], flux_m.min(), '{:6.4f}'.format(flux_m.min()), size=7, va='center', bbox=dict(color='white')) ax.axhline(flux_m.min(), alpha=0.25, ls='--') ax.get_yaxis().get_major_formatter().set_useOffset(False) ax.axvline(0, alpha=0.25, ls='--', lw=1) [ax.axvline(hd, alpha=0.25, ls='-', lw=1) for hd in hdur] fluxrange =flux_o.max()-flux_o.min() setp(ax, xlim=3*hdur, ylim=[flux_o.min()-0.05*fluxrange,flux_o.max()+0.05*fluxrange], xlabel='Phase [h]', ylabel='Normalised flux') setp(ax.get_yticklabels(), visible=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_info(self, ax): res = rarr(self.result) t0, p, tdur, tdep, rrat = res.trf_zero_epoch[0], res.trf_period[ 0], res.trf_duration[0], res.trf_depth[0], 0 a = res.trf_semi_major_axis[0] ax.text(0.0, 1.0, 'EPIC {:9d}'.format(self.epic), size=12, weight='bold', va='top', transform=ax.transAxes) ax.text(0.0, 0.83, ('SDE\n' 'Kp\n' 'Zero epoch\n' 'Period [d]\n' 'Transit depth\n' 'Radius ratio\n' 'Transit duration [h]\n' 'Impact parameter\n' 'Stellar density'), size=9, va='top') ax.text(0.97, 0.83, ('{:9.3f}\n{:9.3f}\n{:9.3f}\n{:9.3f}\n{:9.5f}\n' '{:9.4f}\n{:9.3f}\n{:9.3f}\n{:0.3f}').format( res.sde[0], self.Kp, t0, p, tdep, sqrt(tdep), 24 * tdur, res.trf_impact_parameter[0], rho_from_pas(p, a)), size=9, va='top', ha='right') sb.despine(ax=ax, left=True, bottom=True) setp(ax, xticks=[], yticks=[])
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_sde(self, ax=None): r = rarr(self.result) ax.plot(self.bls.period, self.bls.sde, drawstyle='steps-mid') ax.axvline(r.bls_period, alpha=0.25, ls='--', lw=1) setp(ax, xlim=self.bls.period[[-1, 0]], xlabel='Period [d]', ylabel='SDE', ylim=(-3, 11)) [ax.axhline(i, c='k', ls='--', alpha=0.5) for i in [0, 5, 10]] [ ax.text(self.bls.period.max() - 1, i - 0.5, i, va='top', ha='right', size=7) for i in [5, 10] ] ax.text(0.5, 0.88, 'BLS search', va='top', ha='center', size=8, transform=ax.transAxes) setp(ax.get_yticklabels(), visible=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_transit_fit(self, ax=None): 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]) flux_m = self.transit_model(self._pv_trf) phase = 24 * (fold(self.time, period, zero_epoch, 0.5, normalize=False) - 0.5 * period) sids = argsort(phase) phase = phase[sids] pmask = abs(phase) < 2 * 24 * duration flux_m = flux_m[sids] flux_o = self.flux[sids] ax.plot(phase[pmask], flux_o[pmask], '.') ax.plot(phase[pmask], flux_m[pmask], 'k') ax.text(2.5 * hdur[0], flux_m.min(), '{:6.4f}'.format(flux_m.min()), size=7, va='center', bbox=dict(color='white')) ax.axhline(flux_m.min(), alpha=0.25, ls='--') ax.get_yaxis().get_major_formatter().set_useOffset(False) ax.axvline(0, alpha=0.25, ls='--', lw=1) [ax.axvline(hd, alpha=0.25, ls='-', lw=1) for hd in hdur] setp(ax, xlim=3 * hdur, xlabel='Phase [h]', ylabel='Normalised flux') setp(ax.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_sde(self, ax=None): r = rarr(self.result) ax.plot(self.bls.period, self.bls.sde, drawstyle='steps-mid') ax.axvline(r.bls_period, alpha=0.25, ls='--', lw=1) setp(ax,xlim=self.bls.period[[-1,0]], xlabel='Period [d]', ylabel='SDE', ylim=(-3,11)) [ax.axhline(i, c='k', ls='--', alpha=0.5) for i in [0,5,10]] [ax.text(self.bls.period.max()-1,i-0.5,i, va='top', ha='right', size=7) for i in [5,10]] ax.text(0.5, 0.88, 'BLS search', va='top', ha='center', size=8, transform=ax.transAxes) setp(ax.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_info(self, ax): res = rarr(self.result) t0,p,tdur,tdep,rrat = res.trf_zero_epoch[0], res.trf_period[0], res.trf_duration[0], res.trf_depth[0], 0 a = res.trf_semi_major_axis[0] ax.text(0.0,1.0, 'EPIC {:9d}'.format(self.epic), size=12, weight='bold', va='top', transform=ax.transAxes) ax.text(0.0,0.83, ('SDE\n' 'Kp\n' 'Zero epoch\n' 'Period [d]\n' 'Transit depth\n' 'Radius ratio\n' 'Transit duration [h]\n' 'Impact parameter\n' 'Stellar density'), size=9, va='top') ax.text(0.97,0.83, ('{:9.3f}\n{:9.3f}\n{:9.3f}\n{:9.3f}\n{:9.5f}\n' '{:9.4f}\n{:9.3f}\n{:9.3f}\n{:0.3f}').format(res.sde[0],self.Kp,t0,p,tdep,sqrt(tdep),24*tdur, res.trf_impact_parameter[0], rho_from_pas(p,a)), size=9, va='top', ha='right') sb.despine(ax=ax, left=True, bottom=True) setp(ax, xticks=[], yticks=[])