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

bug in coarse channel frequency calculation #5

Open
lacker opened this issue Jun 25, 2022 · 2 comments
Open

bug in coarse channel frequency calculation #5

lacker opened this issue Jun 25, 2022 · 2 comments
Assignees

Comments

@lacker
Copy link

lacker commented Jun 25, 2022

I think there's a bug in the code that calculates the center frequencies of the coarse channels - https://github.com/UCBerkeleySETI/hpguppi_proc/blob/mark_r/src/hpguppi_coherent_bf_thread.c#L384

Basically this expression:

((n_chan_per_node-1)/2)

since it's an integer expression, it's doing integer arithmetic, which means truncating the result of a division. I think the intention of this code is to calculate the center of the channel and in that case it should be doing a floating point division.

There's a similar issue in the upchannelizing version of the code and perhaps elsewhere.

@david-macmahon
Copy link
Collaborator

Yes, I think nchan_chan_per_node should be cast to a double like this:

((((double)nchan_per_node)-1) / 2)

or change 1 to 1.0 like this:

((nchan_per_node-1.0)/2)

@mruzinda
Copy link
Collaborator

Thanks for pointing this out. I'll make that change in the next commit.

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

3 participants