brain-slam / slam

Surface anaLysis And Modeling
MIT License
13 stars 24 forks source link

1. d. reproduce the matlab results : spectrum #103

Closed alexpron closed 1 year ago

GerardMJuan commented 1 year ago

We adapted the already implemented spangy_spectrum() function in python to compute the spectrum and generate the same figure than in the MATLAB code. Given the differences in curvature obtained with the two different methods, we tried to generate the spectrum with each platform and each curvature, so 4 results in total.

For the SLAM generated curvature:

Python results:

Image

Spectral bands values: [[14.16534226] [ 3.63925997] [ 8.69843902] [10.92130688] [18.3210126 ] [ 6.4831803 ] [ 1.42961411]]

MATLAB results:

Image

14.1653422633940 3.63925996931672 8.69843902396158 10.9213068752227 18.3210125984343 6.48318029617731 1.42974116586035

For the MATLAB generated curvature:

Python results:

Image

[[19.5671609 ] [ 3.51731383] [ 7.27312917] [ 9.11772963] [17.16747587] [ 6.59756399] [ 1.23139443]]

MATLAB results:

Image

19.5671609028560 3.51731382744039 7.27312917408920 9.11772963090126 17.1674758717667 6.59756399360253 1.23209039676390

So, differences depending on the curvature, but results are identical across platforms with the same curvature, with still some small issues in the plot of the frequency that can be ironed out.

GerardMJuan commented 1 year ago

Plotting has been updated to be equal to the MATLAB code. The coefficients obtained are identical across codes (when using the same curvature), but sometimes they have the sign flipped.

Should the plot function be added to the slam plot library? Or is too much of a general plot?

JulienLefevreMars commented 1 year ago

Slam has no dependency to matplotlib but we can add another requirement specific to the spangy module. Thank you @alexpron for the indication.