Open cwhitco opened 1 year ago
Thank you for reminding me of this restriction I put in. I did this because there is some code that can't deal with a single-component model. (The resulting astropy model is no longer a multi-component model, so loops "over the components" won't work).
I would like a workaround for this, we also need to consider that
sub_model
and replace it with tabulate
. See #249. (This will still have the same issue though...)As a temporary workaround, you can go head and comment out these lines in the source code of model.py, in Model.__init__()
# if len(features) < 2:
# raise PAHFITModelError(
# "Fewer than 2 features! Single component models are not allowed!"
# )
I did a quick test, and sub_model()
will work for single components if you do this. It's just guess()
and fit()
that will fail, when those functions try to parse the components of the astropy model.
using dev branch version, there is an error when trying to get single component sub_models like the starlight continuum my code, after fitting a spectrum
spec
withmodel
:starspec = model.sub_model(instrumentname=spec.meta['instrument'], redshift=spec.redshift, kind='starlight') PAHFITModelError: Fewer than 2 features! Single component models are no allowed!