gwpy
gwpy copied to clipboard
TimeSeries.demodulate with exp=True does not produce useful output
I have been trying to replicate the functionality of mixing two signals and use the beating products.
the following code almost does what I need
gwpyTimeSeries.demodulate(mixingFrequency,exp=True, stride=1/gwpyTimeSeries.sample_rate.decompose().value)
The problem (apart from being obscenely slow) is that this leaves the gwpyTimeSeries.data as complex, which breaks down the line, (for example if you want to look at an asd)
Below is a snippet of the lengths I need to go to to get a usable mixer out of this function:
def mixer(gwpyTimeSeries,mixingFrequency):
demod = gwpyTimeSeries.demodulate(mixingFrequency,exp=True, stride=1/gwpyTimeSeries.sample_rate.decompose().value)
data = np.array(demod.data, dtype=np.complex128)
outData = np.zeros(len(data))
for i in range(len(data)):
outData[i] = np.sign(data[i]) * np.abs(data[i])
outputObject = TimeSeries( outData,
channel = gwpyTimeSeries.name,
sample_rate = gwpyTimeSeries.sample_rate,
t0 = gwpyTimeSeries.t0,
)
return outputObject