Skip to content

Commit

Permalink
use detp.prop and detp.unitinmm if present, similar to mcx #83
Browse files Browse the repository at this point in the history
  • Loading branch information
fangq committed Nov 19, 2019
1 parent a89457a commit 75a4844
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
16 changes: 14 additions & 2 deletions matlab/mmcdettime.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,20 @@

R_C0 = 3.335640951981520e-12; % inverse of light speed in vacuum

if(nargin<=3)
unitinmm=1;
if(nargin<3)
if(isfield(detp,'unitinmm'))
unitinmm=detp.unitinmm;
else
unitinmm=1;
end
end

if(nargin<2)
if(isfield(detp,'prop'))
prop=detp.prop;
else
error('must provide input "prop"');
end
end

medianum=size(prop,1);
Expand Down
16 changes: 14 additions & 2 deletions matlab/mmcdetweight.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,25 @@
% License: GPLv3, see http://mmc.space/ for details
%

if(nargin<2)
if(isfield(detp,'prop'))
prop=detp.prop;
else
error('must provide input "prop"');
end
end

medianum=size(prop,1);
if(medianum<=1)
error('empty property list');
end

if(nargin<=3)
unitinmm=1;
if(nargin<3)
if(isfield(detp,'unitinmm'))
unitinmm=detp.unitinmm;
else
unitinmm=1;
end
end

if(isstruct(detp))
Expand Down
3 changes: 3 additions & 0 deletions mmclab/mmclab.m
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,9 @@
end
newdetp.w0=detp(end,:)'; % last column is the initial packet weight
newdetp.prop=cfg(i).prop;
if(isfield(cfg(i),'unitinmm'))
newdetp.unitinmm=cfg(i).unitinmm;
end
newdetp.data=detp; % enable this line for compatibility
newdetpstruct(i)=newdetp;
else
Expand Down

0 comments on commit 75a4844

Please sign in to comment.