Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6897239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:08:38+00:00 2026-05-27T07:08:38+00:00

If you try the following code segment import numpy as np import numpy.ma as

  • 0

If you try the following code segment

import numpy as np
import numpy.ma as ma

a = np.random.random(100) + 1j*np.random.random(100)
mask = np.ones_like(a, dtype='bool')
mask[0:9] = False
a = ma.masked_array(a, mask)
phase = np.angle(a)

The phase array will not be masked. The angle function will return values for the whole array, even for the masked out values. Am I doing something wrong here or is this the way it should be? If so, why?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T07:08:38+00:00Added an answer on May 27, 2026 at 7:08 am

    Had a quick look at the numpy source, and it might be a bug/not implemented yet.

    It’s listed as a “missing feature (work in progress)” on the numpy.ma page, issue #1: http://projects.scipy.org/numpy/wiki/MaskedArray.

    The problem is that a number of unary functions such as np.angle, np.quantile call [np.]asarray in the source, which strips out the mask.

    As the devs explain in the page I linked to, if these functions used ma.asarray instead of np.asarray they’d work, but they don’t :(.

    I guess this is a patch yet to be submitted?

    As a temporary workaround, np.angle basically calls np.arctan2(a.imag,a.real) (optionally multiplying by 180/pi to get degrees), so you could use that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the following code segment: try: raise Bob() except Fred: print blah How is
Try the following code public enum Color { Blue=1, Red=2, Green=3 } public List<Color>
Try the following code: s = '#value#' puts s.gsub('#value#', Regexp.escape('*')) # => '\*' puts
I try the following code, but it doesn't work. [helloToolbar setBackgroundColor:[UIColor clearColor]];
We have following code: try { // some code throwing MyException } catch (MyException
If I try executing the following code f = file('test','rb') fout = file('test.out','wb') for
I use the following code try to create an array of string vectors, I
I'm currently downloading an HTML page, using the following code: Try Dim req As
The following code is a try to encrypt data using AES with asymmetric key:
I try to use the following code: ArrayList<String> Map<String, String> Eclipse complains about both

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.