sxs-collaboration / sxs

Python code for manipulating data from the SXS collaboration
MIT License
26 stars 18 forks source link

LVC conversion: spline degree #7

Closed moble closed 4 years ago

moble commented 4 years ago

Moving another part of sxs-collaboration/catalog_tools#3 to this repo, because the code has moved.

@SergeiOssokine said

Currently when we call romspline to generate the spline we use the default value for the degree of the spline, which is 5. However, in LALSuite, when the data is being reconstructed the interpolation is done using cubic splines. Should we also just use cubic splines?

@geoffrey4444 said

I vote for using the same degree as before, not cubic splines, for consistency.

I vote for changing it to use cubic splines. I think there are two very good reasons (and one maybe-good reason) for this:

  1. Cubic splines are significantly faster. In one quick test on the ell<=3 modes of one waveform, it's more than twice as fast to use cubic splines.
  2. That same test actually shows a ~3% reduction in output file size. This actually agrees with what I expected, because higher-degree splines tend to get unstable, so they effectively need more control points — especially when the data are noisy or otherwise not particularly smooth. While the biggest modes are fairly smooth, most of the modes are not. There's a rule of thumb that says cubic splines are typically the best choice for data that's appropriately sampled, and that seems to be true here.
  3. The tolerance doesn't mean what we think it means when comparing splines of different degrees. If tolerance 1e-6 is achieved for the default deg=5, I see no reason to expect that to be true of a waveform reconstructed with deg=3. This may seem to conflict with the previous point, because some data series have more points when using deg=5; but some data series also have fewer points, so there are surely some series that will not be interpolated properly.

It looks like points 1 and 2 are the same or stronger if I go to higher ell values, but I just don't have the time to wait around to completely answer that question.

I've added options to sxs.format.lvc.convert_simulation allowing the user to select the desired spline degree and tolerance. They're currently set to the romspline defaults, but I'm suggesting changing the former to 3, rather than 5.

moble commented 4 years ago

On a vacuum phone call, we agreed that deg=3 is the best choice going forward.

moble commented 4 years ago

Closed by #10