Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meep change protos with harminv complex #15

Merged
merged 1 commit into from
Mar 31, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions src/bands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,12 @@ int do_harminv(complex<double> *data, int n, double dt,
}

double min_err = harminv_get_freq_error(hd, fsort[0]);
double max_amp = abs(harminv_get_amplitude(hd, 0));
harminv_complex aa;
harminv_get_amplitude(&aa, hd, 0);
double max_amp = abs(aa);
for (int i = 1; i < nf; ++i) {
double amp = abs(harminv_get_amplitude(hd, i));
harminv_get_amplitude(&aa, hd, i);
double amp = abs(aa);
if (max_amp < amp)
max_amp = amp;
}
Expand All @@ -479,7 +482,8 @@ int do_harminv(complex<double> *data, int n, double dt,
for (int i = 0; i < nf; ++i) {
double f = abs(harminv_get_freq(hd, fsort[i]) / dt);
double err = harminv_get_freq_error(hd, fsort[i]);
double amp = abs(harminv_get_amplitude(hd, fsort[i]));
harminv_get_amplitude(&aa, hd, fsort[i]);
double amp = abs(aa);
if (f >= fmin && f <= fmax
&& abs(harminv_get_Q(hd, fsort[i])) > Q_thresh
&& err < err_thresh
Expand Down Expand Up @@ -538,10 +542,13 @@ int do_harminv(complex<double> *data, int n, double dt,
}

for (int i = 0; i < nf; ++i) {
complex<double> freq = harminv_get_omega(hd, fsort[i]) / (2*pi*dt);
harminv_complex oo;
complex<double> freq;
harminv_get_omega(&oo, hd, fsort[i]);
freq = oo / (2*pi*dt);
freq_re[i] = abs(real(freq));
freq_im[i] = imag(freq);
amps[i] = harminv_get_amplitude(hd, fsort[i]);
harminv_get_amplitude(&(amps[i]), hd, fsort[i]);
if (errors)
errors[i] = harminv_get_freq_error(hd, fsort[i]);
}
Expand Down