Closed bruhwiler closed 2 years ago
After a couple small changes to the LaserPulse class, the first test passes. However, the second test fails. Is each slice's lambda0 supposed to be incremented or decremented by d_lambda during instantiation?
Suggested change to make sure the shifted photon energy (aka h*c/wavelength) is getting to the LaserPulseSlice constructor --
for i in range(_k.nslice):
# add the slices; each (slowly) instantiates an SRW wavefront object
self.slice.append(LaserPulseSlice(i, phE=_phE, **_k))
_phE += _de
The code snippet above will result in each LaserPulseSlice instance having a photon energy that is inconsistent with the specified wavelength, that's getting passed in via the **_k argument.
I think all default values should be removed from the LaserPulseSlice constructor and the **_k argument should not be passed through from the LaserPulse() constructor.
This will result in the need for more syntax regarding management of arguments.
Perhaps a couple of tests for LaserPulseSlice() should be implemented before resolving the present issue.
Also, the PKDict object could be required to take photon energy (aka phE) rather than wavelength (aka lambda0). Conversion back and forth between phE and lambda0 should be a shared function.
Given our agreement to use phE as the fundamental quantity and lambda as the derived quantity (which should not be added to the PKDict parameters), the d_lambda variable should also be abandoned and users should be required to specify _chirp.
See example code here, https://github.com/radiasoft/rslaser/blob/master/examples/notebooks/diagnostics/TransverseEnvelope.ipynb