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

Dictionary of years per run #53

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

Dictionary of years per run #53

wants to merge 2 commits into from

Conversation

bryates
Copy link
Contributor

@bryates bryates commented Nov 8, 2024

This PR adds a dictionary of runs and what years they contain. To check if a year is run 2 or run 3, one can do

from topcoffea.modules.get_param_from_jsons import GetParam
from topcoffea.modules.paths import topcoffea_path
run_dict = GetParam(topcoffea_path("params/run_dict.json"))

if year in run_dict('Run3'):
...

@bryates
Copy link
Contributor Author

bryates commented Nov 18, 2024

@kmohrman @Andrew42 @sscruz any comments on this PR? It's pretty minimal.

@kmohrman
Copy link
Contributor

I don't have any objections to this in principle. But I'm wondering is there a reason to have a separate json file for it instead of adding it to the params json file?

Also, where is this used? It may be useful to add a helper function where you just pass a year and it gives you a bool. Like the usage would be something like is_run2(year) and that would give you True or False or throw an error (it would just check if the year is in the Run 2 list, the Run 3 list, or neither). And similar for is_run3(year).

@bryates
Copy link
Contributor Author

bryates commented Nov 20, 2024

I don't have any objections to this in principle. But I'm wondering is there a reason to have a separate json file for it instead of adding it to the params json file?

Also, where is this used? It may be useful to add a helper function where you just pass a year and it gives you a bool. Like the usage would be something like is_run2(year) and that would give you True or False or throw an error (it would just check if the year is in the Run 2 list, the Run 3 list, or neither). And similar for is_run3(year).

I guess there's no real reason to keep it in a separate file. I can put these in params.json. As for a helper function, I was going back and forth on that, but since you suggested it, I'll add something. I have a PR in TopEFT to use the dictionary
https://github.com/TopEFT/topeft/blob/b97b0382c77133bd20f06e76178b0971289c1420/topeft/modules/corrections.py#L263

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