0

I have been using the median_filter function from scipy.ndimage. I would like to use this in a way that discards any data that isn't positively valued.

That is, suppose one iteration of the filter acts over:

[40, 50, 0, 90]

If I simply run the median filter over this, I will get 45. I desire a function which ignores the zero, such that the median is 50.

Thanks for your suggestions!

1 Answers1

-1

In excel we do this by providing an if statement [then is implied.]

=IF(SUM(F38,F43,F47)>60,60,IF(SUM(F38,F43,F47)<34,34,(SUM(F38,F43,F47)))) This would make any answer over 60 equal to 60. =IF(E19A19=0,"", E19A19) ignores 0. =IF(E19A19<=0,"", E19A19) returns nothing for 0 or any negative number. I hope this leads you in the right direction. It will depend on your platform but you are looking for eliminating all non positive inputs. something to the effect of input [n] If input [n] <= 0 zero, return null. next input.

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 15 '21 at 16:48