Skip to content

utils0.median_abs_deviation(): divide by scale instead of multiply#946

Merged
yunjunz merged 3 commits intoinsarlab:mainfrom
yi-chingchen:main
Jan 13, 2023
Merged

utils0.median_abs_deviation(): divide by scale instead of multiply#946
yunjunz merged 3 commits intoinsarlab:mainfrom
yi-chingchen:main

Conversation

@yi-chingchen
Copy link
Contributor

@yi-chingchen yi-chingchen commented Jan 13, 2023

Description of proposed changes

"scale" parameter in median_abs_deviation function should be a divisor for MAD calculation, namely np.nanmedian(...) / scale, in order to derive a cutoff value comparable to the 1-2-3-sigma rule.

See the discussion on user forum: https://groups.google.com/d/msgid/mintpy/4db4caa8-fb82-403a-a5b4-abef9310cdddn%40googlegroups.com?utm_medium=email&utm_source=footer.

The description of the function, however, hasn't been modified accordingly.

Reminders

  • Pass Pre-commit check (green)
  • Pass Codacy code review (green)
  • Pass Circle CI test (green)
  • Make sure that your code follows our style. Use the other functions/files as a basis.
  • If modifying functionality, describe changes to function behavior and arguments in a comment below the function declaration.

"scale" parameter in median_abs_deviation function should be a divisor for MAD calculation, namely np.nanmedian(...) / scale, in order to derive a cutoff value comparable to the 1-2-3-sigma rule.

See the discussion on user forum: https://groups.google.com/d/msgid/mintpy/4db4caa8-fb82-403a-a5b4-abef9310cdddn%40googlegroups.com?utm_medium=email&utm_source=footer.
@welcome
Copy link

welcome bot commented Jan 13, 2023

💖 Thanks for opening this pull request! Please check out our contributing guidelines. 💖
Keep in mind that all new features should be documented. It helps to write the comments next to the code or below your functions describing all arguments, and return types before writing the code. This will help you think about your code design and usually results in better code.

@yunjunz yunjunz changed the title utils0.py: Correct how MAD should be computed utils0.median_abs_deviation(): divide by scale instead of multiply Jan 13, 2023
@yunjunz yunjunz self-requested a review January 13, 2023 19:33
Copy link
Member

@yunjunz yunjunz left a comment

Choose a reason for hiding this comment

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

Thank you @yi-chingchen for identifying the bug and fixing it! I updated the description in the comment accordingly.

@yunjunz
Copy link
Member

yunjunz commented Jan 13, 2023

The circle CI test fail is due to a bug in the scipy 1.10.0, and will be fixed in the future scipy 1.10.1 release (scipy/scipy#17740). I will go ahead and merge this PR.

@yunjunz yunjunz merged commit e2b6a47 into insarlab:main Jan 13, 2023
@welcome
Copy link

welcome bot commented Jan 13, 2023

🎉 🎉 🎉 Congrats on merging your first pull request! We here at behaviorbot are proud of you! 🎉 🎉 🎉

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.

2 participants