Hi Robin, yes you are right the biggest challenge is estimating where the continuum is. IRAF gets you to manually place two points on the “continuum” and then identify all lines between these two points. It then deblends the lines by fitting Gaussian ( or other functions) to the curves and reports the lines center, FWHM and eqw etc. for all the lines.
SPLAT allows a similar process but you can provide a constant for the continuum or fit a polynomial for the background. Again it has several function you can fit with.
I found a paper on DAOSPEC which is an automatic program that has a good discussion on current methods. It also introduced an interesting idea I am trying manually with SPLAT. You estimate (guess) a background and fit the lines. You then subtract the fitted lines which leaves a new local background that provides a new estimate of the local continuum and you then use this etc. etc. iterating as long as you wish.
They also argue that you don’t want the true continuum but the local continuum which will include unmodeled lines who’s average contribution you want to avoid.
The paper is here https://arxiv.org/abs/0811.2932
I think I will use an ensemble of methods to give an error estimate and then pick the one that is as robust as I can make it.
PS Given how lazy I am I shall try tp work out how to download and compile DAOSPEC or similar and let it do the work!