Only consider nearby elements for voigt profile calculations in opacities
Closed this issue · 1 comments
We could speed up the code greatly by only checking nearby lines for opacity contributions to each wavelength bin. Currently we check every line in the spectrum for contributions to each opacity bin. This is technically faster than the alternative, because our current implementation of nearby line searching manually checks the entire linelist for things that are close and then calculates opacities with those.
Instead, we should use a more sophisticated line finding algorithm, like a kdtree, to only search lines within some reasonable threshold (which could be calculated or could be set as a constant), or only consider lines within some indices. Index checking could be quick but might be tricky to do right because lines are not uniformly spaced. Either way, it's a problem worth thinking about and should provide dramatic speedups for larger wavelength bounds spectrum generation.