question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Complex amplitudes in models

See original GitHub issue

EDIT: Workaround at https://github.com/astropy/astropy/issues/8833#issuecomment-595057891

I have a complex problem that I’m hoping someone can help me fix.

I have the first N complex terms of the Fourier transform of a 1D data series, which can be used to reconstruct an approximation of the original data series. I would like to represent the approximation using astropy models, which can be achieved using Euler’s formula and a combination of Sine1D models. However, I need to construct a combination of Sine1D models which have complex amplitudes, like this:

import numpy as np
from astropy.modeling import models

fft = np.array([1323.05768443  +0.j        , -473.6786725 -120.72642364j,
       -199.59351462-147.75512434j,  -11.8952061  -41.34435797j,
         26.37171375 +56.57267775j,  -10.34686085 +61.77508734j,
        -26.32020494 +18.12691033j,    8.11154341  -6.89937425j,
         18.11907541  -6.4711258j ,    9.37345637  +9.30265208j])

N = 100 
n = np.arange(len(fft))
k = np.arange(N)[:, np.newaxis] 

m = models.Sine1D(frequency=k/N, phase=1/4) + models.Sine1D(amplitude=1j, frequency=k/N, phase=0)

Presently this raises an issue because the amplitude is expected to be convertable to a float. Is there any way around that?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
bmorris3commented, Mar 5, 2020
0reactions
perrygreenfieldcommented, Mar 5, 2020

Excellent! Thanks for working around this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Complex Amplitude - an overview | ScienceDirect Topics
(2001) proposed a procedure to determine complex travel times and complex amplitudes from observed transfer functions by means of autoregressive modeling. The ...
Read more >
1.3.3.8. Complex Demodulation Amplitude Plot
Complex Demodulation Amplitude Plot. Purpose: Detect Changing Amplitude in Sinusoidal Models, In the frequency analysis of time series models, a common model is ......
Read more >
Complex Number Arithmetics & modeling sine waves - firmfunda
Complex number is used to model Sine waves of same frequency, varying in amplitude and phase. Complex number is used to model Systems...
Read more >
Coarse-grained modeling of crystals by the amplitude ...
In particular, the coarse-grained PFC model referred to in the literature as amplitude expansion of the PFC, complex amplitude phase-field ...
Read more >
Complex Amplitude-Phase Boltzmann Machines - DeepAI
The model is capable of performing unsupervised learning on the amplitude and relative phase distribution in complex data.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found