Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow FixedView to be used to select other views #780

Closed
HDembinski opened this issue Aug 7, 2022 · 0 comments · Fixed by #781
Closed

Allow FixedView to be used to select other views #780

HDembinski opened this issue Aug 7, 2022 · 0 comments · Fixed by #781

Comments

@HDembinski
Copy link
Member

HDembinski commented Aug 7, 2022

Minuit.fixed returns an object that mimics the numpy array interface and holds boolean values. The numpy expectation is that this array can be used as a mask for other arrays, but this currently does not work.

from iminuit import Minuit

m = Minuit(lambda x, y : x ** 2 + y ** 2, 1, 2)
m.fixed[0] = True

m.values[m.fixed] # returns [1, 2], not [1]
m.values[~m.fixed] # does not work, because the operator is not supported
m.values[m.fixed] = 0 # sets all values, not only those for m.fixed == 0

By the way, this works correctly:

err = np.array(m.errors)
err[m.fixed] = 0
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 a pull request may close this issue.

1 participant