-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added tests for LongitudinalProfileFromData and fix for issue #185 #304
Conversation
Adding tests to allow for longitudinal profile from spectral data, whether monotonically increasing or decreasing
Editing LongitudinalProfileFromData to allow for monotonically decreasing spectral data
for more information, see https://pre-commit.ci
Updated tests for monotonically increasing or decreasing specta
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Wavelength and wavelength axis given different names
for more information, see https://pre-commit.ci
Analytic ft of GaussianLongitudinalProfile needs checking
Analytic spectrum checked in separate script
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
…omega When data["datatype"] = "spectral", data["axis"] can either be wavelength lambda in m or angular frequency omega in s^-1. The user doesn't need to specify, it will automatically detect and convert to wavelength if the latter is passed.
for more information, see https://pre-commit.ci
Also added small update to also accept angular spectrum data (units of s^-1) instead of wavelength data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR! Really great to have more tests, and the option to initialise from file while passing the angular frequency instead of wavelength will be useful, in particular for @Paaaaarth in PR #296. Besides a minor suggestion in the text, I have two comments:
- Determining whether it is wavelength or frequency depending on the value is IMO not very straightforward. Would it be possible to make the user provide specific arguments? The user could provide
datatype = spectral
as before, but there could be one additional argumentaxis_is_wavelength
with defaultTrue
, and if set toFalse
the axis is supposed to be frequency. I think this parameter would appear clearly in the doc and should make it clear to the users. - When converting from axis = frequency to wavelength, shouldn't we also modify the spectrum by multiplying with
$2\pi c / \lambda^2$ or so? Not sure this is done in the current reader, could you check this?
tests/test_laser_profiles.py
Outdated
@@ -234,6 +238,89 @@ def test_longitudinal_profiles(): | |||
print("cep_phase = ", cep_phase_cos) | |||
assert np.abs(cep_phase_cos - cep_phase) / cep_phase < 0.02 | |||
|
|||
# LongitudinalProfileFromData | |||
print("LongitudinalProfileFromData") | |||
data = {} # Generate spectral data assuming analytic ft of GaussianLongitudinalProfile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this correct? Just to make it more explicit.
data = {} # Generate spectral data assuming analytic ft of GaussianLongitudinalProfile | |
data = {} # Generate spectral data assuming analytic Fourier transform of GaussianLongitudinalProfile |
User must now specify axis type (wavelength by default). Also added proper conversion for spectral intensity if axis is omega.
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! See a few comments below, I think that's the last round.
Co-authored-by: Maxence Thévenet <[email protected]>
Co-authored-by: Maxence Thévenet <[email protected]>
Superseded by #309. |
Editing LongitudinalProfileFromData to allow for monotonically decreasing spectral data (fix for #185) and adding relevant tests to test_laser_profiles. Currently no tests exist for LongitudinalProfileFromData, so adding tests for monotonically increasing/decreasing spectral data. Test for temporal data could be added in future.