sbird / fake_spectra

A code for generating fake spectra from a cosmological simulation
MIT License
12 stars 13 forks source link

Areporoundofffix #21

Closed sbird closed 5 years ago

sbird commented 5 years ago

A few cleanups and a work-around for the floating point problems we have been experiencing with big simulations.

xiaohanzai commented 5 years ago

Some minor issues: I guess line 201 and 151 in absorption.cpp need to be changed as well, because arr2 is not initialized with <0 values anymore. Or perhaps we could change line 220 and 164? Such that when z > 2 x nbins we skip the calculation for that particle.

sbird commented 5 years ago

Nicely caught, thanks! dr2 < 0 actually could have had fp roundoff from index_table.cpp, line 218 so this is I think the better fix.

xiaohanzai commented 5 years ago

Great! This works very well. Produces the same spectra as the previous implementation. Thanks a lot :-)

sbird commented 5 years ago

Perfect! Thank you for the original code and for contributing!