EranOfek / AstroPack

Astronomy & Astrophysics Software Pacakge
Other
16 stars 4 forks source link

Invalid option "omitmissing" in `imUtil.psf.fwhm_fromBank` #443

Closed EastEriq closed 2 months ago

EastEriq commented 2 months ago
Error using median (line 136)
Invalid option. Option must be 'omitnan' or 'includenan'.
Error in imUtil.psf.fwhm_fromBank (line 120)
            Med1 = median(Image,"all","omitmissing");
Error in focusTelInSlave (line 65)
    [InitialFWHM, ~] = imUtil.psf.fwhm_fromBank(Image, 'HalfSize',Args.ImageHalfSize);
EastEriq commented 2 months ago

you're using median(...'omitmissing') in three places in AstroPack, but I don't see that such keyword is supported in 2020b. Is it in any other version?

$ grep -nr omitmissing AstroPack | grep median
AstroPack/matlab/image/+pipeline/+last/SearchMatchedSources.m:556:            DiffAper = median(Obj.MS.Data.(Args.AperPhotPair{1}) - Obj.MS.Data.(Args.AperPhotPair{2}), 1, 'omitmissing');
AstroPack/matlab/image/+imUtil/+psf/fwhm_fromBank.m:120:            Med1 = median(Image,"all","omitmissing");
AstroPack/matlab/image/+imUtil/+psf/fwhm_fromBank.m:123:            Med2 = median(Image(F1), "all", "omitmissing")
EastEriq commented 2 months ago

As I thought, nanflag='omitmissing' is a feature of var, sum, median, std, etc. in 2023a (euler) but not in 2021a nor in 2020b (LAST). That is going to be a problem in LAST, I'm surprised it came out only now. Moreover from a cursive look at some of the help pages, it seems that omitnan (supported by former matlab versions) and omitmissing are synonyms. I don't understand why the new option was introduced then.

EastEriq commented 2 months ago
$ grep -r omitmissing AstroPack/matlab
AstroPack/matlab/image/+imUtil/+psf/fwhm_fromBank.m:            Med1 = median(Image,"all","omitmissing");
AstroPack/matlab/image/+imUtil/+psf/fwhm_fromBank.m:            Med2 = median(Image(F1), "all", "omitmissing");
AstroPack/matlab/image/+imUtil/+psf/fwhm_fromBank.m:            InPar.Variance    = var(Image(F1), [], "all", "omitmissing");
AstroPack/matlab/image/+imUtil/+calib/equaliseLineMean.m:    LineMean=mean(b,Args.StripeDim,"omitmissing");
AstroPack/matlab/image/+imUtil/+calib/equaliseLineMean.m:    LineStd=std(b,1,Args.StripeDim,"omitmissing");
AstroPack/matlab/image/+pipeline/+last/SearchMatchedSources.m:            DiffAper = median(Obj.MS.Data.(Args.AperPhotPair{1}) - Obj.MS.Data.(Args.AperPhotPair{2}), 1, 'omitmissing');
AstroPack/matlab/astro/+timeSeries/+stat/vonNeumannStat.m:    VN = sum(N.*(X(1:end-1,:) - X(2:end,:)).^2, 1, 'omitmissing')./sum( (N-1).*(X - mean(X,1,'omitnan')).^2, 1, 'omitmissing');
AstroPack/matlab/astro/+timeSeries/+filter/runMeanFilter.m:    MoveM  = Args.MoveFun(ResidM, Args.WinSize, 1, "omitmissing", "Endpoints",Args.EndPoint);
AstroPack/matlab/astro/+timeSeries/+filter/runMeanFilter.m:    %MoveC  = Args.MoveFun(ResidM1, Args.WinSize, 1, "omitmissing", "Endpoints",Args.EndPoint);
EranOfek commented 2 months ago

Fixed [dev1 41ff97bc]