Issues setting up the devel version

49 views
Skip to first unread message

Gilad Margalit

unread,
May 1, 2024, 9:42:52 AMMay 1
to gprMax-users
Hi,

After getting gprMax 3.1.7 to run successfully (on Windows), I attempted to try the devel branch (4.0.0b0) to use the Python API. However, I'm unable to get even the example antenna script to run correctly.

The instructions in the devel version of the guide (https://docs.gprmax.com/en/devel/inc_README.html) actually result in installing the 3.1.7 version. Instead, my process was to follow the standard guide (https://docs.gprmax.com/en/latest/include_readme.html), but replace git clone https://github.com/gprMax/gprMax.git with git clone -b devel https://github.com/gprMax/gprMax.git gprMax-devel. I'm following the lead of a colleague who seemingly took the exact same steps yet had no issues.

This process finishes without error and sets up the environment gprMax-devel. However, when I run antenna_wire_dipole_fs.py in that environment, I get the following error:




C:\Users\GiladM\AppData\Local\anaconda3\envs\gprMax-devel\python.exe C:\Users\GiladM\Downloads\antenna_wire_dipole_fs.py
Traceback (most recent call last):
  File "C:\Users\GiladM\Downloads\antenna_wire_dipole_fs.py", line 69, in <module>
    gprMax.run(scenes=[scene], n=1, outputfile=fn)
  File "C:\Users\GiladM\AppData\Local\anaconda3\envs\gprMax-devel\Lib\site-packages\gprmax-4.0.0b0-py3.12-win-amd64.egg\gprMax\gprMax.py", line 159, in run
    run_main(args)
  File "C:\Users\GiladM\AppData\Local\anaconda3\envs\gprMax-devel\Lib\site-packages\gprmax-4.0.0b0-py3.12-win-amd64.egg\gprMax\gprMax.py", line 219, in run_main
    results = context.run()
              ^^^^^^^^^^^^^
  File "C:\Users\GiladM\AppData\Local\anaconda3\envs\gprMax-devel\Lib\site-packages\gprmax-4.0.0b0-py3.12-win-amd64.egg\gprMax\contexts.py", line 84, in run
    model.build()
  File "C:\Users\GiladM\AppData\Local\anaconda3\envs\gprMax-devel\Lib\site-packages\gprmax-4.0.0b0-py3.12-win-amd64.egg\gprMax\model_build_run.py", line 74, in build
    self.reuse_geometry() if config.get_model_config().reuse_geometry else self.build_geometry()
                                                                           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\GiladM\AppData\Local\anaconda3\envs\gprMax-devel\Lib\site-packages\gprmax-4.0.0b0-py3.12-win-amd64.egg\gprMax\model_build_run.py", line 142, in build_geometry
    self.build_scene()
  File "C:\Users\GiladM\AppData\Local\anaconda3\envs\gprMax-devel\Lib\site-packages\gprmax-4.0.0b0-py3.12-win-amd64.egg\gprMax\model_build_run.py", line 265, in build_scene
    scene = parse_hash_commands(scene)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\GiladM\AppData\Local\anaconda3\envs\gprMax-devel\Lib\site-packages\gprmax-4.0.0b0-py3.12-win-amd64.egg\gprMax\hash_cmds_file.py", line 394, in parse_hash_commands
    user_objs = get_user_objects(processedlines, checkessential=True)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\GiladM\AppData\Local\anaconda3\envs\gprMax-devel\Lib\site-packages\gprmax-4.0.0b0-py3.12-win-amd64.egg\gprMax\hash_cmds_file.py", line 349, in get_user_objects
    parsed_commands = check_cmd_names(processedlines, checkessential=checkessential)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\GiladM\AppData\Local\anaconda3\envs\gprMax-devel\Lib\site-packages\gprmax-4.0.0b0-py3.12-win-amd64.egg\gprMax\hash_cmds_file.py", line 304, in check_cmd_names
    raise SyntaxError
SyntaxError: None

=== Electromagnetic modelling software based on the Finite-Difference Time-Domain (FDTD) method

    www.gprmax.com   __  __
     __ _ _ __  _ __|  \/  | __ ___  __
    / _` | '_ \| '__| |\/| |/ _` \ \/ /
   | (_| | |_) | |  | |  | | (_| |>  <
    \__, | .__/|_|  |_|  |_|\__,_/_/\_\
    |___/|_|
                     v4.0.0b0 (Càrn Mòr)

 Copyright (C) 2015-2024: The University of Edinburgh, United Kingdom
 Authors: Craig Warren, Antonis Giannopoulos, and John Hartley

 gprMax is free software: you can redistribute it and/or modify it under the
  terms of the GNU General Public License as published by the Free Software
  Foundation, either version 3 of the License, or (at your option) any later
  version.
 gprMax is distributed in the hope that it will be useful, but WITHOUT ANY
  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 You should have received a copy of the GNU General Public License along with
  gprMax.  If not, see www.gnu.org/licenses.

[PC-NAME] | 0 x unknown (10 cores, 12 cores with Hyper-Threading) | 31.7 GiB | Windows 11 (64-bit)
|--->OpenMP: 10 threads

--- Model 1/1, input file: C:\Users\GiladM\Downloads\antenna_wire_dipole_fs.py

Constants/variables used/available for Python scripting: {c: 299792458.0, current_model_run: 1, e0: 8.8541878128e-12, inputfile: C:\Users\GiladM\Downloads\antenna_wire_dipole_fs.py, m0: 1.25663706212e-06, number_model_runs: 1, z0: 376.73031366686166}

Your input file contains an invalid command: # title
NoneType: None

Process finished with exit code 1



Has anyone encountered this before? I assume it's an issue with my installation process or Python environment, but no amount of uninstalling and reinstalling seems to affect it.

Best,
Gilad

Craig Warren

unread,
May 8, 2024, 9:14:24 AMMay 8
to gprMax-users
Error suggests 'Your input file contains an invalid command: # title'

Looks like a whitespace character between the hash symbol and the command, so gprMax will not recognise it as valid.

Craig

Gilad Margalit

unread,
May 12, 2024, 6:45:15 AMMay 12
to gprMax-users
Hi Craig,

The '# Title' text is a comment from antenna_wire_dipole_fs.py, a default python script from the gprMax-devel documentation. It's not designed to be an input file, but my install of gprMax seems to be mistaking it for one. Which is very odd, because gprMax 4.0.0b0 is clearly present (when it's not, the previous line, title = gprMax.Title(name=fn.with_suffix("").name) gives an error), yet for some reason it's having trouble with some aspects of the 4.0.0b0 API. Have you encountered anything like this before?

Best,
Gilad

Craig Warren

unread,
May 13, 2024, 3:38:44 PMMay 13
to gprMax-users
Thanks - this seems to be related to a potential bug in the devel version with retaining/clearing the list of scenes in a model. I've updated the code to revert to our previous behaviour which should fix your issue but needs longer term thought as sometimes the list of scenes is being retained, erroneously, if the gprMax API is called in a loop.

Kind regards,
Craig

Reply all
Reply to author
Forward
0 new messages