Skip to content

Conversation

eric-wieser
Copy link
Member

"Execute the call behavior." is not a helpful description for what __call__ does

if domain is not None:
m |= domain(da, db)
if self.domain is not None:
m |= self.domain(da, db)
Copy link
Member Author

@eric-wieser eric-wieser Jul 24, 2017

Choose a reason for hiding this comment

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

The one actual code change. We don't need to look up domain with ufunc_domain.get(self.f, None), because we set that in the constructor to self.domain


``_DomainCheckInterval(a,b)(x)`` is False where ``a <= x <= b``.
Copy link
Member

@ahaldane ahaldane Aug 10, 2017

Choose a reason for hiding this comment

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

Not sure this is really the same as the old comment because of nans. The old comment more literally describes which ufuncs are used in __call__ (less, logical_or, greater).

That is, x < a is not the opposite of a <= x for x = np.nan.

Copy link
Member

Choose a reason for hiding this comment

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

Also, while we're updating the comment, I'm not sure I like "define a valid interval". maybe "define an interval of validity"?

Copy link
Member Author

@eric-wieser eric-wieser Aug 11, 2017

Choose a reason for hiding this comment

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

Hmm, you're right about nans - this should read "where ... or isnan(x)" to be correct, right?

I think that's actually a bug in the existing code - that means all functions consider nan in their domain, which seems wrong to me. I don't know whether this is actually externally visible

Copy link
Member

Choose a reason for hiding this comment

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

Actually, if we think of using DomainCheckInterval even more generally - a, x and b don't even need to be numbers, so adding or isnan(x) might not be enough either. I think they can be any objects that can go through numpy ufuncs.

I think in practice none of this matters since the only "user" of DomainCheckInterval is the MaskedArray code which presumably masks Nans, and only calls it for numeric types. Nevertheless I don't think it's a good idea to make the comment less technically accurate than it was before.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think the way forward might be to update the implementation to match these new comments - the only reason it's done the way it is is to avoid doing an not operation, which seems to come at the cost of nan-correctness

Copy link
Member

Choose a reason for hiding this comment

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

That seems reasonable to me, assuming it doesn't break any tests.

@charris
Copy link
Member

charris commented Oct 5, 2017

What should we do with this?

@eric-wieser
Copy link
Member Author

I don't think it's ready at the moment

@charris
Copy link
Member

charris commented Mar 1, 2018

@eric-wieser Still not ready? Looks like a minor improvement, larger improvements start to get deeper into the ma code ...

@eric-wieser
Copy link
Member Author

I'd forgotten about this one. I'll try to come back to it in the next few days

@mattip
Copy link
Member

mattip commented Apr 29, 2019

@eric-wieser would you like help moving this forward? It seems what is missing is

  • rebase off master
  • invert the logic to match the documentation
  • make sure tests pass

@eric-wieser eric-wieser self-assigned this Oct 23, 2019
@mattip
Copy link
Member

mattip commented Dec 5, 2019

@eric-wieser ping

@charris
Copy link
Member

charris commented Dec 28, 2020

I'm going to close this, needs rebase in any case. @eric-wieser Please open a new PR if you want to pursue this.

@charris charris closed this Dec 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants