Skip to content

Commit

Permalink
Python: Envelope Class
Browse files Browse the repository at this point in the history
  • Loading branch information
ax3l committed Feb 21, 2025
1 parent 865cbd1 commit 0d04230
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/particles/CovarianceMatrix.H
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace impactx
using CovarianceMatrix = Map6x6;


/** This struct stores the beam envelope attribues, including the 6x6 beam
/** This struct stores the beam envelope attributes, including the 6x6 beam
* covariance matrix. Used during envelope tracking mode.
*/
struct Envelope
Expand All @@ -50,8 +50,6 @@ namespace impactx
amrex::ParticleReal
beam_intensity () const
{
using namespace amrex::literals;

return m_beam_intensity;
}

Expand All @@ -67,6 +65,14 @@ namespace impactx
return *this;
}

/** Get the 6x6 covariance matrix for envelope tracking
*/
CovarianceMatrix
covariance_matrix () const
{
return m_env;
}

};


Expand Down
7 changes: 7 additions & 0 deletions src/python/distribution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,12 @@ void init_distribution(py::module& m)
"A 6D Waterbag distribution"
);

py::class_<Envelope>(m, "Envelope")
.def(py::init<>())
.def(py::init<CovarianceMatrix, amrex::ParticleReal>())
.def_property("envelope", &Envelope::covariance_matrix, &Envelope::set_covariance_matrix)
.def_property("beam_intensity", &Envelope::beam_intensity, &Envelope::set_beam_intensity)
;

m.def("create_envelope", &initialization::create_envelope);
}

0 comments on commit 0d04230

Please sign in to comment.