Fixed rounding bug in pycbc_dtphase#5318
Conversation
|
Thanks @SamInsley! Could you please post plots of the histograms before/after the fix? |
|
@titodalcanton @SamInsley If you make this change, the application should naturally also have a symmetric change, no? e.g. Do you not also need to test the application here https://github.com/gwastro/pycbc/blob/master/pycbc/events/eventmgr_cython.pyx#L39? |
ahnitz
left a comment
There was a problem hiding this comment.
See comment, I suspect you need to test a symmetric change on the application side.
|
@ahnitz Thanks! The fix also did need to be applied to where we bin the triggers. I have done this and it seems to be working fine in my personal tests, but these automatic tests are still failing and I am not sure why. I don't know if I am understanding it right but do these tests check if the stat values are consistent across both versions, as this fix will definitely have an affect on the measured stat values in some parts of the parameter space. |
|
@titodalcanton @ahnitz. I believe this is failing the tests because of |

When binning samples into integer bins, the current code truncates the samples rather than consistently rounding. This results in the 0 bin having approximately twice as many samples as the others. This fix will round the samples to the nearest integer instead.
This is a bug fix regarding how samples are rounded.
This change changes: scientific output
This change: follows style guidelines (See e.g. PEP8), has been proposed using the contribution guidelines
This change will: it should not affect anything other than slightly changing the weights of different bins in the PTA histograms.
Motivation
The current version, truncates samples resulting in all samples between -1 and 1 being sorted into the zero bin. This causes an over-density in this bin compared to others.
Contents
Rather than truncating the samples, this simply rounds the samples to the nearest integer.
Links to any issues or associated PRs
Testing performed
I have recreated the histogram files with this change and it works the same just without this over density at 0.
Additional notes