Skip to content
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

Closed
wants to merge 34 commits into from

Conversation

em-archer
Copy link
Contributor

@em-archer em-archer commented Oct 8, 2024

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.

“Emily and others added 3 commits October 8, 2024 14:18
Adding tests to allow for longitudinal profile from spectral data, whether monotonically increasing or decreasing
Editing LongitudinalProfileFromData to allow for monotonically decreasing spectral data
@em-archer em-archer changed the title [WIP] Adding tests for LongitudinalProfileFromData and trying to fix issue #185 Adding tests for LongitudinalProfileFromData and trying to fix issue #185 Oct 9, 2024
@em-archer em-archer changed the title Adding tests for LongitudinalProfileFromData and trying to fix issue #185 Added tests for LongitudinalProfileFromData and fix for issue #185 Oct 9, 2024
“Emily and others added 2 commits October 10, 2024 13:51
…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.
@em-archer
Copy link
Contributor Author

Also added small update to also accept angular spectrum data (units of s^-1) instead of wavelength data

Copy link
Contributor

@MaxThevenet MaxThevenet left a 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:

  1. 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 argument axis_is_wavelength with default True, and if set to False 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.
  2. 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?

@@ -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
Copy link
Contributor

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.

Suggested change
data = {} # Generate spectral data assuming analytic ft of GaussianLongitudinalProfile
data = {} # Generate spectral data assuming analytic Fourier transform of GaussianLongitudinalProfile

Copy link
Contributor

@MaxThevenet MaxThevenet left a 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.

@MaxThevenet
Copy link
Contributor

Superseded by #309.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants