andreww / MSAT

MATLAB Seismic Anisotropy Toolkit
http://www1.gly.bris.ac.uk/MSAT/
Other
42 stars 29 forks source link

MS_interp #25

Open andreww opened 9 years ago

andreww commented 9 years ago

This seems to be working on my interp branch. However we need an example. And I need to think about tests for ortho.

Example

[Cjd, den] = MS_elasticDB('jd') [Cdi, ~] = MS_elasticDB('di')

CjdR = MS_rot3(Cjd, 30, 30, 0);

% Element wise interpolation [~, ~, CV, ~] = MS_VRH([0.5 0.5], CjdR, 1, Cdi, 1)

% Proper interp Cint = MS_interpolate(CjdR, Cdi, 0.5)

MS_plot(Cdi, den) MS_plot(CjdR, den) MS_plot(Cint, den) MS_plot(CV, den)

Tests

The first (but not the next two) of these work, and I don't know if any should... Look OK using the same as above.

function test_MS_interpolate_values_ortho % Test the interpolator works for different % matrices without rotation [Col, ~] = MS_elasticDB('olivine'); [Cens, ~] = MS_elasticDB('enstatite'); [~,~,Cmix25,~] = MS_VRH([0.25, 0.75], Col, 1.0, Cens, 1.0); [~,~,Cmix50,~] = MS_VRH([0.5, 0.5], Col, 1.0, Cens, 1.0); [~,~,Cmix67,~] = MS_VRH([0.67, 0.33], Col, 1.0, Cens, 1.0); assertElementsAlmostEqual(MS_interpolate(Col, Cens, 0.5), Cmix50); assertElementsAlmostEqual(MS_interpolate(Cens, Col, 0.5), Cmix50); assertElementsAlmostEqual(MS_interpolate(Col, Cens, 0.25), Cmix25); assertElementsAlmostEqual(MS_interpolate(Col, Cens, 0.67), Cmix67); end

function test_MS_interpolate_values_ang_ortho_x % Test the interpolator works for different % matrices with rotation [Col, ~] = MS_elasticDB('olivine'); [Cens, ~] = MS_elasticDB('enstatite'); CensR = MS_rot3(Cens, 45, 0, 0); [~,~,Cmix50,~] = MS_VRH([0.5, 0.5], Col, 1.0, Cens, 1.0); Cmix50R = MS_rot3(Cmix50, 22.5, 0, 0); assertElementsAlmostEqual(MS_interpolate(Col, CensR, 0.5), Cmix50R); assertElementsAlmostEqual(MS_interpolate(CensR, Col, 0.5), Cmix50R); end

function test_MS_interpolate_values_ang_ortho_y % Test the interpolator works for different % matrices with rotation [Col, ~] = MS_elasticDB('olivine'); [Cens, ~] = MS_elasticDB('enstatite'); CensR = MS_rot3(Cens, 0, 45, 0); [~,~,Cmix50,~] = MS_VRH([0.5, 0.5], Col, 1.0, Cens, 1.0); Cmix50R = MS_rot3(Cmix50, 0, 22.5, 0); assertElementsAlmostEqual(MS_interpolate(Col, CensR, 0.5), Cmix50R); %assertElementsAlmostEqual(MS_interpolate(CensR, Col, 0.5), Cmix50R); end

function test_MS_interpolate_values_ang_ortho_z % Test the interpolator works for different % matrices with rotation [Col, ~] = MS_elasticDB('olivine'); [Cens, ~] = MS_elasticDB('enstatite'); CensR = MS_rot3(Cens, 0, 0, 45); [~,~,Cmix50,~] = MS_VRH([0.5, 0.5], Col, 1.0, Cens, 1.0); Cmix50R = MS_rot3(Cmix50, 0, 0, -22.5); assertElementsAlmostEqual(MS_interpolate(Col, CensR, 0.5), Cmix50R); %assertElementsAlmostEqual(MS_interpolate(CensR, Col, 0.5), Cmix50R); end