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

Array.fourier() first value incorrectly calculated #262

Open
jobogono opened this issue Nov 28, 2024 · 0 comments
Open

Array.fourier() first value incorrectly calculated #262

jobogono opened this issue Nov 28, 2024 · 0 comments

Comments

@jobogono
Copy link

The first value produced from the built-in macro function Array.fourier() is always incorrect. For each example I've tried, it appears to be incorrectly scaled by 1/sqrt(2). All subsequent values appear to be correct.

I have replicated this issue on numerous data sets (i.e., it is not a result of a specific input). Array.fourier() is implemented as a discrete Hartley transform which has factors of sqrt(2) and cos(pi/4) which I think is likely related.

A simple macro example is given below with graphs showing the input and current output (incorrect) and correct dft output.

new_array = newArray(1.044,1.516,2.197,2.752,3.363,3.947,4.53,5.183,5.725,6.35,7.308,8.405,9.863,11.433,13.447,15.433,17.683,20.113,22.891,26.225,30.516,36.669,45.558,58.225,75.738,99.141,129.183,165.794,208.891,257.155,308.766,361.308,411.516,456.419,493.058,518.711,531.613,530.433,515.961,488.516,450.669,405.197,354.752,302.488,251.586,203.877,161.891,125.766,96.419,73.294,55.822,43.113,34.086,27.613,23.044,19.655,16.947,14.808,12.905,11.363,10.058,9.086,8.433,7.877,7.697,7.488,7.058,6.752,6.419,5.877,5.266,4.655);
fourier_array = Array.fourier(new_array);
Array.print(fourier_array);

imagej example

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