Open thomased opened 3 years ago
Oh okay. The check we have:
https://github.com/rmaia/pavo/blob/73a30c2d546cd7523972cc28264a7ff3ff385859/R/vismodel.R#L260-L268
Doesn't look at the wl
range of illum
or trans
(partly because we don't require wl
data for them). So when you get to
https://github.com/rmaia/pavo/blob/73a30c2d546cd7523972cc28264a7ff3ff385859/R/vismodel.R#L360
and
https://github.com/rmaia/pavo/blob/73a30c2d546cd7523972cc28264a7ff3ff385859/R/vismodel.R#L371-L374
it's just using the full range of provided data.
Best option seems to be introducing a breaking change and require a wl
column in illum
.
Best I can think of without a breaking: make sure all objects used in vismodel()
have the same length but that doesn't guarantee at all that wl are matching.
Yeah those were my two thoughts. Either require a wl column and add it to the early check, or add a simple length check in (in prepare_userdefined()
?) with a message that we're only taking the first x values if the lengths don't match.
Requiring a wl for illum
and trans
is safest by far, and probably should have been that way from the start (it pre-dates me).
Seems sensible.
How should we go with the breaking change? First add a warning in the next version and then require the wl column?
Yeah that makes sense to me.
Just lost a few hours to this one after some inexplicable results kept cropping up. I haven't spend much time looking for the underlying cause yet, but it looks like some kind of wl-matching issue when a 'long' illuminant is fed into
vismodel()
. The illuminant should just be trimmed to the shortest relevant range (e.g. matching that of the stimulus & vissyst), but it's not (or at least not done correctly), and weird results ensue.