Python script for automating madgraph runs.

Asked by ibb on 2018-09-19

Hello!

I am currently writing a python script to loop over possible masses of a particle, but Madgraph does not seem to read the python syntax. It does not seem to recognize the for-loop and gives an error message after reading the "end" of the for-loop.

Is there a way for Madgraph to read the syntax? Is there a package I can import to python to run Madgraph scripts?

Thanks in advance

Question information

Language:
English Edit question
Status:
Answered
For:
MadGraph5_aMC@NLO Edit question
Assignee:
No assignee Edit question
Last query:
2018-09-19
Last reply:
2018-09-20

Hi,

Did you do the following?

generate p p > t t~
output
launch
set mt scan:[10**i for i in range(1,100,5)]

after the "scan:" you can basically put ANY --oneline-- python syntax (which returns a list)

Cheers,

Olivier

> On 19 Sep 2018, at 16:43, ibb <email address hidden> wrote:
>
> New question #674141 on MadGraph5_aMC@NLO:
> https://answers.launchpad.net/mg5amcnlo/+question/674141
>
> Hello!
>
> I am currently writing a python script to loop over possible masses of a particle, but Madgraph does not seem to read the python syntax. It does not seem to recognize the for-loop and gives an error message after reading the "end" of the for-loop.
>
> Is there a way for Madgraph to read the syntax? Is there a package I can import to python to run Madgraph scripts?
>
> Thanks in advance
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

ibb (ibb08) said : #2

Hi,

I did try this after you suggested it, but I am more interested in doing something similar to the person in : https://answers.launchpad.net/mg5amcnlo/+question/404555

But when I try to import madevent_interface, it says that there is no such module. Is there something special I need to do to make this work? also, is there documentation for the existing commands you can do for madgraph using python? Like the one you mentioned in the forum post: "param_card[block].param_dict[lhaid].value = value"?

Best regards

Hi,

> I did try this after you suggested it, but I am more interested in doing
> something similar to the person in :
> https://answers.launchpad.net/mg5amcnlo/+question/404555

Well this is not a method of interface that we support in any way.
Those are PRIVATE API and not public API. As everywhere private API are not documented
(you have the automatic documentation but that's it) and we do not support such use.
Actually my comments on the above trhead is not true anymore.

Now I would be interested to know what will be your interest in such type of interface.
(We also have the PLUGIN mode if you need to change the interface actually)

> But when I try to import madevent_interface, it says that there is no
> such module.

This means that you do not import it correctly (did you set your PYTHONPATH correctly?)

> also, is there documentation for the existing commands you can do for
> madgraph using python? Like the one you mentioned in the forum post:
> "param_card[block].param_dict[lhaid].value = value"?

Except the automatic documentation in the epydoc directory. No.
This is not suppose to be something used by normal user of the code.

Cheers,

Olivier

> On 20 Sep 2018, at 15:47, ibb <email address hidden> wrote:
>
> Question #674141 on MadGraph5_aMC@NLO changed:
> https://answers.launchpad.net/mg5amcnlo/+question/674141
>
> ibb posted a new comment:
> Hi,
>
> I did try this after you suggested it, but I am more interested in doing
> something similar to the person in :
> https://answers.launchpad.net/mg5amcnlo/+question/404555
>
> But when I try to import madevent_interface, it says that there is no
> such module. Is there something special I need to do to make this work?
> also, is there documentation for the existing commands you can do for
> madgraph using python? Like the one you mentioned in the forum post:
> "param_card[block].param_dict[lhaid].value = value"?
>
> Best regards
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

Can you help with this problem?

Provide an answer of your own, or ask ibb for more information if necessary.

To post a message you must log in.