Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MS_interp #25

Open
andreww opened this issue May 21, 2015 · 0 comments
Open

MS_interp #25

andreww opened this issue May 21, 2015 · 0 comments

Comments

@andreww
Copy link
Owner

andreww commented May 21, 2015

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant