Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Weird multiplication with a TimeSeries behaviour #4

@nmicauxmellisim

Description

@nmicauxmellisim

While trying to multiply a Periodogram with coefficients y, I get different results :
Context :

gls = GLS(fmin=fmin, fmax=fmax)
pg = gls(x)
z= pg.val * y # y is an np array

I get results fine, but cannot do z.find_peaks() because z is a np array

So I switched to z= pg.val * Timeseries(time=periods, val=y)
This works (return a result), BUT z here is not equal to z in the first test.

I would assume it to gave same result, because of :

    def __mul__(self, other):
        result = self.copy()
        if isinstance(other, Signal):
            if len(self) != len(other):
                raise ValueError("Cannot multiply two Signals with different lengths.")
            result.val = self.val * other.val
        else:
            result.val = self.val * other
        return result

Am I missing something here ?

Some more infos :
pg.val and y are of size (7215,)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions