Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/devel' into MMSdevel
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-nilsson-irfu committed Jan 31, 2024
2 parents 4f4faac + 632e900 commit 64b8a82
Show file tree
Hide file tree
Showing 164 changed files with 23,930 additions and 37,969 deletions.
2 changes: 1 addition & 1 deletion .github/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.45.0.0</version>
<version>3.45.1.0</version>
</dependency>
<!-- https://github.com/PRBEM/IRBEM -->
<dependency>
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ jobs:

# Install MATLAB (GitHub action provided by MathWorks)
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v1
uses: matlab-actions/setup-matlab@v2
with:
products: MATLAB Parallel_Computing_Toolbox Image_Processing_Toolbox Financial_Toolbox

# Install required runtime lib for Fortan (whamp mex file)
- name: Install libgfortran5
Expand All @@ -40,7 +42,7 @@ jobs:
# Run MATLAB code
- name: Run commands
uses: matlab-actions/run-command@v1
uses: matlab-actions/run-command@v2
with:
command: tests_before_release;

Expand All @@ -67,13 +69,14 @@ jobs:

# Install MATLAB (GitHub action provided by MathWorks)
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v1
uses: matlab-actions/setup-matlab@v2
with:
release: R2020a
products: MATLAB Parallel_Computing_Toolbox Image_Processing_Toolbox Financial_Toolbox

# Run MATLAB code
- name: Run commands
uses: matlab-actions/run-command@v1
uses: matlab-actions/run-command@v2
with:
command: tests_before_release_R2020a;

Expand Down
22 changes: 16 additions & 6 deletions PDist.m
Original file line number Diff line number Diff line change
Expand Up @@ -1702,7 +1702,10 @@
PD.units = obj.units;
end
end
function Out = shift(pdist,v_nf,nMC,orient,sc,varargin)
function varargout = shift(pdist,v_nf,nMC,orient,sc,varargin)
% PDIST.SHIFT Rebin the distribution function to shifted reference
% frame and a rotated coordinate system.
%
%%%This function rebins the distribution function to shifted reference
%%%frame and a rotated coordinate system.
%%% Input:
Expand Down Expand Up @@ -1968,9 +1971,9 @@

end
%%
fd3vn(fd3vn == 0 ) = nan;
% fd3vn(fd3vn == 0 ) = nan; % CN: nan not compatible with other PDist methods
fn = fd3vn./d3vn;
Fn = nan*zeros([1,size(fn)]);
Fn = zeros([1,size(fn)]);
Fn(1,:,:,:) = fn;
PDistn = PDist(pdist.time,Fn,'skymap',En,phn,thn);

Expand All @@ -1980,16 +1983,23 @@
PDistn.ancillary.base = 'sph';
PDistn.units = pdist.units;
PDistn.species = pdist.species;
PDistn.ancillary.energy0 = En;
PDistn.ancillary.energy1 = En;
PDistn.ancillary.esteptable = 0;
PDistn.ancillary.energy = En;
PDistn.ancillary.delta_energy_plus = -En + Eedgesn(2:end);
PDistn.ancillary.delta_energy_minus = En - Eedgesn(1:end-1);

if returndiff

differentials.dV3 = dV3;
differentials.dcosTh = dcosTH;
differentials.dPH = dPH;
differentials.d3v = d3vn;
Out{1} = PDistn;
Out{2} = differentials;
varargout{1} = PDistn;
varargout{2} = differentials;
else
Out{1} = PDistn;
varargout{1} = PDistn;
end

end
Expand Down
25 changes: 25 additions & 0 deletions TSeries.m
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,10 @@ function update_name_units()
function Ts = mtimes(obj1,obj2)
%MTIMES Matrix and scalar multiplication '*'.

if any([isempty(obj1),isempty(obj2)])
Ts = TSeries([]);
return;
end
% Check dimensions of input
if isa(obj1,'TSeries')
sizeData1 = obj1.datasize('dataonly');
Expand Down Expand Up @@ -1466,6 +1470,27 @@ function filt_(TsTmp)
end
end

