radiasoft / rslaser_old

Integrated modeling of CPA crystal-based laser amplifiers
Apache License 2.0
1 stars 1 forks source link

Fix #136: Refactor propagation #140

Closed gurhar1133 closed 1 year ago

gurhar1133 commented 1 year ago

Refactored CrystalSlice propagation. Different propagation methods are now private and invoked by calling .propagate(pulse, prop_type) using dictionary dispatch eg below

def propagate(self, laser_pulse, prop_type):
   return PKDict(         
        attenuate=self._propagate_attenuate,
        placeholder=self._propagate_placeholder,
        abcd_lct=self._propagate_abcd_lct,
        n0n2_lct=self._propagate_n0n2_lct,
        n0n2_srw=self._propagate_n0n2_srw,
        default=super().propagate,
    )[prop_type](laser_pulse)

Now any new propagation method can be written as a private method and then called by propagate through a new entry into the PKDict