ratt-ru / QuartiCal

CubiCal, but with greater power.
MIT License
8 stars 4 forks source link

lsm predict requires SPI fit #31

Closed bennahugo closed 2 years ago

bennahugo commented 4 years ago

If the SPI is not present (ie. flat spectrum assumed) the following error is generated:

ValueError: Reference frequency not found for source A171G in /home/hugo/workspace/DEEP2_tagged.lsm.html. Please set reference frequency for either this source or the entire file.

I think it is much better to assume a constant spectrum than not to allow the user to predict from non-SPI-fitted models

bennahugo commented 4 years ago

Case in point is the narrow band subset I'm testing with

JSKenyon commented 4 years ago

I am not totally convinced. I think I put this check in because I don't want things to be assumed. That is how mistakes get made. If users want everything to be flat spectrum, I don't think it is unfair to expect them to put that in the model. I am open to counter-arguments though.

bennahugo commented 4 years ago

It is not standard though @JSKenyon. Unless you explicitly fit for spis with bdsf the the reference frequency is left to None and the spi column just does not exist for any of the components. Therefore a flat spectrum is implicitly assumed by the model. I agree that if at least one component has an spi either the global frequency or the component frequency must be set.

bennahugo commented 4 years ago

You already assume spi = 0 if the attribute does not exist so (nu / refnu) ^ (0.0) == 1 so the reference frequency can be set to anything non-zero - I've updated the commit to reflect this

JSKenyon commented 3 years ago

This will likely be addressed/improved when #113 is in place.

JSKenyon commented 2 years ago

Flat spectrum sources (and models) should now be handled correctly.