예제 #1
0
 def plot_ah(self, axes, ah, units=1):
     opt, viz = self.opt, self.viz
     if not opt.ah_show:
         return
     #
     ahoriz, lapse = ah
     ax = viz.axis_of_evil(axes)
     units = viz.canonic_plot_units(units)
     if ahoriz:
         for hx, hy in ahoriz:
             ax.fill(hx / units[0],
                     hy / units[1],
                     color=opt.ah_color,
                     edgecolor=opt.ah_edgecolor,
                     alpha=opt.ah_alpha)
         #
     elif (opt.ah_from_lapse and (lapse is not None)):
         viz.plot_contour(lapse,
                          levels=[self.opt.ah_lapse],
                          colors=opt.ah_edgecolor,
                          alpha=opt.ah_alpha,
                          axes=ax,
                          units=units)
         viz.plot_contourf(lapse,
                           levels=[0, self.opt.ah_lapse],
                           colors=[opt.ah_color],
                           alpha=opt.ah_alpha,
                           axes=ax,
                           units=units)
예제 #2
0
 def plot_mass_frac_contours(self,
                             axes,
                             rho,
                             rho_cont,
                             lw=1,
                             lw_bulk=2,
                             **kwargs):
     opt, viz = self.opt, self.viz
     if opt.mfrac_show and (len(rho_cont[0]) > 0):
         viz.plot_contour(rho,
                          levels=rho_cont[0],
                          colors=opt.mfrac_color,
                          lw=lw,
                          axes=axes,
                          **kwargs)
     #
     if opt.bulk_show and (rho_cont[1] is not None):
         viz.plot_contour(rho,
                          levels=[rho_cont[1]],
                          colors=opt.bulk_color,
                          lw=lw_bulk,
                          axes=axes,
                          **kwargs)
예제 #3
0
# Get iterations and times, and loop
iters = sd.grid.xy.get_iters(func)
times = sd.grid.xy.get_times(func)
i = 0
for it in iters:
    print("Plotting it = ", it)
    plt.clf()
    # Get data
    func_plot = sd.grid.xy.read(func, it, geom=g, order=1)
    if dolog != 0:
        func_plot = func_plot.log10()
    if AMRboundaries != 0:
        rlvl = sd.grid.xy.read(func, it, geom=g, order=1, level_fill=True)
        lvl = -0.5 + np.arange(0, 6)
        # Plot AMR boundaries
        viz.plot_contour(rlvl, levels=lvl)
    # Plot data and titles
    viz.plot_color(func_plot,
                   bar=True,
                   vmin=minf,
                   vmax=maxf,
                   cmap=cm,
                   interpolation='bilinear')
    if dolog != 0:
        plt.title('log10 ' + func)
    else:
        plt.title(func)
    plt.title('t = ' + str(round(times[i], 3)), loc='right')
    # Save fig
    it_label = str(it)
    it_label = (it_label.zfill(6))