rudolffu/qsofitmore

Fe_verner09 is not a keyword in the superclass from PyQSOFit

Closed this issue · 3 comments

The latest version fails on a q.Fit call:

q.Fit(name = None, deredden = True, wave_range = None, wave_mask =None,
decomposition_host = True, Mi = None, npca_gal = 5, npca_qso = 20,
Fe_uv_op = True, poly = True, BC = False, MC = True, n_trails = 20,
linefit = True, tie_lambda = True, tie_width = True,
tie_flux_1 = True, tie_flux_2 = True,
save_result = True, plot_fig = True, save_fig = True,
plot_line_name = True, plot_legend = False,
# save_fig_path = figpath,
# save_fits_path = respath,
save_fits_name = None)

with:

File "./qsofitmore/qsofitmore/fitmodule.py", line 839, in Fit
save_fits_name=save_fits_name)
TypeError: Fit() got an unexpected keyword argument 'Fe_verner09'

Looking at the source code, it seems that the problem is the call to the super class of QSOFitNew in fitmodule:

return super().Fit(name=name, nsmooth=nsmooth, and_or_mask=and_or_mask, reject_badpix=reject_badpix,
deredden=deredden, wave_range=wave_range, wave_mask=wave_mask,
decomposition_host=decomposition_host, BC03=BC03, Mi=Mi, npca_gal=npca_gal,
npca_qso=npca_qso, Fe_uv_op=Fe_uv_op, Fe_verner09=Fe_verner09, ...

as super() does not have the keyword Fe_verner09:

inspect.signature(super().Fit) gives

(name=None, nsmooth=1, and_or_mask=True, reject_badpix=True, deredden=True, wave_range=None, wave_mask=None, decomposition_host=True, BC03=False, Mi=None, npca_gal=5, npca_qso=20, Fe_uv_op=True, Fe_flux_range=None, poly=False, BC=False, rej_abs=False, initial_guess=None, MC=True, n_trails=1, linefit=True, tie_lambda=True, tie_width=True, tie_flux_1=True, tie_flux_2=True, save_result=True, plot_fig=True, save_fig=True, plot_line_name=True, plot_legend=True, dustmap_path=None, save_fig_path=None, save_fits_path=None, save_fits_name=None)

Hi, please use the submodule PyQSOFit from qsofitmore, either by cloning the qsofitmore with:

git clone --recursive https://github.com/rudolffu/qsofitmore.git 

or by updating the submodule inside the path of qsofitmore with:

git pull --recurse-submodules
git submodule update --recursive

Alternatively, you may download PyQSOFit from https://github.com/rudolffu/PyQSOFit

That is fixed but now I get:

The dust map is sfd.
Traceback (most recent call last):
File "src/kmpfit.pyx", line 190, in kmpfit.xmpfunc
ValueError: Non-finite parameter from mpfit.c

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "testspec.py", line 134, in
save_fits_name = None)
File "/Users/mjg/Projects/packages/qsofitmore/qsofitmore/fitmodule.py", line 840, in Fit
save_fits_name=save_fits_name)
File "/Users/mjg/Projects/packages/qsofitmore/qsofitmore/PyQSOFit/PyQSOFit.py", line 411, in Fit
self._DoContiFit(self.wave, self.flux, self.err, self.ra, self.dec, self.plateid, self.mjd, self.fiberid)
File "/Users/mjg/Projects/packages/qsofitmore/qsofitmore/fitmodule.py", line 436, in _DoContiFit
conti_fit.fit(params0=pp0)
File "src/kmpfit.pyx", line 774, in kmpfit.Fitter.fit
SystemError: <class 'RuntimeError'> returned a result with an error set

For now, I do not recognize how this error happens. You can try restarting your jupyter kernel / jupyter server and rerun the code. Please let me know if the error continues.