Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plot Modifications / Annotations Test #35

Closed
19 of 25 tasks
cindytsai opened this issue Nov 4, 2021 · 11 comments
Closed
19 of 25 tasks

Plot Modifications / Annotations Test #35

cindytsai opened this issue Nov 4, 2021 · 11 comments
Assignees
Labels
doc Improvements or additions to documentation testrun Test run.

Comments

@cindytsai
Copy link
Collaborator

cindytsai commented Nov 4, 2021

Plot Modifications Test

Cookbook Example

Should Not Put save() and Operation Inside yt.is_root() Clause

  • annotate_streamlines
  • annotate_velocity
  • annotate_line_integral_convolution
  • annotate_particles
  • annotate_quiver
  • annotate_cquiver
  • annotate_magnetic_field

Error Message

Failed at Somewhere Else Other than IOHandlerlibyt

  • annotate_clumps (failed in MPI = 3, succeed in MPI = 1, 4)

Failed at Opening the Saved Figure

@cindytsai cindytsai added the doc Improvements or additions to documentation label Nov 4, 2021
@cindytsai cindytsai self-assigned this Nov 4, 2021
@cindytsai
Copy link
Collaborator Author

cindytsai commented Nov 8, 2021

annotate_contour

  • Test Problem: gamer 3D BlastWave
  • Inline Script:
    import yt
    yt.enable_parallelism()
    def yt_inline():
        ds = yt.frontends.libyt.libytDataset()
        slc = yt.SlicePlot(ds, "x", ("gas", "density"))
        slc.annotate_contour(
              ("gas", "density"),
              ncont=3,
              label=True,
              plot_args={"color":"blue", "linewidths":2},)
        if yt.is_root():
            slc.save()
  • Output
    • Inline-Analysis
      Fig000000006_Slice_x_density
    • Post-Processing: Same as inline.

@cindytsai cindytsai added the testrun Test run. label Nov 8, 2021
@cindytsai cindytsai changed the title Halo Analysis and Isocontour Test Plot Modifications Test Nov 8, 2021
@cindytsai
Copy link
Collaborator Author

cindytsai commented Nov 8, 2021

annotate_marker, annotate_text, annotate_arrow, annotate_timestamp, annotate_scale

  • Test Problem: gamer 3D Blast Wave
  • Inline Script:
    import yt
    yt.enable_parallelism()
    def yt_inline():
        ds = yt.frontends.libyt.libytDataset()
        slc = yt.SlicePlot(ds, "x", ("gas", "density"))
        if yt.is_root():
            slc.annotate_marker((-0.2, -0.2), coord_system="plot", plot_args={"color":"blue", "s":500})
            slc.annotate_text((0.2, 0.2), "3D Blast Wave", coord_system="plot")
            slc.annotate_arrow((0.5, 0.5, 0.5), length=0.06, plot_args={"color": "blue"})
            slc.annotate_scale()
            slc.annotate_timestamp()
            slc.annotate_title("3D Blast Wave")
            slc.annotate_sphere([0.5, 0.5, 0.5], radius=(0.5, "cm"), circle_args={"color":"red"})
            slc.annotate_line((0.3, 0.4), (0.8, 0.9), coord_system="axis")
            slc.save()
  • Output
    Fig000000001_Slice_x_density

@cindytsai
Copy link
Collaborator Author

cindytsai commented Nov 8, 2021

annotate_grids, annotate_ray

  • Test Problem: gamer MHD Vortex
  • Inline Script:
    import yt
    yt.enable_parallelism()
    def yt_inline():
        ds = yt.frontends.libyt.libytDataset()
        sz = yt.ProjectionPlot(ds, "z", ("gamer","Dens"), center="c")
        ray = ds.ray((0.1, 0.2, 0.3), (0.6, 0.7, 0.8))
        if yt.is_root():
            sz.annotate_grids()
            sz.annotate_cell_edges()
            sz.annotate_ray(ray)
            sz.save()
  • Output:
    Fig000000002_Projection_z_Dens

@cindytsai
Copy link
Collaborator Author

cindytsai commented Nov 8, 2021

annotate_streamlines

  • Test Problem: gamer MHD Vortex
  • Inline Script:
    import yt
    yt.enable_parallelism()
    def yt_inline():
        ds = yt.frontends.libyt.libytDataset()
        slc = yt.SlicePlot(ds, "z", ("gas", "density"))
        slc.annotate_streamlines(("gas", "velocity_x"), ("gas", "velocity_y"))
        slc.save()
  • Output:
    • SUCCEED inline-analysis. (MPI = 3, 4)
      Fig000000001_Slice_z_density

@cindytsai
Copy link
Collaborator Author

cindytsai commented Nov 8, 2021

annotate_quiver

  • Test Problem: gamer MHD Vortex
  • Inline Script:
    import yt
    yt.enable_parallelism()
    def yt_inline():
        ds = yt.load("Data_000002")
        sz = yt.ProjectionPlot(ds, "z", ("gamer","Dens"), center="c")
        sz.annotate_quiver(("gas", "velocity_x"), ("gas", "velocity_y"), factor=16, plot_args={"color":"blue"})
        sz.save()
  • Output:
    • SUCCEED in inline-analysis
      Fig000000001_Projection_z_density

