def plot_vel_R_co(self, site, cmpt, style = '-^', lw=1, **kwargs): ys = self.Rco.vel_ts(site, cmpt) * 1000 * 365 ts = self.Rco.get_epochs()[1:] plt.plot_date(shift_t(ts), regularize_y(ys), style, lw=lw, ms = 4*lw, **kwargs) return list(ys)
def plot_pred_vel_added(self, site, cmpt, color='red', lw=2, label=None, **kwargs): ys = self.d_added.vel_ts(site, cmpt) * 1000 * 365 ts = self.d_added.get_epochs()[1:] plt.plot_date(shift_t(ts), regularize_y(ys), '-o', lw=lw, ms=2*lw, color=color, label=label, **kwargs) return list(ys)
def plot_cumu_obs_linres(self, site, cmpt, label='obs.', **kwargs): ts, ys = self.obs_reader.get_cumu_obs_linres(site, cmpt) plt.plot_date(shift_t(ts), regularize_y(ys), 'x', ms=5, label=label, **kwargs)
def plot_vel_E_cumu_slip(self, site, cmpt, lw=1, ms = 7, label='E',**kwargs): ys = self.Ecumu.vel_ts(site, cmpt) * 1000 * 365 ts = self.Ecumu.get_epochs()[1:] plt.plot_date(shift_t(ts), regularize_y(ys), '-+', lw=lw, ms=ms, label = label, **kwargs) return list(ys)
def plot_vel_R_aslip(self, site, cmpt, ls='-', marker='o', lw=1, ms=2, label='Raslip',**kwargs): ys = self.Raslip.vel_ts(site, cmpt) * 1000 * 365 ts = self.Raslip.get_epochs()[1:] plt.plot_date(shift_t(ts), regularize_y(ys), ls=ls, marker=marker, lw=lw, ms=ms, label = label, **kwargs) return list(ys)
def plot_vel_R_co(self, site, cmpt, style='-^', lw=1, **kwargs): ys = self.Rco.vel_ts(site, cmpt) * 1000 * 365 ts = self.Rco.get_epochs()[1:] plt.plot_date(shift_t(ts), regularize_y(ys), style, lw=lw, ms=4 * lw, **kwargs) return list(ys)
def plot_E_aslip(self, site, cmpt, lw=1, ms=7, label='Easlip', **kwargs): ys = self.Ecumu.post_ts(site, cmpt) ts = self.Ecumu.get_epochs() plt.plot_date(shift_t(ts), regularize_y(ys), '-+', lw=lw, ms=ms, label=label, **kwargs) return list(ys)
def plot_cf(cf, color): t = cf.data.t y0 = cf.data.y0 plt.plot_date(t+_adj_dates,y0,'x',label=cf.SITE+cf.CMPT, color='light'+color) plt.plot_date(cf.data._t+_adj_dates, cf.data._y0,'x',label=cf.SITE+cf.CMPT, color=color) t1 = min(t) t2 = max(t) ls=200 plot_func(cf.func,linspace(t1,t2,ls)) plt.title(cf.SITE+'-'+cf.CMPT) plt.gcf().autofmt_xdate()
def plot_cumu_disp_pred_from_result_file(self, site, cmpt, color='red', lw=2, **kwargs): ys = self.d_pred_from_result_file.cumu_ts(site, cmpt) ts = self.d_pred_from_result_file.get_epochs() plt.plot_date(shift_t(ts), regularize_y(ys), '--', lw=lw, ms=2 * lw, color=color, **kwargs) return list(ys)
def plot_vel_E_cumu_slip(self, site, cmpt, lw=1, ms=7, label='E', **kwargs): ys = self.Ecumu.vel_ts(site, cmpt) * 1000 * 365 ts = self.Ecumu.get_epochs()[1:] plt.plot_date(shift_t(ts), regularize_y(ys), '-+', lw=lw, ms=ms, label=label, **kwargs) return list(ys)
def plot(site): tp = np.loadtxt('../post_offsets/%s.post' % site) t = dc.asmjd([ii[0] for ii in tp]) + dc.adjust_mjd_for_plot_date e = [ii[1] for ii in tp] n = [ii[2] for ii in tp] u = [ii[3] for ii in tp] plt.plot_date(t, e, 'x-', label='eastings') plt.plot(t, n, 'x-', label='northings') plt.plot(t, u, 'x-', label='upings') plt.gcf().autofmt_xdate() plt.legend(loc=0) plt.title(site) plt.savefig('%s.png' % site) #plt.show() plt.close()
def plot(site): tp = np.loadtxt('../post_offsets/%s.post'%site) t = dc.asmjd([ii[0] for ii in tp]) + dc.adjust_mjd_for_plot_date e = [ii[1] for ii in tp] n = [ii[2] for ii in tp] u = [ii[3] for ii in tp] plt.plot_date(t,e,'x-', label = 'eastings') plt.plot(t,n,'x-', label = 'northings') plt.plot(t,u,'x-', label = 'upings') plt.gcf().autofmt_xdate() plt.legend(loc=0) plt.title(site) plt.savefig('%s.png'%site) #plt.show() plt.close()
def plot_post_disp_pred_from_result_file(self, site, cmpt, color='red', lw=1, **kwargs): ys = self.d_pred_from_result_file.post_ts(site, cmpt) ts = self.d_pred_from_result_file.get_epochs() ys = np.asarray(regularize_y(ys), float) ys = np.nan_to_num(ys) plt.plot_date(shift_t(ts), regularize_y(ys), '--', lw=lw, ms=3 * lw, color=color, **kwargs) return list(ys)
def plot_cumu_disp_pred_added(self, site, cmpt, color='red', lw=2, label=None, **kwargs): ys = self.d_added.cumu_ts(site, cmpt) ts = self.d_added.get_epochs() plt.plot_date(shift_t(ts), regularize_y(ys), '-o', lw=lw, ms=2 * lw, color=color, label=label, **kwargs) return list(ys)
def plot_pred_vel_added(self, site, cmpt, color='red', lw=2, label=None, **kwargs): ys = self.d_added.vel_ts(site, cmpt) * 1000 * 365 ts = self.d_added.get_epochs()[1:] plt.plot_date(shift_t(ts), regularize_y(ys), '-o', lw=lw, ms=2 * lw, color=color, label=label, **kwargs) return list(ys)
def plot_vel_R_aslip(self, site, cmpt, ls='-', marker='o', lw=1, ms=2, label='Raslip', **kwargs): ys = self.Raslip.vel_ts(site, cmpt) * 1000 * 365 ts = self.Raslip.get_epochs()[1:] plt.plot_date(shift_t(ts), regularize_y(ys), ls=ls, marker=marker, lw=lw, ms=ms, label=label, **kwargs) return list(ys)
def plot_post_obs_linres(self, site, cmpt, **kwargs): ts, ys = self.obs_reader.get_post_obs_linres(site, cmpt) ys = np.asarray(regularize_y(ys), float) ys = np.nan_to_num(ys) plt.plot_date(shift_t(ts), regularize_y(ys), 'x', **kwargs) return list(ys)
from datetime import date import numpy as np from pylab import plt import viscojapan as vj site = 'J550' cmpt = 'e' tp = np.loadtxt('../../tsana/pre_fit/linres/{site}.{cmpt}.lres'.\ format(site=site, cmpt=cmpt)) days = tp[:,0] yres = tp[:,2] plt.plot_date(days + vj.adjust_mjd_for_plot_date, yres, 'x') plt.grid('on') plt.axvline(date(2011,3,11),color='r', ls='--') plt.ylim([-1, 7]) plt.xlim((date(2010,1,1), date(2015,1,1))) plt.gcf().autofmt_xdate() plt.ylabel('m') plt.title('%s - %s'%(site, cmpt)) plt.savefig('%s_%s.pdf'%(site, cmpt)) plt.show()
cfs = pickle.load(fid) cf = cfs[0] f1 = cf.get_subf('EXP1') f2 = cf.get_subf('EXP2') days = np.arange(0, 1344) + 55631 y1 = f1(days) y2 = f2(days) reader = vj.tsana.ObservationDatatbaseReader( obs_db='../../tsana/db/~observation.db') t_obs, y_obs = reader.get_post_obs_linres(site, cmpt) plt.plot_date(t_obs + 55631 + vj.adjust_mjd_for_plot_date, y_obs, 'x', color='blue', label='obs.') plt.plot_date(days + vj.adjust_mjd_for_plot_date, y1 + y2, '-', lw=3, color='red', label='EXP1 + EXP2') plt.plot_date(days + vj.adjust_mjd_for_plot_date, y1, '-', color=r'green', label='EXP1') plt.plot_date(days + vj.adjust_mjd_for_plot_date, y2,
def plot_func(func,t): n=0 for f in func.subfcs: plt.plot_date(t+_adj_dates,f(t),marker=None,ls='--',color=cs[n%len(cs)],label=f.tag) n+=1 plt.plot(t+_adj_dates,func(t),color='r',linewidth=2)
def plot_pre(fn): t = read_t(fn) y = read_y(fn) yres = read_yres(fn) plt.plot_date(t+_adj_dates, y, 'x', color='lightblue') plt.plot_date(t+_adj_dates, yres, 'x', color='lightgreen') linsec = read_linsec(fn) ch = cut_ts(t, linsec) plt.plot_date(t[ch]+_adj_dates, y[ch], 'x', color='blue', label='original') plt.plot_date(t[ch]+_adj_dates, yres[ch], 'x', color='green', label='residual') outliers = read_outlier(fn) idx = outlier_index(t, outliers) plt.plot_date(t[idx]+_adj_dates, y[idx], 'o', mec='red', mew=1, mfc='blue') plt.plot_date(t[idx]+_adj_dates, yres[idx], 'o', mec='red', mew=1, mfc='green') for jump in read_jumps(fn): plt.axvline(jump + _adj_dates, color='red', ls='--') plt.grid('on') site = basename(fn).split('.')[0] cmpt = basename(fn).split('.')[1] plt.title('%s - %s'%(site, cmpt))
def plot_pre(fn): t = read_t(fn) y = read_y(fn) yres = read_yres(fn) plt.plot_date(t + _adj_dates, y, 'x', color='lightblue') plt.plot_date(t + _adj_dates, yres, 'x', color='lightgreen') linsec = read_linsec(fn) ch = cut_ts(t, linsec) plt.plot_date(t[ch] + _adj_dates, y[ch], 'x', color='blue', label='original') plt.plot_date(t[ch] + _adj_dates, yres[ch], 'x', color='green', label='residual') outliers = read_outlier(fn) idx = outlier_index(t, outliers) plt.plot_date(t[idx] + _adj_dates, y[idx], 'o', mec='red', mew=1, mfc='blue') plt.plot_date(t[idx] + _adj_dates, yres[idx], 'o', mec='red', mew=1, mfc='green') for jump in read_jumps(fn): plt.axvline(jump + _adj_dates, color='red', ls='--') plt.grid('on') site = basename(fn).split('.')[0] cmpt = basename(fn).split('.')[1] plt.title('%s - %s' % (site, cmpt))
def update_graph(times, nums): plt.xlim(max(times) - datetime.timedelta(minutes=15), max(times)) plt.ylim(0, max(nums) * 1.2) plt.plot_date(times, nums, "ro") plt.draw()