jacobian_apparent_resistivity

PURPOSE ^

jacobian_apparent_resistivity: Jacobian output as apparent resistivity

SYNOPSIS ^

function J =jacobian_apparent_resistivity(fwd_model, img)

DESCRIPTION ^

 jacobian_apparent_resistivity: Jacobian output as apparent resistivity
  This function is a wrapper to the calc_jacobian; however, the output
  is converted into apparent resistivity units, rather than in
  voltage units

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function J =jacobian_apparent_resistivity(fwd_model, img)
0002 % jacobian_apparent_resistivity: Jacobian output as apparent resistivity
0003 %  This function is a wrapper to the calc_jacobian; however, the output
0004 %  is converted into apparent resistivity units, rather than in
0005 %  voltage units
0006 
0007 % $Id: jacobian_apparent_resistivity.m 5112 2015-06-14 13:00:41Z aadler $
0008 
0009 % correct input paralemeters if function was called with only img
0010 if ischar(fwd_model) && strcmp(fwd_model,'UNIT_TEST'); do_unit_test; return; end
0011 
0012 if nargin == 1
0013    img= fwd_model;
0014 elseif  strcmp(getfield(warning('query','EIDORS:DeprecatedInterface'),'state'),'on')
0015    warning('EIDORS:DeprecatedInterface', ...
0016       ['Calling JACOBIAN_APPARENT_RESISTIVITY with two arguments is deprecated and will cause' ...
0017        ' an error in a future version. First argument ignored.']);
0018 end
0019 fwd_model= img.fwd_model;
0020 
0021 if mdl_normalize(fwd_model)
0022    error('Cannot calculate apparent resistivity for normalized difference data');
0023 end
0024 
0025 
0026 solver = @eidors_default;
0027 try
0028    solver = fwd_model.jacobian_apparent_resistivity.jacobian;
0029 end
0030 
0031 img.fwd_model.jacobian = solver;
0032 
0033 J = calc_jacobian(img);
0034 
0035 fctr = get_factor(img);
0036 
0037 J = fctr * J;
0038 
0039 function fctr = get_factor(img)
0040 fctr = NaN;
0041 try
0042    fctr = img.fwd_model.apparent_resistivity_factor;
0043 end
0044 
0045 if ischar(fctr), fctr = str2func(fcstr); end;
0046 
0047 if isa(fctr, 'function_handle')
0048    fctr = feval(fctr, img);
0049 end
0050 
0051 if isnan(fctr)
0052    vh = fwd_solve(mk_image(img.fwd_model,1));
0053    n = length(vh.meas);
0054    fctr = spdiags(1./vh.meas,0,n,n);
0055 end
0056 
0057 
0058 function do_unit_test
0059    disp('TODO: NEED TO WRITE TESTS');

Generated on Fri 30-Dec-2022 19:44:54 by m2html © 2005