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

update: inertia benefit from caching + move from pkg_resources to importlib.metada #714

Open
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

m-rauen
Copy link
Contributor

@m-rauen m-rauen commented Dec 4, 2024

As stated in the setuptools page, using pkg_resources is deprecated in favor of importlib. Therefore, I took the initiative to change it.

I noticed that inertia moment can benefit from cache strategy and decided to implement it. Cache requires hashable objects and arrays/numpy arrays aren't. So, I decided to create a prototype of those arrays, make them hashable and introduce cache, while passing the same array to the function and not generating errors.

I also changed the jax callout, as it's already resolved in #713.

Copy link
Member

@schneiderfelipe schneiderfelipe left a comment

Choose a reason for hiding this comment

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

CI is funky for some reason, but I think this is good. Do you think we can close #713 after this gets merged? I just approved #713 😊


import numpy as np
from scipy.stats import cauchy, norm

import overreact as rx
from overreact import _constants as constants

def make_hashable(obj):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I forget to add the python function annotations here and in the copy_unhashable() function. I will add this piece and send a new PR asap

Copy link
Contributor Author

@m-rauen m-rauen left a comment

Choose a reason for hiding this comment

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

Just need to add the annotations for the new functions

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 this pull request may close these issues.

2 participants