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

ps[booster].py: model_dir as input (similar to lhc.py) #139

Open
elenafol opened this issue Jun 20, 2018 · 6 comments
Open

ps[booster].py: model_dir as input (similar to lhc.py) #139

elenafol opened this issue Jun 20, 2018 · 6 comments

Comments

@elenafol
Copy link
Contributor

Running generate_fullresponse_pandas.py for psbooster (which will not work due to missing json template, but the arguments are supposed to be okay), following error message was produced, if no nattune is defined in the command arguments:

File "/afs/cern.ch/eng/sl/lintrack/Beta-Beat.src/model/accelerators/psbooster.py", line 123, in init
opt = parser.parse(*args, **kwargs)
File "/afs/cern.ch/eng/sl/lintrack/Beta-Beat.src/utils/entrypoint.py", line 149, in parse
options = self._handle_kwargs(kwargs)
File "/afs/cern.ch/eng/sl/lintrack/Beta-Beat.src/utils/entrypoint.py", line 255, in _handle_kwargs
options = self.dictparse.parse_arguments(kwargs)
File "/afs/cern.ch/eng/sl/lintrack/Beta-Beat.src/utils/dict_tools.py", line 292, in parse_arguments
return self._parse_options(copy.deepcopy(arguments), self.dictionary)
File "/afs/cern.ch/eng/sl/lintrack/Beta-Beat.src/utils/dict_tools.py", line 248, in _parse_options
checked_dict[key] = DictParser._check_value(key, arg_dict, param_dict)
File "/afs/cern.ch/eng/sl/lintrack/Beta-Beat.src/utils/dict_tools.py", line 199, in _check_value
key, param.help)
utils.dict_tools.ArgumentError: 'nat_tune_y' required in options.

After adding the required option, the error message is:
Unknown options: ['nat_tune_y', '0.294', 'nat_tune_x', '0.0186'] | utils.entrypoint

Also, the natural tune options for LHC are called nattuney, nattunex. For psbosster the format is nat_tune_y, nat_tune_x, which should be changed to follow the same naming convention.

@JoschD
Copy link
Member

JoschD commented Jun 20, 2018

For future refenrece: I am quite sure this has nothing to do with entrypoint. Entrypoint is just the function that handles the arguments.
So this is an argument conflict between accelerator class options for psbooster and generate_fullresponse_pandas.

@JoschD JoschD changed the title Arguments in accelerator class/entrypoint for nattune Wrong arguments in accelerator class/generate_fullresponse_pandas for nattune Jun 20, 2018
@JoschD JoschD changed the title Wrong arguments in accelerator class/generate_fullresponse_pandas for nattune Wrong arguments in accelerator class of psbooster/generate_fullresponse_pandas for nattune Jun 20, 2018
@JoschD
Copy link
Member

JoschD commented Jul 3, 2018

@elenafol do you have a testsetup for this?
I just had a look at the code, the commandline parameters for LHC and PSBooster are the same and should both be
--nattunex and --nattuney

If you call it as as function, they are both nat_tune_x and nat_tune_y, which lead to the ArgumentError message.

@elenafol
Copy link
Contributor Author

elenafol commented Jul 3, 2018

Using --nattunex, --nattuney:

afs/cern.ch/work/o/omc/anaconda/bin/python /afs/cern.ch/eng/sl/lintrack/Beta-Beat.src/generate_fullresponse_pandas.py --accel psbooster --creator madx --deltak 0.00002 --variables MQSl MQSr MQSa --outfile /afs/cern.ch/work/e/efol/public/betabeatGui/temp/2018-06-19/models/PSBOOSTER/psbModel/Fullresponse_pandas --model_dir /afs/cern.ch/work/e/efol/public/betabeatGui/temp/2018-06-19/models/PSBOOSTER/psbModel --debug --nattunex 0.186 --nattuney 0.294

DEBUG | Unknown options: ['--nattunex', '0.186', '--nattuney', '0.294'] | utils.entrypoint

@JoschD
Copy link
Member

JoschD commented Jul 3, 2018

That should be correct, as it is only a debug message. Does it run?

@elenafol
Copy link
Contributor Author

elenafol commented Jul 3, 2018

No, it gives me the error similar to the one I mentioned before:

Traceback (most recent call last):
File "/afs/cern.ch/eng/sl/lintrack/Beta-Beat.src/generate_fullresponse_pandas.py", line 142, in
create_response()
File "/afs/cern.ch/eng/sl/lintrack/Beta-Beat.src/utils/entrypoint.py", line 348, in wrapper
return func(options, unknown_options)
File "/afs/cern.ch/eng/sl/lintrack/Beta-Beat.src/generate_fullresponse_pandas.py", line 118, in create_response
accel_cls = manager.get_accel_class(other_opt)
File "/afs/cern.ch/eng/sl/lintrack/Beta-Beat.src/utils/entrypoint.py", line 348, in wrapper
return func(options, unknown_options)
File "/afs/cern.ch/eng/sl/lintrack/Beta-Beat.src/model/manager.py", line 42, in get_accel_class
accel_cls = accel.get_class(cls_opt)
File "/afs/cern.ch/eng/sl/lintrack/Beta-Beat.src/model/accelerators/psbooster.py", line 167, in get_class
opt = parser.parse(*args, **kwargs)
File "/afs/cern.ch/eng/sl/lintrack/Beta-Beat.src/utils/entrypoint.py", line 146, in parse
options = self._handle_arg(args[0])
File "/afs/cern.ch/eng/sl/lintrack/Beta-Beat.src/utils/entrypoint.py", line 219, in _handle_arg
options = self._handle_commandline(arg)
File "/afs/cern.ch/eng/sl/lintrack/Beta-Beat.src/utils/entrypoint.py", line 199, in _handle_commandline
raise ArgumentError("Unknown options: {:s}".format(unknown_opts))
utils.dict_tools.ArgumentError: Unknown options: ['--nattunex', '0.186', '--nattuney', '0.294']

@JoschD
Copy link
Member

JoschD commented Jul 3, 2018

I see the problem. The nattune-error was misleading. The actual problem is, that lhc.py has been rewritten to accept a model as input and fullresponse_pandas makes use of this. fullresponse_pandas actually requires a model folder as input and passes it on to psbooster.py which is wondering, where it's options are.

tl,dr: psbooster.py needs to be rewritten to accept model_dir as input.

@JoschD JoschD changed the title Wrong arguments in accelerator class of psbooster/generate_fullresponse_pandas for nattune ps[booster].py: model_dir as input (similar to lhc.py) Jul 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants