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

Hashable Rules #2076

Merged
merged 25 commits into from
May 21, 2024
Merged

Hashable Rules #2076

merged 25 commits into from
May 21, 2024

Conversation

comane
Copy link
Member

@comane comane commented May 10, 2024

Rules (for cuts) are made to tuple instead of list.
This makes them hashable and allows eg them to contained within a TupleComp object

@comane comane requested a review from scarlehoff May 10, 2024 14:43
@comane comane requested a review from Radonirinaunimi May 12, 2024 14:35
@comane comane mentioned this pull request May 12, 2024
Copy link
Member

@scarlehoff scarlehoff left a comment

Choose a reason for hiding this comment

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

Thanks for this, could you also remove frozenargs from the conda recipe / pyproject? It should not be needed anymore

(I think this closes #2027 ^^)

validphys2/src/validphys/config.py Outdated Show resolved Hide resolved
validphys2/src/validphys/config.py Outdated Show resolved Hide resolved
validphys2/src/validphys/config.py Outdated Show resolved Hide resolved
validphys2/src/validphys/config.py Outdated Show resolved Hide resolved
@comane
Copy link
Member Author

comane commented May 13, 2024

Thanks for this, could you also remove frozenargs from the conda recipe / pyproject? It should not be needed anymore

I am not sure I understand, do you mean frozendict? Because that one is actually still needed

@scarlehoff
Copy link
Member

Because that one is actually still needed

I thought it was only needed by the filter rules?

validphys2/src/validphys/config.py Outdated Show resolved Hide resolved
validphys2/src/validphys/config.py Outdated Show resolved Hide resolved
validphys2/src/validphys/config.py Show resolved Hide resolved
validphys2/src/validphys/config.py Outdated Show resolved Hide resolved
validphys2/src/validphys/config.py Outdated Show resolved Hide resolved
validphys2/src/validphys/filters.py Show resolved Hide resolved
@@ -511,7 +558,7 @@ def __init__(self, initial_data: dict, *, defaults: dict, theory_parameters: dic
self.rule_string = self.rule
self.defaults = defaults
self.theory_params = theory_parameters
ns = {*self.numpy_functions, *self.defaults, *self.variables, "idat", "central_value"}
ns = {*self.numpy_functions, *self.defaults.to_dict().keys(), *self.variables, "idat", "central_value"}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ns = {*self.numpy_functions, *self.defaults.to_dict().keys(), *self.variables, "idat", "central_value"}
ns = {*self.numpy_functions, *self.defaults.to_dict(), *self.variables, "idat", "central_value"}

Not that it makes a difference though.

validphys2/src/validphys/loader.py Outdated Show resolved Hide resolved
validphys2/src/validphys/config.py Show resolved Hide resolved
@scarlehoff scarlehoff added the run-fit-bot Starts fit bot from a PR. label May 15, 2024
Copy link

Greetings from your nice fit 🤖 !
I have good news for you, I just finished my tasks:

Check the report carefully, and please buy me a ☕ , or better, a GPU 😉!

@comane comane added the enhancement New feature or request label May 17, 2024
Copy link

Greetings from your nice fit 🤖 !
I have good news for you, I just finished my tasks:

Check the report carefully, and please buy me a ☕ , or better, a GPU 😉!

@scarlehoff scarlehoff removed the run-fit-bot Starts fit bot from a PR. label May 17, 2024
Copy link
Member

@scarlehoff scarlehoff left a comment

Choose a reason for hiding this comment

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

Thanks for this, I think this is already finished :)

Just some small comments for parse_filter_defaults.

validphys2/src/validphys/config.py Outdated Show resolved Hide resolved
validphys2/src/validphys/config.py Outdated Show resolved Hide resolved
@scarlehoff scarlehoff mentioned this pull request May 20, 2024
34 tasks
Copy link
Member

@scarlehoff scarlehoff left a comment

Choose a reason for hiding this comment

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

Seems ok. I've done a few tests and I haven't seen anything obviously wrong.

@scarlehoff scarlehoff merged commit d725786 into master May 21, 2024
6 checks passed
@scarlehoff scarlehoff deleted the hashable_rules branch May 21, 2024 10:24


@dataclasses.dataclass(frozen=True)
class AddedFilterRule(FilterRule):
Copy link
Member

Choose a reason for hiding this comment

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

What is the purpose of this class?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants