从一个数据的结构中找到外推并将其应用于另一个

finding the extrapolation from the structure of one data and apply it to the other

我有一个过滤器。它们应该具有相同的结构,但它们的缩放比例不同,而且数据来自 top filter shown in the plot is truncated before 10000. I just set the value equal to zero at 10000 but I would like to extrapolated the top filter in order to follow the structure of the bottom filter。链接中提供了与每个过滤器相关的数据。我不知道如何从底部过滤器中的数据中获取尾部结构并将其应用于顶部过滤器,考虑到它们的缩放比例不同。请注意,我需要使用上面板过滤器,因为我的其他过滤器已相应校准。

我可以使用 interp1d 获得下部过滤器的插值,但我不知道我应该如何正确地重新调整它以用于顶部过滤器。

from scipy.interpolate import interp1d
from scipy import arange
import numpy as np
u=np.loadtxt('WFI_I.res')
f=interp1d(u[:,0], u[:,1])
x=arange(7050, 12000)
y=f(x)

如果有任何建议或代码,我将不胜感激。

假设您有两个滤波器阵列,y 值为 filter1filter2,x(波长)值为 wave1wave2,则类似这样应该工作(虽然未经测试):

wave_match = 9500  # wavelength for matching
index1 = np.searchsorted(wave1, wave_match)
index2 = np.searchsorted(wave2, wave_match)
match1 = filter1[index1]
match2 = filter2[index2]
scale = match1 / match2

wave12 = np.concatenate([wave1[:index1], wave2[index2:]])
filter12 = np.concatenate([filter1[:index1], scale * filter2[index2:]])