From fbb76a31a5adf276b78bf6d0b26cf14a7cb3e18d Mon Sep 17 00:00:00 2001 From: Antoine Merle <antoine.merle@epfl.ch> Date: Fri, 11 Oct 2019 11:29:36 +0200 Subject: [PATCH] Add a warning in case a complex value is found. --- matlab/TCV/gdat_tcv.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/matlab/TCV/gdat_tcv.m b/matlab/TCV/gdat_tcv.m index 165876bd..b60c26ca 100644 --- a/matlab/TCV/gdat_tcv.m +++ b/matlab/TCV/gdat_tcv.m @@ -1731,10 +1731,10 @@ elseif strcmp(mapping_for_tcv.method,'switchcase') psi_max.data = psi_norm.psimag(i_psi); end if ~isempty(psiscatvol.data) && ~ischar(psiscatvol.data) && ~isempty(psi_max.data) && ~ischar(psi_max.data) - for ir=1:length(psiscatvol.dim{2}) - rho2 = max(1.-psiscatvol.data(:,ir)./psi_max.data,0); - rho(ir,:)= sqrt(rho2'); - % rho(ir,:)= sqrt(1.-psiscatvol.data(:,ir)./psi_max.data(:))'; + rho = sqrt(1.-psiscatvol.data./repmat(psi_max.data(:).',[size(psiscatvol.data,1),1])); + if any(imag(rho(:))) + warning('Found complex values when computing rho from psi TS, replacing them with 0'); + rho(imag(rho(:))) = 0; end else if gdat_params.nverbose>=1 && gdat_data.gdat_params.edge==0 -- GitLab