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

Fix rounding errors for code generation #34

Merged
merged 2 commits into from
Dec 9, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/code_replica.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ function gen_code_replica!(
most_late_sample_shift = correlator_sample_shifts[1]
total_samples = num_samples + most_early_sample_shift - most_late_sample_shift
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commenting only on variable naming: wouldn't it be better to name the variables latest_sample_shiftand earliest_sample_shift?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this would lead to shorter variable names, but is probably out of scope here, what do you think @zsoerenm?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I support this change. Would you mind to create a pull request @ozmaden ?

gen_code!(
view(code_replica, start_sample:start_sample+total_samples-1),
view(code_replica, start_sample:start_sample + total_samples - 1),
system,
prn,
sampling_frequency,
code_frequency,
start_code_phase + most_late_sample_shift * code_frequency/sampling_frequency
start_code_phase,
most_late_sample_shift
)
code_replica
end
Expand Down
2 changes: 1 addition & 1 deletion test/cn0_estimation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ end
@test @inferred(Tracking.length(cn0_estimator)) == 20
cn0_estimate = @inferred Tracking.estimate_cn0(cn0_estimator, 1ms)

@test cn0_estimate ≈ 45dBHz atol = 1.05dBHz
@test cn0_estimate ≈ 45dBHz atol = 2.05dBHz

end