@cindytsai
Copy link
Collaborator Author

cindytsai commented Nov 8, 2021

annotate_velocity

  • Test Problem: gamer MHD Vortex
  • Inline Script:
    import yt
    yt.enable_parallelism()
    def yt_inline():
        ds = yt.frontends.libyt.libytDataset()
        slc = yt.SlicePlot(ds, "x", ("gas", "density"))
        slc.annotate_velocity(plot_args={"headwidth":4})
        slc.save()
  • Output:
    • SUCCEED in inline-analysis.
      Fig000000001_Slice_z_density

@cindytsai
Copy link
Collaborator Author

cindytsai commented Nov 8, 2021

annotate_cquiver

  • Test Problem: gamer MHD Vortex
  • Inline Script:
    import yt
    yt.enable_parallelism()
    def yt_inline():
        ds = yt.frontends.libyt.libytDataset()
        slc = yt.OffAxisSlicePlot(ds, [1, 1, 0], [("gas", "density")], center="c")
        slc.annotate_cquiver(("gas", "cutting_plane_velocity_x"), ("gas", "cutting_plane_velocity_y"), factor=10, plot_args={"color":"orange"}, )
        slc.save()
  • Output:
    • SUCCEED in inline-analysis.
      Fig000000001_OffAxisSlice_density

    • Sometimes, there will be some missing figure in the output series of figures.
      SourceFileMissing

@cindytsai
Copy link
Collaborator Author

cindytsai commented Nov 8, 2021

annotate_line_integral_convolution

  • Test Problem: gamer MHD Vortex
  • Inline Script:
    import yt
    yt.enable_parallelism()
    def yt_inline():
        ds = yt.frontends.libyt.libytDataset()
        slc = yt.SlicePlot(ds, "x", ("gas", "density"))
        slc.annotate_line_integral_convolution(("gas", "velocity_x"), ("gas", "velocity_y"), lim=(0.5, 0.65))
        slc.save()
  • Output:
    • SUCCEED in inline-analysis.
      Fig000000001_Slice_z_density

@cindytsai
Copy link
Collaborator Author

cindytsai commented Nov 8, 2021

annotate_clumps

  • Test Problem: gamer MHD Vortex
  • Inline Script:
    import numpy as np
    import yt
    from yt.data_objects.level_sets.api import Clump, find_clumps
    yt.enable_parallelism()
    def yt_inline():
        ds = yt.frontends.libyt.libytDataset()
        data_source = ds.all_data()
    
        c_min = 10 ** np.floor(np.log10(data_source[("gas", "density")]).min())
        c_max = 10 ** np.floor(np.log10(data_source[("gas", "density")]).max() + 1)
    
        master_clump = Clump(data_source, ("gas", "density"))
        master_clump.add_validator("min_cells", 20)
    
        find_clumps(master_clump, c_min, c_max, 2.0)
        leaf_clumps = master_clump.leaves
    
        prj = yt.ProjectionPlot(ds, "z", ("gamer","Dens"), center="c")
        prj.annotate_clumps(leaf_clumps)
    
        # Either having this is clause or not, it will still failed when MPI = 3.
        if yt.is_root():
            prj.save()
  • Output:
    • FAILED in MPI = 3, stuck at somewhere else, other than class IOHandlerlibyt.
    • SUCCEED in MPI = 1, and MPI = 4.
      • Just like the projection plot, because i didn't set a range that actually grab a clump.
        Fig000000001_Projection_z_Dens

@cindytsai
Copy link
Collaborator Author

cindytsai commented Nov 8, 2021

annotate_magnetice_field

  • Test Problem: gamer MHD Vortex
  • Inline Script:
    import yt
    yt.enable_parallelism()
    def yt_inline():
        ds = yt.frontends.libyt.libytDataset()
        sz = yt.ProjectionPlot(ds, "z", ("gamer","Dens"), center="c")
        sz.annotate_magnetic_field(plot_args={"headlength":3})
        sz.save()
  • Output:
    • SUCCEED in inline-analysis.
      Fig000000002_Projection_z_Dens

@cindytsai
Copy link
Collaborator Author

cindytsai commented Nov 8, 2021

annotate_particles

  • Test Problem: gamer Plummer
  • Inline Script:
    import yt
    yt.enable_parallelism()
    def yt_inline_inputArg(field):
        ds = yt.frontends.libyt.libytDataset()
        field = "Cloud0"
        proj = yt.ProjectionPlot(ds, "z", field, center="c")
        proj.annotate_particles((3, "cm"))
        proj.save()
  • Output:
    • Result in MPI size > 1 and MPI size = 1 are different.
    • SUCCEED in MPI > 1.
      Fig000000001_Projection_z_Cloud0
    • SUCCEED if MPI = 1.
      Fig000000001_Projection_z_Cloud0
    • The two figure are slightly different, diff command say they are differ. But I think they are the same.

@cindytsai cindytsai mentioned this issue Dec 5, 2021
11 tasks
@cindytsai cindytsai changed the title Plot Modifications Test Plot Modifications / Annotations Test Dec 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Improvements or additions to documentation testrun Test run.
Projects
None yet
Development

No branches or pull requests

1 participant