masked-array Questions
2
Solved
I've been reading through the masked array documentation and I'm confused - what is different about MaskedArray than just maintaining an array of values and a boolean mask? Can someone give me an e...
Handsel asked 4/5, 2019 at 23:26
7
Solved
Say I have a two dimensional array of coordinates that looks something like
x = array([[1,2],[2,3],[3,4]])
Previously in my work so far, I generated a mask that ends up looking something like
ma...
Adios asked 5/7, 2016 at 1:18
6
Solved
I am trying to calculate the moving average in a large numpy array that contains NaNs. Currently I am using:
import numpy as np
def moving_average(a,n=5):
ret = np.cumsum(a,dtype=float)
ret[n:]...
Djebel asked 7/10, 2016 at 13:56
5
Solved
Is there an idiomatic way to mask elements of an array in vanilla Python 3? For example:
a = [True, False, True, False]
b = [2, 3, 5, 7]
b[a]
I was hoping b[a] would return [2, 5], but I get an er...
Piercy asked 3/1, 2021 at 9:43
3
Solved
I have an image that I found contours on with skimage.measure.find_contours() but now I want to create a mask for the pixels fully outside the largest closed contour. Any idea how to do this?
Mod...
Fishtail asked 22/9, 2016 at 15:7
2
Solved
>> masks = [[1,1],[0,0]]
>> [np.ma.masked_array(data=np.array([1.0,2.0]), mask=m, fill_value=np.nan).mean() for m in masks]
[masked, 1.5]
I'd like to replace the masked result with ...
Byrnie asked 20/5, 2019 at 1:30
2
Solved
I need to mask an array a by a condition fulfilled by another array b.
For example values in a should only be preserved if the values in the same position of b equal 0, otherwise return as None. ...
Superman asked 23/3, 2018 at 16:6
3
Solved
In my code, at some point I try to modify a value of a masked array, yet python seems to ignore this. I'm thinking this has to do with the way memory is stored in arrays, as if I were modifying a c...
Duarte asked 11/5, 2017 at 16:55
2
Solved
I'm working with masked arrays thanks to some of the help I've gotten on stackoverflow, but I'm running into a problem with the np.where evaluation of a masked array.
My masked array is:
m_pt0 = ...
Bohman asked 3/5, 2017 at 13:26
1
Solved
Currently, my code heavily uses structured masked arrays with multidimensional dtypes, with dozens of fields and item sizes of many kilobytes. It appears that xarray could be a great alternative, b...
Delimitate asked 6/1, 2017 at 12:25
1
Solved
I understand how to create a masked array, and I would like to use masking in a record array so that I can access this data using named attributes. The masking seems to be "lost" when I create a re...
Mccray asked 27/8, 2011 at 21:54
1
Solved
I have a numpy structured array with a dtype such as:
A = numpy.empty(10, dtype=([('segment', '<i8'), ('material', '<i8'), ('rxN', '<i8')]))
I know I can create a mask such as:
A[A['se...
Tubing asked 22/7, 2011 at 15:34
1
© 2022 - 2024 — McMap. All rights reserved.