def sample_theta(): """Sample N=20 theta evolution""" ctrl, p, cdict, pdict = dec_regimes() sim = SimWrap(ctrl, p, cdict, pdict) sim.ctrl.keep_intermediate_values = True sim.show_CFO = False sim.set_all_nodisp() sim.show_TO = False sim.simulate() ax, _ = sim.post_sim_plots(save_TO='', save_CFO='')
def highlited_regimes(): """Highlights the converging vs the drift regime""" compare_fontsize = 15 compare_aspect=12 props = dict(boxstyle='round', facecolor='wheat', alpha=0.5) fontsize_tmp = graphs.FONTSIZE def run_hair_graph(aspect='auto'): hair_kwargs = {'y_label':r'$\theta_i$ $(T_0)$', 'show_clusters':False, 'savename':''} hair_args = ( (ctrl.sample_inter , ctrl.theta_inter, ctrl), hair_kwargs, ) ax = graphs.hair(*hair_args[0], **hair_args[1]) ax.set_aspect(aspect) return ax # DRIFT REGIME graphs.change_fontsize(compare_fontsize) ctrl, p, cdict, pdict = dec_sample_theta() sim = SimWrap(ctrl, p, cdict, pdict) sim.conv_min_slope_samples = 15 sim.ctrl.keep_intermediate_values = True sim.simulate() ax = run_hair_graph(aspect=compare_aspect) ax.text(0.85, 0.9, 'No DC', transform=ax.transAxes, fontsize=compare_fontsize, verticalalignment='top', bbox=props) xmid = 12 xmax = ctrl.steps-13 xmin = 0 ymin, ymax = ax.get_ylim() ya = ymin-0.06 ax.set_xlim([xmin,xmax]) ax.set_ylim([ya,ymax]) fname = 'latex_figures/init_theta' graphs.save(fname) graphs.show() del ax graphs.change_fontsize(15) ax = run_hair_graph() # Draw biarrows ax.annotate('', xy=(xmid, ya), xycoords='data', xytext=(xmin, ya), textcoords='data', arrowprops=dict(arrowstyle="<->")) ax.annotate('', xy=(xmax, ya), xycoords='data', xytext=(xmid, ya), textcoords='data', arrowprops=dict(arrowstyle="<->")) ax.plot([xmid, xmid], [ya-1, ymax], 'k--') # text ax.text(xmid/2, ya, 'Transient', ha='center', va='bottom' ) ax.text((xmax-xmid)/2 +xmid, ya, 'Drifting', ha='center', va='bottom' ) ax.set_xlim([xmin,xmax]) ax.set_ylim([ya-0.03,ymax]) fname = 'latex_figures/highlighted_regimes' graphs.save(fname) graphs.show() # THETA EXAMPLE graphs.change_fontsize(compare_fontsize) ctrl, p, cdict, pdict = dec_sample_theta() ctrl.prop_correction = True sim = SimWrap(ctrl, p, cdict, pdict) sim.conv_min_slope_samples = 15 sim.ctrl.keep_intermediate_values = True sim.show_CFO = False sim.show_TO = False sim.make_cat = False sim.simulate() ax = run_hair_graph(aspect=compare_aspect) ax.text(0.85, 0.9, 'Q = 7', transform=ax.transAxes, fontsize=compare_fontsize, verticalalignment='top', bbox=props) ax.set_xlim([xmin,xmax]) ax.set_ylim([ya,ymax]) fname = 'latex_figures/example_theta' graphs.save(fname) graphs.show() # THETA EXAMPLE with Q=14 graphs.change_fontsize(compare_fontsize) ctrl, p, cdict, pdict = dec_sample_theta() ctrl.prop_correction = True ctrl.pc_b, ctrl.pc_a = lib.hipass_avg(14) sim = SimWrap(ctrl, p, cdict, pdict) sim.conv_min_slope_samples = 15 sim.ctrl.keep_intermediate_values = True sim.show_CFO = False sim.show_TO = False sim.make_cat = False sim.simulate() ax = run_hair_graph(aspect=compare_aspect) ax.text(0.85, 0.9, 'Q = 14', transform=ax.transAxes, fontsize=compare_fontsize, verticalalignment='top', bbox=props) ax.set_xlim([xmin,xmax]) ax.set_ylim([ya,ymax]) fname = 'latex_figures/example_theta_q14' graphs.save(fname) graphs.show() graphs.change_fontsize(fontsize_tmp)