function Ts = smooth(obj,varargin)
% SMOOTH Smooth TSeries.
%
% Calls matlab function SMOOTH on each data column.
%
% TsOut = smooth(Ts); % uses default smoothing span of 5
% TsOut = smooth(Ts,inp)
% TsOut = Ts.smooth;
%
% See also: TSERIES.FILT, SMOOTH

if isempty(obj), error('Cannot smooth empty TSeries'), end

data = obj.data;
size_data = size(data);
new_data = data*0;
for idata = 1:prod(size_data(2:end))
new_data(:,idata) = smooth(data(:,idata),varargin{:});
end
Ts = obj.clone(obj.time,new_data);
end
function obj = tlim(obj,tint, mode)
%TLIM Returns data within specified time interval
%
Expand Down
Binary file not shown.
89 changes: 56 additions & 33 deletions irf/irf_indentations.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

irfPath = irf('path'); % irf root path

% NOTE: Algorithm will only affect files directly under the listed directories,
% i.e. it will not modify files recursively.
irfDirectories = {...
'.', ... % irf root path
'@dataobj', ...
Expand All @@ -33,43 +35,64 @@
'+model', ...
'+whamp', ...
'irf', ...
['irf' filesep '+irf'], ...
['irf' filesep '+irf' filesep ''], ...
['irf' filesep '+irf' filesep '+cdf'], ...
['irf' filesep '+irf' filesep '+ds'], ...
['irf' filesep '+irf' filesep '+fs'], ...
['irf' filesep '+irf' filesep '+graph'], ...
['irf' filesep '+irf' filesep '+str'], ...
['irf' filesep '+irf' filesep '+utils'], ...
['mission' filesep 'cluster'], ...
['mission' filesep 'cluster' filesep 'c_ri'], ...
['mission' filesep 'cluster' filesep 'caa'], ...
['mission' filesep 'cluster' filesep 'caa' filesep '@ClusterDB'], ...
['mission' filesep 'cluster' filesep 'caa' filesep '@ClusterProc'], ...
['mission' filesep 'mms'], ...
['mission' filesep 'mms' filesep '+mms'], ...
['mission' filesep 'mms' filesep 'cal'], ...
['mission' filesep 'mms' filesep 'mms_testFunctions'], ...
['mission' filesep 'rosetta'], ...
['mission' filesep 'solar_orbiter'], ...
['mission' filesep 'solar_orbiter' filesep '+solo'], ...
['mission' filesep 'solar_orbiter' filesep '+solo' filesep '+BSACT_utils'], ...
['mission' filesep 'solar_orbiter' filesep '+solo' filesep '+adm'], ...
['mission' filesep 'solar_orbiter' filesep '+solo' filesep '+hwzv'], ...
['mission' filesep 'solar_orbiter' filesep '+solo' filesep '+qli'], ...
['mission' filesep 'solar_orbiter' filesep '+solo' filesep '+shk'], ...
['mission' filesep 'solar_orbiter' filesep '+solo' filesep '+sp'], ...
['mission' filesep 'themis'], ...
['mission' filesep 'thor'], ...
['mission' filesep 'thor' filesep 'orbit_coverage'], ...
['mission' filesep 'thor' filesep 'plots'], ...
fullfile('irf' , '+irf'), ...
fullfile('irf' , '+irf', ''), ...
fullfile('irf' , '+irf', '+cdf'), ...
fullfile('irf' , '+irf', '+ds'), ...
fullfile('irf' , '+irf', '+fs'), ...
fullfile('irf' , '+irf', '+graph'), ...
fullfile('irf' , '+irf', '+str'), ...
fullfile('irf' , '+irf', '+utils'), ...
fullfile('mission', 'cluster'), ...
fullfile('mission', 'cluster', 'c_ri'), ...
fullfile('mission', 'cluster', 'caa'), ...
fullfile('mission', 'cluster', 'caa', '@ClusterDB'), ...
fullfile('mission', 'cluster', 'caa', '@ClusterProc'), ...
fullfile('mission', 'mms'), ...
fullfile('mission', 'mms', '+mms'), ...
fullfile('mission', 'mms', 'cal'), ...
fullfile('mission', 'mms', 'mms_testFunctions'), ...
fullfile('mission', 'rosetta'), ...
fullfile('mission', 'solar_orbiter'), ...
fullfile('mission', 'solar_orbiter', '+solo'), ...
fullfile('mission', 'solar_orbiter', '+solo', '+BSACT_utils'), ...
fullfile('mission', 'solar_orbiter', '+solo', '+adm'), ...
fullfile('mission', 'solar_orbiter', '+solo', '+hwzv'), ...
fullfile('mission', 'solar_orbiter', '+solo', '+qli'), ...
fullfile('mission', 'solar_orbiter', '+solo', '+shk'), ...
fullfile('mission', 'solar_orbiter', '+solo', '+sp'), ...
fullfile('mission', 'themis'), ...
fullfile('mission', 'thor'), ...
fullfile('mission', 'thor', 'orbit_coverage'), ...
fullfile('mission', 'thor', 'plots'), ...
fullfile('mission', 'solar_orbiter', 'bicas', 'src', '+bicas'), ...
fullfile('mission', 'solar_orbiter', 'bicas', 'src', '+bicas', '+gamods'), ...
fullfile('mission', 'solar_orbiter', 'bicas', 'src', '+bicas', '+proc'), ...
fullfile('mission', 'solar_orbiter', 'bicas', 'src', '+bicas', '+proc', '+L1L2'), ...
fullfile('mission', 'solar_orbiter', 'bicas', 'src', '+bicas', '+proc', '+L1L2', '+cal'), ...
fullfile('mission', 'solar_orbiter', 'bicas', 'src', '+bicas', '+proc', '+L1L2', '+cal', '+rct'), ...
fullfile('mission', 'solar_orbiter', 'bicas', 'src', '+bicas', '+proc', '+L2L2'), ...
fullfile('mission', 'solar_orbiter', 'bicas', 'src', '+bicas', '+proc', '+L2L3'), ...
fullfile('mission', 'solar_orbiter', 'bicas', 'src', '+bicas', '+swm'), ...
fullfile('mission', 'solar_orbiter', 'bicas', 'src', '+bicas', '+tf'), ...
fullfile('mission', 'solar_orbiter', 'bicas', 'src', '+bicas', '+tools'), ...
fullfile('mission', 'solar_orbiter', 'bicas', 'src', '+bicas', '+tools', '+vbmc'), ...
fullfile('mission', 'solar_orbiter', 'bicas', 'src', '+bicas', '+utils'), ...
fullfile('mission', 'solar_orbiter', 'bicas', 'src', '+bicas', '+vht'), ...
'plots', ...
['plots' filesep 'mms'], ...
['plots' filesep 'solo']
fullfile('plots' , 'mms'), ...
fullfile('plots' , 'solo')
};

for iPath = 1:numel(irfDirectories)
mFiles = dir([irfPath, filesep, irfDirectories{iPath}, filesep, '*.m']);
mDirPath = fullfile(irfPath, filesep, irfDirectories{iPath});

% IMPLEMENTATION NOTE: Code (after assertion) does not fail for non-existing
% directories. Therefore adding assertion to avoid mistakenly specifying
% non-existing directory paths.
assert(logical(exist(mDirPath, 'dir')), 'Directory mDirPath="%s" does not exist.', mDirPath)

mFiles = dir(fullfile(mDirPath, '*.m'));
for iFile = 1:length(mFiles)
theDocument = matlab.desktop.editor.openDocument(fullfile(mFiles(iFile).folder, mFiles(iFile).name));
smartIndentContents(theDocument);
Expand Down
Loading

0 comments on commit 64b8a82

Please sign in to comment.