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

Add Zeeman splitting and Doppler broadening to StarkBroadenedLine and move line shapes models to a dedicated submodule #400

Open
wants to merge 21 commits into
base: development
Choose a base branch
from

Conversation

vsnever
Copy link
Member

@vsnever vsnever commented Jan 19, 2023

This PR fixes #393 and #396.

  1. The line shape models are moved to a separate submodule following the file structure proposed in Move the line shape models to a submodule #396. This change does not affect the user code.
  2. The StarkBroadenedLine now takes into account Zeeman splitting and Doppler broadening and uses ZeemanLineShapeModel as a base class.
    • Following B. Lomanowski et al, Zeeman and Stark effects are considered independently, namely, each Zeeman feature is a Stark-Doppler line. This is a simplification and in the future we may consider switching to multi-parametric fit of the J. Rosato et al model.
    • Unlike B. Lomanowski et al, the convolution of Stark and Doppler profiles is replaced with the weighted sum to speed up computations. Both the weight of the Stark profile and the FWHM of the resulting line shape are fitted to match the exact convolution. See Update StarkBroadenedLine line shape model to take into account Doppler broadening and Zeeman splitting #393 for analysis of accuracy.
    • Unlike B. Lomanowski et al, where the ADAS603 data is used for the Zeeman structure, here the splitting is modelled as a simple triplet. It seems superfluous to consider the exact fine structure of atomic levels in a magnetic field without taking into account the interplay of the Zeeman and Stark effects. In addition, ADAS603 data is not publicly available.

Additional changes:

  • The function add_lorentzian_line() is added by analogy to add_gaussian_line()
  • The method show_supported_transitions() of StarkBroadenedLine and ParametrisedZeemanTriplet has been made a class method, because the user cannot initialise instants without knowing what transitions are supported by these classes.
  • The demo stark_broadening.py now plots in logscale to show the Lorentzian nature of the spectral line wings.
  • The new demo stark_zeeman.py is added to show the Zeeman splitting of the Stark-broadened line. The plasma parameters are set the same as in Figure 2 in B. Lomanowski et al.
  • The test_lineshapes.py is updated to reflect the changes in StarkBroadenedLine.
  • All related documentation is updated.

Copy link
Member

@jacklovell jacklovell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Test coverage, documentation and demo provision is good for the new additions. Since the beam line shape classes have also been moved, could you add some tests for both BeamLineShapeModel and BeamEmissionMultiplet which pass both before and after the refactoring too, just to guarantee no backwards incompatibility?

Comment on lines 223 to 263
STARK_MODEL_COEFFICIENTS_DEFAULT = {
Line(hydrogen, 0, (3, 2)): (3.71e-18, 0.7665, 0.064),
Line(hydrogen, 0, (4, 2)): (8.425e-18, 0.7803, 0.050),
Line(hydrogen, 0, (5, 2)): (1.31e-15, 0.6796, 0.030),
Line(hydrogen, 0, (6, 2)): (3.954e-16, 0.7149, 0.028),
Line(hydrogen, 0, (7, 2)): (6.258e-16, 0.712, 0.029),
Line(hydrogen, 0, (8, 2)): (7.378e-16, 0.7159, 0.032),
Line(hydrogen, 0, (9, 2)): (8.947e-16, 0.7177, 0.033),
Line(hydrogen, 0, (4, 3)): (1.330e-16, 0.7449, 0.045),
Line(hydrogen, 0, (5, 3)): (6.64e-16, 0.7356, 0.044),
Line(hydrogen, 0, (6, 3)): (2.481e-15, 0.7118, 0.016),
Line(hydrogen, 0, (7, 3)): (3.270e-15, 0.7137, 0.029),
Line(hydrogen, 0, (8, 3)): (4.343e-15, 0.7133, 0.032),
Line(hydrogen, 0, (9, 3)): (5.588e-15, 0.7165, 0.033),
Line(deuterium, 0, (3, 2)): (3.71e-18, 0.7665, 0.064),
Line(deuterium, 0, (4, 2)): (8.425e-18, 0.7803, 0.050),
Line(deuterium, 0, (5, 2)): (1.31e-15, 0.6796, 0.030),
Line(deuterium, 0, (6, 2)): (3.954e-16, 0.7149, 0.028),
Line(deuterium, 0, (7, 2)): (6.258e-16, 0.712, 0.029),
Line(deuterium, 0, (8, 2)): (7.378e-16, 0.7159, 0.032),
Line(deuterium, 0, (9, 2)): (8.947e-16, 0.7177, 0.033),
Line(deuterium, 0, (4, 3)): (1.330e-16, 0.7449, 0.045),
Line(deuterium, 0, (5, 3)): (6.64e-16, 0.7356, 0.044),
Line(deuterium, 0, (6, 3)): (2.481e-15, 0.7118, 0.016),
Line(deuterium, 0, (7, 3)): (3.270e-15, 0.7137, 0.029),
Line(deuterium, 0, (8, 3)): (4.343e-15, 0.7133, 0.032),
Line(deuterium, 0, (9, 3)): (5.588e-15, 0.7165, 0.033),
Line(tritium, 0, (3, 2)): (3.71e-18, 0.7665, 0.064),
Line(tritium, 0, (4, 2)): (8.425e-18, 0.7803, 0.050),
Line(tritium, 0, (5, 2)): (1.31e-15, 0.6796, 0.030),
Line(tritium, 0, (6, 2)): (3.954e-16, 0.7149, 0.028),
Line(tritium, 0, (7, 2)): (6.258e-16, 0.712, 0.029),
Line(tritium, 0, (8, 2)): (7.378e-16, 0.7159, 0.032),
Line(tritium, 0, (9, 2)): (8.947e-16, 0.7177, 0.033),
Line(tritium, 0, (4, 3)): (1.330e-16, 0.7449, 0.045),
Line(tritium, 0, (5, 3)): (6.64e-16, 0.7356, 0.044),
Line(tritium, 0, (6, 3)): (2.481e-15, 0.7118, 0.016),
Line(tritium, 0, (7, 3)): (3.270e-15, 0.7137, 0.029),
Line(tritium, 0, (8, 3)): (4.343e-15, 0.7133, 0.032),
Line(tritium, 0, (9, 3)): (5.588e-15, 0.7165, 0.033)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should live in the "default_data" directory that was discussed here.

Copy link
Member Author

@vsnever vsnever Apr 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. The data is moved to cherab/core/atomic/data and new methods zeeman_triplet_parameters and stark_model_coefficients are added to the AtomicData interface. Now the LineShapeModel and BeamLineShapeModel have AtomicData as an additional initialisation argument and as an attribute. This argument is provided by the PlasmaModel or the BeamModel, so user code should not be affected, except perhaps in some tests when the line shape models are used stand-alone.

Please consider the implementation of zeeman_triplet_parameters and stark_model_coefficients in the core AtomicData interface only as a workaround until the refactoring of the atomic data repository is complete. Proper get/add/update functionality for all the default data will be added in #377. I hope, we'll have both this and #377 in the same release.

cherab/core/model/lineshape/zeeman.pyx Outdated Show resolved Hide resolved
@vsnever
Copy link
Member Author

vsnever commented Apr 11, 2023

Looks good. Test coverage, documentation and demo provision is good for the new additions. Since the beam line shape classes have also been moved, could you add some tests for both BeamLineShapeModel and BeamEmissionMultiplet which pass both before and after the refactoring too, just to guarantee no backwards incompatibility?

Thanks for the review. I added a test for BeamEmissionMultiplet. And BeamLineShapeModel is just a virtual class.

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