Пример #1
0
def make_plots(all_particles, disk_only, i=0):
    for j, particles in enumerate([all_particles, disk_only]):
        if HAS_PYNBODY:
            temp_particles = particles.copy()
            temp_particles.u = 1 | units.ms**2
            temp = Gadget2()
            temp.gas_particles.add_particles(temp_particles)
            temp.commit_particles()
            pynbody_column_density_plot(
                temp.gas_particles, width=300 | units.kpc, units='m_p cm^-2',
                vmin=17, vmax=23)
            temp.stop()
        else:
            native_plot.gca().set_aspect("equal")
            native_plot.xlim(-150, 150)
            native_plot.ylim(-150, 150)
            plot(particles.x.as_quantity_in(units.kpc),
                 particles.y.as_quantity_in(units.kpc), 'r.')

        native_plot.savefig(
                os.path.join(
                    "plots",
                    "plot_galaxy_merger_{0}_{1:=04}.png".format(
                        "disk" if j else "total", i)
                    )
                )
        native_plot.close()
Пример #2
0
def make_plots(all_particles, disk_only, i=0):
    for j, particles in enumerate([all_particles, disk_only]):
        if HAS_PYNBODY:
            temp_particles = particles.copy()
            temp_particles.u = 1 | units.ms**2
            temp = Gadget2()
            temp.gas_particles.add_particles(temp_particles)
            temp.commit_particles()
            pynbody_column_density_plot(temp.gas_particles,
                                        width=300 | units.kpc,
                                        units='m_p cm^-2',
                                        vmin=17,
                                        vmax=23)
            temp.stop()
        else:
            native_plot.gca().set_aspect("equal")
            native_plot.xlim(-150, 150)
            native_plot.ylim(-150, 150)
            plot(particles.x.as_quantity_in(units.kpc),
                 particles.y.as_quantity_in(units.kpc), 'r.')

        native_plot.savefig(
            os.path.join(
                "plots", "plot_galaxy_merger_{0}_{1:=04}.png".format(
                    "disk" if j else "total", i)))
        native_plot.close()
Пример #3
0
 def evolve_model(self, end_time):
     time_next_plot = self.time_last_plot + self._timestep
     while time_next_plot < end_time:
         super(PlottingHydrodynamics, self).__getattr__("evolve_model")(time_next_plot)
         self._plot_function(self.gas_particles, **self._plot_function_arguments)
         native_plot.savefig(self._next_filename())
         native_plot.close()
         self.time_last_plot = time_next_plot
         time_next_plot = self.time_last_plot + self._timestep
     super(PlottingHydrodynamics, self).__getattr__("evolve_model")(end_time)