Skip to content

Commit

Permalink
Revert some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
TomDonoghue committed Sep 25, 2018
1 parent 68900dc commit a533ac4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
4 changes: 2 additions & 2 deletions matlab_wrapper/fooof.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
% Run FOOOF fit
fm.fit(freqs, psd, f_range)


% Extract outputs
fooof_results = fooof_unpack_results(fm);
fooof_results = fm.get_results();
fooof_results = fooof_unpack_results(fooof_results);

end
20 changes: 5 additions & 15 deletions matlab_wrapper/fooof_unpack_results.m
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
% Unpack fooof_results python object into matlab struct
function results_out = fooof_unpack_results(fm)
function results_out = fooof_unpack_results(results_in)

results_out = struct();

results_out.fooof_freqs = double(py.array.array('d',fm.freqs));
results_out.power_spectrum = double(py.array.array('d', fm.power_spectrum));
results_out.fooof_spectrum = double(py.array.array('d', fm.fooofed_spectrum_));

%This still gives error in matlab due to the variable starting with undefined character
% results_out.fooof_bg_fit = double(py.array.array('d',fm._bg_fit));
% results_out.fooof_bg_fit = double(py.array.array('d',getfield(fm,'_bg_fit')));

results_in = fm.get_results();

results_out.background_params = ...
double(py.array.array('d', results_in.background_params));

Expand All @@ -27,9 +15,11 @@
results_out.error = ...
double(py.array.array('d', py.numpy.nditer(results_in.error)));

% Note: for reasons unknown, r_squared seems to come out as float...
% Note: r_squared seems to come out as float
% It's not clear why this value is different, but doesn't seem
% to require the type casting like other (code commented below)
results_out.r_squared = results_in.r_squared;
%results_out.r_squared = ...
% double(py.array.array('d', py.numpy.nditer(results_in.r_squared)));

end
end

0 comments on commit a533ac4

Please sign in to comment.