For anyone else that ends up here, this conversation continued via email, but the answer to this question was to add the following lines:
rate_of_change = np.insert(rate_of_change, 0, 0)
data.createTimeSeries('Rate of change', data.Intermediate, None, rate_of_change)
When doing np.diff, you will lose 1 data point, but we want the diff to be on the same time axis as the other channels. So the first line just adds back a data point (value of 0 at index 0). The second line creates a time series object in iolite with the name 'Rate of change' of type Intermediate. The 3rd argument, None, tells iolite to create it using the default time array.
A follow up question was how to adjust selections based on the rate of change. One way you could do that was with a script as follows:
import numpy as np
from scipy.ndimage import gaussian_filter1d
from iolite.QtCore import QDateTime
group_to_adjust = 'Otolith'
channel_to_check = 'Ca43'
ts = data.timeSeries(channel_to_check)
d = gaussian_filter1d(ts.data(), sigma=4)
t = ts.time()
d_diff = np.diff(d)
t_diff = np.diff(t)
rate_of_change = d_diff / t_diff
rate_of_change = np.insert(rate_of_change, 0, 0)
rate_ts = data.createTimeSeries('Rate of change', data.Intermediate, None, rate_of_change)
for sel in data.selectionGroup(group_to_adjust).selections():
min_index = np.argmin(rate_ts.dataForSelection(sel))
time_min = rate_ts.timeForSelection(sel)[min_index]
sel.endTime = QDateTime.fromMSecsSinceEpoch(time_min*1000)