This should correct the mean_f calculation for small wavelength ranges for fida_weights_los and fida_weights_mc.
The normalization is moved and rewritten from:
!! normalize mean_f
do ic=1,spec_chords%nchan
do ip=1,inputs%np_wght
do ie=1,inputs%ne_wght
wtot = sum(fweight%weight(:,ie,ip,ic))
if((wtot.gt.0.d0)) then
fweight%mean_f(ie,ip,ic) = fweight%mean_f(ie,ip,ic)/wtot
endif
enddo
enddo
enddo
to:
!! normalize mean_f
wtot = sum(fweight%weight, dim=1) ! sum over wavelengths
where(wtot.gt.0.d0)
fweight%mean_f = fweight%mean_f / wtot
endwhere
which should be identical and might be more elegant (of course I am happy to keep also the old version, since it also has some readibility to it.)
This should correct the mean_f calculation for small wavelength ranges for fida_weights_los and fida_weights_mc.
The normalization is moved and rewritten from: !! normalize mean_f do ic=1,spec_chords%nchan do ip=1,inputs%np_wght do ie=1,inputs%ne_wght wtot = sum(fweight%weight(:,ie,ip,ic)) if((wtot.gt.0.d0)) then fweight%mean_f(ie,ip,ic) = fweight%mean_f(ie,ip,ic)/wtot endif enddo enddo enddo
to: