Fix FilterAlgorithm.align_trace() method and unit tests
The method FilterAlgorithm.align_trace() pre-processes the trace.data
input
array for subsequent processing by FilterAlgorithm.firfilter() such that the
first input array element corresponds to a time step on which output samples
must fall (as defined in the dictionary step
) minus half the fir window
width. In short, it ensures that output samples fall on desired time steps.
Prior to this fix, it only worked as intended when input trace's starttime fell
on an even time step. A bug became obvious when attempting to filter data from
non-Geomag stations that did not have nice time stamps. This fix addresses that
issue, and also ensures that align_trace()
does what was claimed in its own
original docstrings, which is to handle trailing misalignments as well.
Note: one thing align_trace()
does NOT do is ensure that all needed input
data are available to generate desired outputs. The user is responsible for
providing this, but can use the FilterAlgorithm.get_input_interal() method
to calculate the actual required input starttime and endtime. The method
align_trace()
will trim or pad with NaNs only enough to align time stamps,
and may actually result in firfilter()
output that are NaNs if the input
trace was not adequate.