cherab / core

The core source repository for the Cherab project.
https://www.cherab.info
Other
45 stars 24 forks source link

Move the line shape models to a submodule #396

Closed vsnever closed 3 months ago

vsnever commented 1 year ago

The lineshape.pyx already contains almost 1000 lines of code and the implementation of #393 will bloat it even more. I think it's time to create a separate submodule for line shape models. Here is a suggested file structure, with an indication of which class/function goes where. This change will not affect user code.

cherab/core/model/lineshape/
├── beam/
│   ├── __init__.py
│   ├── __init__.pxd
│   ├── base.pyx  <-- BeamLineShapeModel
│   ├── base.pxd
│   ├── mse.pyx  <-- BeamEmissionMultiplet
│   ├── mse.pxd
├── __init__.py
├── __init__.pxd
├── base.pyx  <-- LineShapeModel
├── base.pxd
├── doppler.pyx  <-- doppler_shift, thermal_broadening
├── doppler.pxd
├── gaussian.pyx  <-- add_gaussian_line, GaussianLine
├── gaussian.pxd
├── multiplet.pyx  <-- MultipletLineShape
├── multiplet.pxd
├── stark.pyx  <-- StarkBroadenedLine
├── stark.pxd
├── zeeman.pyx  <-- ZeemanLineShapeModel, ZeemanTriplet, ParametrisedZeemanTriplet, ZeemanMultiplet
├── zeeman.pxd

@jacklovell, @Mateasek, if you agree, I'll make the change along with implementation of #393.

jacklovell commented 1 year ago

I think this is a good idea. We already have some unit tests for lineshapes, but it would be good to check when doing this re-factor that the coverage is sufficient. That would give more confidence that the changes won't break anything.

vsnever commented 3 months ago

Implemented in #400.