From a5be100d5bbb03c9454b12df42ac17ae58fc8b24 Mon Sep 17 00:00:00 2001 From: Arianna Formenti Date: Tue, 14 Jan 2025 09:40:05 -0800 Subject: [PATCH] clean up and adjust tolerances --- Examples/Tests/diff_lumi_diag/analysis.py | 9 ++++----- .../ReducedDiags/DifferentialLuminosity2D.cpp | 8 ++------ 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/Examples/Tests/diff_lumi_diag/analysis.py b/Examples/Tests/diff_lumi_diag/analysis.py index 1a810638d69..9cb5bfdc0cf 100755 --- a/Examples/Tests/diff_lumi_diag/analysis.py +++ b/Examples/Tests/diff_lumi_diag/analysis.py @@ -41,7 +41,6 @@ # Extract the 2D differential luminosity from the file series = OpenPMDTimeSeries("./diags/reducedfiles/DifferentialLuminosity2d_beam1_beam2/") d2L_dE1_dE2, info = series.get_field("d2L_dE1_dE2", iteration=80) -E1, E2 = info.E1, info.E2 dE1, dE2 = info.dE1, info.dE2 # Extract test name from path @@ -50,14 +49,14 @@ # Pick tolerance if "leptons" in test_name: - tol1 = 1e-2 - tol2 = 1e-5 + tol1 = 0.02 + tol2 = 0.003 elif "photons" in test_name: # In the photons case, the particles are # initialized from a density distribution ; # tolerance is larger due to lower particle statistics - tol1 = 6e-2 - tol2 = 1e-5 + tol1 = 0.02 + tol2 = 0.003 # Check that the 1D diagnostic and analytical result match error1 = abs(dL_dE_sim - dL_dE_th).max() / abs(dL_dE_th).max() diff --git a/Source/Diagnostics/ReducedDiags/DifferentialLuminosity2D.cpp b/Source/Diagnostics/ReducedDiags/DifferentialLuminosity2D.cpp index 24691c5d32d..b3968b9fb02 100644 --- a/Source/Diagnostics/ReducedDiags/DifferentialLuminosity2D.cpp +++ b/Source/Diagnostics/ReducedDiags/DifferentialLuminosity2D.cpp @@ -357,7 +357,7 @@ void DifferentialLuminosity2D::WriteToFile (int step) const io::Access::CREATE); auto i = series.iterations[step + 1]; // record - auto f_mesh = i.meshes["d2L_dE1_dE2"]; + auto f_mesh = i.meshes["d2L_dE1_dE2"]; // m^-2 eV^-2 f_mesh.setUnitDimension({ {io::UnitDimension::L, -6}, {io::UnitDimension::M, -2}, @@ -368,15 +368,11 @@ void DifferentialLuminosity2D::WriteToFile (int step) const auto data = f_mesh[io::RecordComponent::SCALAR]; // meta data - f_mesh.setAxisLabels({"E2", "E1"}); // ordinate, abscissa + f_mesh.setAxisLabels({"E2", "E1"}); // eV, eV std::vector< double > const& gridGlobalOffset = {m_bin_min_2, m_bin_min_1}; f_mesh.setGridGlobalOffset(gridGlobalOffset); f_mesh.setGridSpacing({m_bin_size_2, m_bin_size_1}); - // to save the data in SI add the following: - // f_mesh.setGridUnitSI(PhysConst::q_e); - // data.setUnitSI(std::pow(PhysConst::q_e, -2)); - data.setPosition({0.5, 0.5}); auto dataset = io::Dataset(