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

Is this a bug? #29

Merged
merged 1 commit into from
Aug 2, 2015
Merged

Conversation

ocefpaf
Copy link
Collaborator

@ocefpaf ocefpaf commented Aug 1, 2015

Hi @wesleybowman and @efiring,

I was unable to run the latest checkout of Utide. It was crashing here (even though df is not used in the code):

df = freq[2] - freq[1], I believe it should be df = freq[1] - freq[0] (or maybe even better df = np.diff(freq)?).

@@ -65,7 +65,8 @@ def fbndavg(P, freq, cfreq=None, fbands=None):
if fbands is None:
fbands = freq_bands

df = freq[2] - freq[1]
# FIXME: Assigned to but never used.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix it now--just delete the line with the assignment. Same below. And you may delete the commented-out code lines.

@efiring
Copy link
Collaborator

efiring commented Aug 1, 2015

What was the example that was crashing? How were you ending up with only two frequencies? I don't see how anything at all will work under those circumstances, even with the unused line removed. If your periodogram yields only two frequencies, you don't have enough samples to calculate anything at all.

@ocefpaf
Copy link
Collaborator Author

ocefpaf commented Aug 1, 2015

You don't have enough samples to calculate anything at all.

Yep. I was testing corner cases to issue better error messages. Another one that arises is in https://github.com/wesleybowman/UTide/blob/master/utide/robustfit.py#L196 when rsumsq is empty. But that will be in another PR.

@wesleybowman
Copy link
Owner

I wonder if I had that in there as some sort of a self check for myself when writing. I am not sure, since it was so long. Nice catch though.

wesleybowman added a commit that referenced this pull request Aug 2, 2015
@wesleybowman wesleybowman merged commit c31c5cf into wesleybowman:master Aug 2, 2015
@ocefpaf ocefpaf deleted the periodogram_bug branch August 2, 2015 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants