-
-
Notifications
You must be signed in to change notification settings - Fork 142
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
v0.5.1 #367
Merged
Merged
v0.5.1 #367
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
**Major** - Renamed "bar"->"meter" to reflect the fact that e.g. the text output isn't a bar. - Added docstrings for all progress meter methods, the new `diffeqsolve(..., progress_meter=...)` argument, and added everything into the docs. - Fixed bug with t0!=0 producing the wrong results. - Fixed vmap'd diffeqsolves crashing progress bars. Making this work actually necessitated a fair bit of rewriting, with a gamut of different callbacks and unvmaps. **Minor** - Progress updates now move over `[0, 1]` rather than `[0, 100]`. - Tidied up tqdm bar formatting. - `TqdmProgressMeter` now checks at trace-time if `tqdm` is installed, rather than crashing at runtime. - The progress bar state is now a `PyTree[Array]`
* Added parametric control types * Demo of AbstractTerm change * Correct initial parametric control type implementation. * Parametric AbstractTerm initial implementation. * Update tests and fix hinting * Implement review comments. * Add parametric control check to integrator. * Update and test parametric control check * Introduce new LevyArea types * Updated Brownian path LevyArea types * Replace Union types in isinstance checks * Remove rogue comment * Revert _brownian_arch to single assignment * Revert _evaluate_leaf key splitting * Rename variables in test_term * Update isinstance and issubclass checks * Safer handling in _denormalise_bm_inc * Fix style in integrate control type check * Add draft vector_field typing * Add draft vector_field typing * Fix term test * Revert extemporaneous modifications in _tree * Rename TimeLevyArea to BrownianIncrement and simplify diff * Rename AbstractLevyReturn to AbstractBrownianReturn * Rename _LevyArea to _BrownianReturn * Enhance _term_compatiblity checks * Fix merge issues * Bump pre-commit and fix type hints * Clean up from self-review * Explicitly add typeguard to deps * Bump ruff config to new syntax * Parameterised terms: fixed term compatibility + spurious pyright errors Phew, this ended up being a complicated one! Let's start with the easy stuff: - Disabled spurious pyright errors due to incompatible between pyright and `eqx.AbstractVar`. - Now using ruff.lint and pinned exact typeguard version. Now on to the hard stuff: - Fixed term compatibibility missing some edge cases. Edge cases? What edge cases? Well, what we had before was basically predicated around doing ```python vf, contr = get_args(term_cls) ``` recalling that we may have e.g. `term_cls = AbstractTerm[SomeVectorField, SomeControl]`. So far so simple: get the arguments of a subscripted generic, no big deal. What this failed to account for is that we may also have subclasses of this generic, e.g. `term_cls = ODETerm[SomeVectorField]`, such that some of the type variables have already been filled in when defining it: ```python class ODETerm(AbstractTerm[_VF, RealScaleLike]): ... ``` so in this case, `get_args(term_cls)` simply returns a 1-tuple of `(SomeVectorField,)`. Oh no! Somehow we have to traverse both the filled-in type variables (to find that one of our type variables is `SomeVectorField` due to subscripting) *and* the type hierarchy (to figure out that the other type variable was filled in during the definition). Once again, for clarity: given a subscriptable base class `AbstractTerm[_VF, _Control]` and some arbitrary possible-subscripted subclass, we need to find the values of `_VF` and `_Control`, regardless of whehther they have been passed in via subscripting the final class (and are `get_args`-able) or have been filled in during subclassing (and require traversing pseudo-type-hierarchies of `__orig_bases__`). Any sane implementation would simply... not bother. There is no way that the hassle of figuring this out was going to be worth the small amount of type safety this brings... So anyway, after a few hours working on this *far* past the point I should be going to sleep, this problem this is now solved. This PR introduces a new `get_args_of` function, called as `get_args_of(superclass, subclass, error_msg_if_necessary)`. This acts analogous to `get_args`, but instead of looking up both parameters (the type variables we want filled in) and the arguments (the values those type variables have been filled in with) on the same class, it looks up the parameters on the superclass, and their filled-in-values on the subclass. Pure madness. (I'm also tagging @leycec here because this is exactly the kind of insane typing hackery that he seems to really enjoy.) Does anyone else remember the days when this was a package primarily concerned about solving differential equations? --------- Co-authored-by: Patrick Kidger <[email protected]>
- set reportUnnecessaryTypeIgnoreComment=true, as required by the static type "tests" in `test_term`; - remove now redundant, commented out, beatype based tests in `test_term`; - remove all unnecessary type ignore comments from across the codebase.
* Fix complex casting and types issues * Dependency version
* Fix complex tests * Fix more complex tests * New sde related fixes * New sde related fixes
* Enable implicit solvers for complex inputs * change version * make pyright happy
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Dev branch for the next release.