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

Improve protocol solves #63

Open
martintb opened this issue Aug 8, 2024 · 0 comments
Open

Improve protocol solves #63

martintb opened this issue Aug 8, 2024 · 0 comments

Comments

@martintb
Copy link
Collaborator

martintb commented Aug 8, 2024

We can improve the reliability of the mass balance solver by replacing

mass_transfers,residuals = scipy.optimize.nnls(self.mass_fraction_matrix,self.target_component_masses)

with something along the lines of

from scipy.optimize import Bounds
lbs= []
for stock in self.stocks:
    lb = (stock.measure_out(PIPETTE_MINIMUM*units('ul')).mass).to('g').magnitude
    lbs.append(lb)
    
bounds = Bounds(lb=lbs,keep_feasible=False)
scipy.optimize.lsq_linear(self.mass_fraction_matrix,self.target_masses,bounds=bounds)
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

When branches are created from issues, their pull requests are automatically linked.

1 participant