Closed lh64 closed 7 years ago
We can do this for param_values
too (and update documentation).
I am going to push an adjustment that allows passing y0 as a dict or numpy.array. I see two sloppy points. 1.) saving duplication of code I placed the dict usage if not an array, which caused my to create a copy of y0. Otherwise it gets replaced by zeros. This isn't good, but otherwise we could rename y0 and pass the solver the new y0. 2.) It only takes initial condition changes. If the species wasn't defined here, it cannot change its seed. This is the same behavior as before. One thing I did see, Leonard and I talked about this, was that if passed param_values the y0 gets set from there. This code sets it first from y0 dict first, preventing the param_value use. I think this is what we would want?
This needs some work, as the tokenizer doesn't account for all cases. Some known ones are:
Switched bond sites: e.g. 'B(a=1) % A(b=1)' should not be equal to 'B(b=1) % A(a=1)' ComplexPatterns with Compartments ...
We plan to discuss how to implement a string to ComplexPattern parser with the guys at HMS. This relevant code has been moved to a separate branch, solvery0dict, for further discussion about how to implement this. The parser will be dependent on fixing issue #16 on identical bond numbering.
This isn't really true, is it? We allowed 'param_values' to be a dictionary, but 'y0' returns a NotImplemented exception, or whatever, if passed as a dict. I think we need to reopen this issue, yes?
Agreed, the relevant code was reverted due to the complications described in this thread. Reopening.
I've implemented this in the simulatorclass branch at this commit: https://github.com/LoLab-VU/pysb/commit/12e79534f272c427654933d2ec8f81fca4185042
It doesn't fix the complex pattern is_equivalent_to()
issue #16 about identical bond numbering , but I think it otherwise works.
Closing this issue since the Simulator class implements this. We're tracking the identical bond numbering issue separately in #16
Check to see if 'y0' is an instance of 'dict' rather than creating a whole new input argument in pysb.integrate.Solver.run. Basically, if 'y0' is list-like then require that it be as long as the number of species (as is done now), and if it's a dictionary just replace the initial concentrations of the named species. The documentation will need to be updated too.
See https://github.com/LoLab-VU/pysb/commit/d4fc8a5