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

Make inputs to nu_tuple be json file instead of hard coded lists. #2

Open
hschellman opened this issue Oct 1, 2021 · 5 comments
Open
Assignees

Comments

@hschellman
Copy link
Collaborator

Sean suggests using json files as inputs instead of hardcoded lists. I suggest talking to him about exactly how to do it. Work with Sean on this - it will make your life easier but will take some explanation.

How you do this would look something like

'''
import json

config=json.load("configfilename.json")

tuplelist = config["tuplelist"]
if "limitfile" in config:
limitfile = config["limitfile"]
haslim=True

do the stuff to read in the limits info

else:
haslim=False

variables = config["variables"]

cuts = config["cuts"]

cutchoice = config["cutchoice"]

'''
and then your code does its stuff with all of this initialized

The config file would look like:

{
"variables":["var1","var2"],
"cuts":{"cut1":"whatever" ....},
"cutchoice":["cut1","cut2"],
"limitfile":"limits.txt"
}

@hschellman hschellman assigned smgilligan and P-Lefevre and unassigned smgilligan Oct 1, 2021
@hschellman
Copy link
Collaborator Author

Ask questions here

@smgilligan
Copy link
Contributor

The branch json_testing contains nu_cuts_v6.py, support files, and an updated readme.md.

@hschellman
Copy link
Collaborator Author

Phoebe, please try running nu_cuts_v6.py according to Sean's instructions

@hschellman
Copy link
Collaborator Author

And then make a new json file with many more variables and run v6 again.

@hschellman
Copy link
Collaborator Author

@smgilligan - how do we handle the ranges file name? Is it in the json file or is it still and argument.

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

No branches or pull requests

3 participants