def test_save_from_dir_name_ext(self): plt.plot([1, 1], [2, 2]) # Test without dot in the ext viz.save_from_dir_filename_ext(".", "test", "pdf") self.assertTrue(os.path.exists("test.pdf")) os.remove("test.pdf") # Test with dot in the ext viz.save_from_dir_filename_ext(".", "test", ".pdf") self.assertTrue(os.path.exists("test.pdf")) os.remove("test.pdf")
force_z = sim.gravitationalwaves[radius].get_total_force_z(args.pcut) logger.debug("Computed force") logger.debug("Plotting") fig, (ax1, ax2) = plt.subplots(2, sharex=True) ax1.plot(force_z.time_shifted(-radius)) # We set P = 0 at t - r = 0 ax2.plot(linmom.time_shifted(-radius) - linmom(radius)) ax2.set_xlabel(r"Time - Detector distance $(t - r)$") ax1.set_ylabel(r"$dP^z\slash dt (t)$") ax2.set_ylabel(r"$P^z_{<t}(t)$") add_text_to_corner( f"Det {args.detector_num}", anchor="SW", offset=0.005 ) add_text_to_corner(fr"$r = {radius:.3f}$", anchor="NE", offset=0.005) set_axis_limits_from_args(args) logger.debug("Plotted") logger.debug("Saving") save_from_dir_filename_ext( args.outdir, figname, args.fig_extension, tikz_clean_figure=args.tikz_clean_figure, ) logger.debug("DONE")