Skip to content

Commit

Permalink
Fixed bugs/typos from function name conversion with KS2005 model
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmoosh committed Nov 25, 2023
1 parent 760d31b commit df3e768
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 23 deletions.
26 changes: 13 additions & 13 deletions PlanetMag.m
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@
if CALC_NEW
disp(['Evaluating ' magModelDescrip ' field model.'])
if contains(magModelDescrip, 'KS2005')
[Bvec, Mdip_nT, Odip_km] = KSMagFldJupiter(rM_km, thetaM, phiM, t_h*3600, ...
SPHOUT);
[Bvec, Mdip_nT, Odip_km] = MagFldJupiterKS2005(rM_km, thetaM, phiM, ...
t_h*3600, SPHOUT);
else
[Bvec, Mdip_nT, Odip_km] = MagFldParent(parentName, rM_km, thetaM, phiM, ...
MagModel, CsheetModel, magPhase_deg, SPHOUT);
Expand Down Expand Up @@ -251,16 +251,16 @@

T_h = 1 ./ BD.f / 3600;
npeaks = length(T_h);
B0vec1 = BD.Bdvec1o * ones(1,npeaks);
B0vec2 = BD.Bdvec2o * ones(1,npeaks);
B0vec3 = BD.Bdvec3o * ones(1,npeaks);
B0vec = [BD.Bdvec1o, BD.Bdvec2o, BD.Bdvec3o];
B1vec1_Re = BD.Bdvec1i;
B1vec1_Im = BD.Bdvec1q;
B1vec2_Re = BD.Bdvec2i;
B1vec2_Im = BD.Bdvec2q;
B1vec3_Re = BD.Bdvec3i;
B1vec3_Im = BD.Bdvec3q;
B0vec1 = BD.BexcVec1o * ones(1,npeaks);
B0vec2 = BD.BexcVec2o * ones(1,npeaks);
B0vec3 = BD.BexcVec3o * ones(1,npeaks);
B0vec = [BD.BexcVec1o, BD.BexcVec2o, BD.BexcVec3o];
B1vec1_Re = BD.BexcVec1i;
B1vec1_Im = BD.BexcVec1q;
B1vec2_Re = BD.BexcVec2i;
B1vec2_Im = BD.BexcVec2q;
B1vec3_Re = BD.BexcVec3i;
B1vec3_Im = BD.BexcVec3q;

Tmax = 500;

Expand Down Expand Up @@ -402,7 +402,7 @@
header = ['period(hr),B0x(nT),B0y(nT),B0z(nT),Bex_Re(nT),Bex_Im(nT),Bey_Re(nT),' ...
'Bey_Im(nT),Bez_Re(nT),Bez_Im(nT)'];
end
outFname = fullfile([outData BeType moonName '_' era '_' fEnd '.txt']);
outFname = fullfile(outData, [BeType moonName '_' era '_' fEnd '.txt']);
spectrumData = [T_h' B0vec1' B0vec2' B0vec3' real(B1vec1)' imag(B1vec1)' ...
real(B1vec2)' imag(B1vec2)' real(B1vec3)' imag(B1vec3)'];
dlmwrite(outFname, header, 'delimiter','');
Expand Down
6 changes: 3 additions & 3 deletions functions/ICAdecomposition.m
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@

cosSyn = X(:, 2*(find(f==fMax))-1);
sinSyn = X(:, 2*(find(f==fMax)));
Bvec1max = BexcVec1o + BexcVec1i(f==fMax)*cosMax + BexcVec1q(f==fMax)*sinMax;
Bvec2max = BexcVec2o + BexcVec2i(f==fMax)*cosMax + BexcVec2q(f==fMax)*sinMax;
Bvec3max = BexcVec3o + BexcVec3i(f==fMax)*cosMax + BexcVec3q(f==fMax)*sinMax;
Bvec1max = BexcVec1o + BexcVec1i(f==fMax)*cosSyn + BexcVec1q(f==fMax)*sinSyn;
Bvec2max = BexcVec2o + BexcVec2i(f==fMax)*cosSyn + BexcVec2q(f==fMax)*sinSyn;
Bvec3max = BexcVec3o + BexcVec3i(f==fMax)*cosSyn + BexcVec3q(f==fMax)*sinSyn;

switch(iMaxComp)
case 1
Expand Down
6 changes: 3 additions & 3 deletions functions/KS2005functions/MagFldJupiterKS2005.m
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@
yS3 = rho .* sin(phi);
zS3 = r .* cos(theta);

% Convert Jupiter System III cartesian to Jupiter-Solar-Orbital coordinates
[xJSO, yJSO, zJSO] = KS_S3CtoJSO(xS3, yS3, zS3, ctimesJROT_S3CtoJSO, AS_CODED);
% Convert Jupiter System III cartesian to Jupiter--Sun--Orbital coordinates
[xJSO, yJSO, zJSO] = KS_S3CtoJSO(xS3, yS3, zS3, ctimes, AS_CODED);
% Get local solar time
localTime_rads = atan2(yJSO, xJSO);

Expand Down Expand Up @@ -188,7 +188,7 @@
Tzz = (dxpdx .* dypdy - dxpdy .* dypdx);

% Get distance from System III equatorial plane to current sheet
zNS3 = KS_csheetStruc(rho, phi, xJSO, yJSO, localTime_rads, stheta, AS_CODED);
zNS3 = KS_CsheetStruc(rho, phi, xJSO, yJSO, localTime_rads, stheta, AS_CODED);
% Get mapped coordinates in current sheet frame
[rmap, pmap, zmap] = xyz2cyl(xp, yp, zS3 - zNS3);

Expand Down
4 changes: 2 additions & 2 deletions functions/coordinates/KS_BJSMtoBS3C.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@

if ~AS_CODED
ets = KS_ctime2et(ctimes);
% See description of JUNO_JSM in KS_S3CtoJSM
rot = cspice_pxform('JUNO_JSM', 'IAU_JUPITER', ets);
% See description of JSM in KS_S3CtoJSM
rot = cspice_pxform('JSM', 'IAU_JUPITER', ets);
else
% Retrieve dipole orientation and initialize rotation matrices
dipole = KS_coeffsJSMdipole();
Expand Down
3 changes: 2 additions & 1 deletion functions/coordinates/KS_S3CtoJSM.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@
% JUNO_JSM frame definition based on the frames kernels required reading and the JSM
% description at
% https://pds.nasa.gov/ds-view/pds/viewProfile.jsp?dsid=GO-J-POS-6-SC-TRAJ-JUP-COORDS-V1.0
% The above was later updated to simply 'JSM' in the project custom frame kernel.
ets = KS_ctime2et(ctimes);
rot = cspice_pxform('IAU_JUPITER', 'JUNO_JSM', ets);
rot = cspice_pxform('IAU_JUPITER', 'JSM', ets);
else
% Retrieve dipole orientation and initialize rotation matrices
dipole = KS_coeffsJSMdipole();
Expand Down
2 changes: 1 addition & 1 deletion functions/coordinates/KS_S3CtoJSO.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

if ~AS_CODED
ets = KS_ctime2et(ctimes);
rot = cspice_pxform('IAU_JUPITER', 'JUNO_JSO', ets);
rot = cspice_pxform('IAU_JUPITER', 'JSO', ets);
else
% Initialize rotation matrices
rot = zeros(3,3, length(ctimes));
Expand Down

0 comments on commit df3e768

Please sign in to comment.