def test_plot_horizon_shape(self): ah = SimDir("tests/horizons").horizons[0, 1] shape = ah.shape_outline_at_iteration(0, (None, None, 0)) self.assertTrue( isinstance( viz.plot_horizon(shape)[0], matplotlib.patches.Polygon, ) ) with self.assertRaises(ValueError): viz.plot_horizon_on_plane_at_iteration(ah, 0, "bob") with self.assertRaises(ValueError): viz.plot_horizon_on_plane_at_time(ah, 0, "bob") self.assertTrue( np.allclose( viz.plot_horizon(shape)[0].xy, viz.plot_horizon_on_plane_at_iteration(ah, 0, "xy")[0].xy, ) ) self.assertTrue( np.allclose( viz.plot_horizon(shape)[0].xy, viz.plot_horizon_on_plane_at_time(ah, 0, "xy")[0].xy, ) )
"--estimate-gamma", action="store_true", help=("Estimate the Lorentz factor using qlm_w_momentum. " "Ignore this if you do not know the details"), ) args = kah.get_args(parser) logger = logging.getLogger(__name__) if args.verbose: logging.basicConfig(format="%(asctime)s - %(message)s") logger.setLevel(logging.DEBUG) with SimDir( args.datadir, ignore_symlinks=args.ignore_symlinks, pickle_file=args.pickle_file, ) as sim: sim_hor = sim.horizons logger.debug( f"QuasiLocalMeasures horizons available: {sim_hor.available_qlm_horizons}" ) horizon = sim_hor.get_qlm_horizon(args.qlm_index) time = args.time irr_mass = horizon["irreducible_mass"](time)
logger = logging.getLogger(__name__) if args.verbose: logging.basicConfig(format="%(asctime)s - %(message)s") logger.setLevel(logging.DEBUG) if args.figname is None: horizons = "_".join([str(h) for h in args.horizons]) figname = f"ah_{horizons}_trajectory_{args.type}" else: figname = args.figname logger.debug(f"Figname: {figname}") sim = SimDir(args.datadir) sim_hor = sim.horizons logger.debug( f"Apparent horizons available: {sim_hor.available_apparent_horizons}") # Check that the horizons are available for ah in args.horizons: if ah not in sim_hor.available_apparent_horizons: raise ValueError(f"Apparent horizons {ah} is not available") # Now we prepare the dictionaries with the centroids. The keys are # the horizon numbers and the values are timeseries x_coord = {} y_coord = {} z_coord = {}
# For this script, we need a pickle file, so we are going to provide a # default value parser.set_defaults(pickle_file="sim.pickle") args = kah.get_args(parser) logger = logging.getLogger(__name__) if args.verbose: logging.basicConfig(format="%(asctime)s - %(message)s") logger.setLevel(logging.DEBUG) logger.debug(f"Using pickle file {args.pickle_file}") if os.path.exists(args.pickle_file): logger.debug("Found existing pickle file, it will be overwritten") sim = SimDir(args.datadir, ignore_symlinks=args.ignore_symlinks) logger.debug("Prepared SimDir") # Now an interesting trick: we force the evaluation of all the subcomponents # of SimDir, so that we can save them. To do this, we simply call the # __str__ method. _ = str(sim) logger.debug("Filled SimDir") sim.save(args.pickle_file) logger.debug("DONE")