cannot import form_factors

Asked by toodles

Dear sir,

I followed the instruction https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/FormFactors to add a form factor.
However I failed to load the form_factors.py file. I have the following command in my lorentz.py file

try:
   import form_factors as ForFac
except ImportError:
   pass

The form_facotrs.py is under the same directory of lorentz.py.
The MG5_debug file is as follows:

Traceback (most recent call last):
  File "/Users/toodles/madness/MG5_aMC_v2_3_3/madgraph/interface/extended_cmd.py", line 908, in onecmd
    return self.onecmd_orig(line, **opt)
  File "/Users/toodles/madness/MG5_aMC_v2_3_3/madgraph/interface/extended_cmd.py", line 897, in onecmd_orig
    return func(arg, **opt)
  File "/Users/toodles/madness/MG5_aMC_v2_3_3/madgraph/interface/master_interface.py", line 266, in do_import
    self.cmd.do_import(self, *args, **opts)
  File "/Users/toodles/madness/MG5_aMC_v2_3_3/madgraph/interface/madgraph_interface.py", line 4845, in do_import
    complex_mass_scheme=self.options['complex_mass_scheme'])
  File "/Users/toodles/madness/MG5_aMC_v2_3_3/models/import_ufo.py", line 115, in import_model
    model = import_full_model(model_path, decay, prefix)
  File "/Users/toodles/madness/MG5_aMC_v2_3_3/models/import_ufo.py", line 253, in import_full_model
    ufo_model = ufomodels.load_model(model_path, decay)
  File "/Users/toodles/madness/MG5_aMC_v2_3_3/models/__init__.py", line 39, in load_model
    __import__(path_split[-1])
  File "/Users/toodles/madness/MG5_aMC_v2_3_3/models/SMFF/__init__.py", line 5, in <module>
    import lorentz
  File "/Users/toodles/madness/MG5_aMC_v2_3_3/models/SMFF/lorentz.py", line 42, in <module>
    formfactors=[ForFac.AAA])
NameError: name 'ForFac' is not defined

Did I miss something?

Thank you very much for your help!

Best Regards,
YY

Question information

Language:
English Edit question
Status:
Solved
For:
MadGraph5_aMC@NLO Edit question
Assignee:
No assignee Edit question
Solved by:
toodles
Solved:
Last query:
Last reply:
Revision history for this message
Olivier Mattelaer (olivier-mattelaer) said :
#1

Hi,

I guess that you miss this line of the instructions:

You need to be sure to have the line "import formfactors as ForFac" at the beginning of the lorentz.py file

Cheers,

Olivier

> On 28 Feb 2017, at 06:48, toodles <email address hidden> wrote:
>
> New question #496478 on MadGraph5_aMC@NLO:
> https://answers.launchpad.net/mg5amcnlo/+question/496478
>
> Dear sir,
>
> I followed the instruction https://cp3.irmp.ucl.ac.be/projects/madgraph/wiki/FormFactors to add a form factor.
> However I failed to load the form_factors.py file. I have the following command in my lorentz.py file
>
> try:
> import form_factors as ForFac
> except ImportError:
> pass
>
> The form_facotrs.py is under the same directory of lorentz.py.
> The MG5_debug file is as follows:
>
> Traceback (most recent call last):
> File "/Users/toodles/madness/MG5_aMC_v2_3_3/madgraph/interface/extended_cmd.py", line 908, in onecmd
> return self.onecmd_orig(line, **opt)
> File "/Users/toodles/madness/MG5_aMC_v2_3_3/madgraph/interface/extended_cmd.py", line 897, in onecmd_orig
> return func(arg, **opt)
> File "/Users/toodles/madness/MG5_aMC_v2_3_3/madgraph/interface/master_interface.py", line 266, in do_import
> self.cmd.do_import(self, *args, **opts)
> File "/Users/toodles/madness/MG5_aMC_v2_3_3/madgraph/interface/madgraph_interface.py", line 4845, in do_import
> complex_mass_scheme=self.options['complex_mass_scheme'])
> File "/Users/toodles/madness/MG5_aMC_v2_3_3/models/import_ufo.py", line 115, in import_model
> model = import_full_model(model_path, decay, prefix)
> File "/Users/toodles/madness/MG5_aMC_v2_3_3/models/import_ufo.py", line 253, in import_full_model
> ufo_model = ufomodels.load_model(model_path, decay)
> File "/Users/toodles/madness/MG5_aMC_v2_3_3/models/__init__.py", line 39, in load_model
> __import__(path_split[-1])
> File "/Users/toodles/madness/MG5_aMC_v2_3_3/models/SMFF/__init__.py", line 5, in <module>
> import lorentz
> File "/Users/toodles/madness/MG5_aMC_v2_3_3/models/SMFF/lorentz.py", line 42, in <module>
> formfactors=[ForFac.AAA])
> NameError: name 'ForFac' is not defined
>
> Did I miss something?
>
> Thank you very much for your help!
>
> Best Regards,
> YY
>
>
>
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

Revision history for this message
toodles (liyybnu) said :
#2

Hi Olivier,

Thanks for your reply. I do have this line as:

try:
   import form_factors as ForFac
except ImportError:
   pass

But I mismatched the file name. Now it works. Thank you very much!

Best
YY