radiasoft / rslaser_old

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

initial tests for LaserPulse class #39

Closed bruhwiler closed 2 years ago

bruhwiler commented 2 years ago

See example code here, https://github.com/radiasoft/rslaser/blob/master/examples/notebooks/diagnostics/TransverseEnvelope.ipynb

gurhar1133 commented 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?

bruhwiler commented 2 years ago

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
bruhwiler commented 2 years ago

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.

bruhwiler commented 2 years ago

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.

bruhwiler commented 2 years ago

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.