ValueError: A value in x_new is above the interpolation range

2,482 views
Skip to first unread message

Fabio da Silva

unread,
May 25, 2018, 2:33:52 PM5/25/18
to gprMax-users
Hello group,

I recently got a Linux box with Ubuntu 16.04 installed with a Titan V gpu (details on the install available if needed). I ran some test simulations including some I was running with a K20c on a Windows 10 box. I have seen the following message during waveform loading:

User waveform pulse0 created using simulation time array and, if required, interpolation parameters (kind: linear, fill value: nan).

And then, after all waveforms are loaded, I get the error:

ValueError: A value in x_new is above the interpolation range.

The entire chain goes below. Any hint as to why I am getting those errors on a Titan V/Linux versus a K20c/W10?

Cordially,
Fabio.

Traceback (most recent call last):
  File "/home/fcss/miniconda3/envs/gprMax/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/fcss/miniconda3/envs/gprMax/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/fcss/miniconda3/envs/gprMax/lib/python3.6/site-packages/gprMax-3.1.3-py3.6-linux-x86_64.egg/gprMax/__main__.py", line 6, in <module>
    gprMax.gprMax.main()
  File "/home/fcss/miniconda3/envs/gprMax/lib/python3.6/site-packages/gprMax-3.1.3-py3.6-linux-x86_64.egg/gprMax/gprMax.py", line 70, in main
    run_main(args)
  File "/home/fcss/miniconda3/envs/gprMax/lib/python3.6/site-packages/gprMax-3.1.3-py3.6-linux-x86_64.egg/gprMax/gprMax.py", line 203, in run_main
    run_std_sim(args, inputfile, usernamespace)
  File "/home/fcss/miniconda3/envs/gprMax/lib/python3.6/site-packages/gprMax-3.1.3-py3.6-linux-x86_64.egg/gprMax/gprMax.py", line 244, in run_std_sim
    run_model(args, currentmodelrun, modelend - 1, numbermodelruns, inputfile, modelusernamespace)
  File "/home/fcss/miniconda3/envs/gprMax/lib/python3.6/site-packages/gprMax-3.1.3-py3.6-linux-x86_64.egg/gprMax/model_build_run.py", line 154, in run_model
    process_multicmds(multicmds, G)
  File "/home/fcss/miniconda3/envs/gprMax/lib/python3.6/site-packages/gprMax-3.1.3-py3.6-linux-x86_64.egg/gprMax/input_cmds_multiuse.py", line 230, in process_multicmds
    h.calculate_waveform_values(G)
  File "/home/fcss/miniconda3/envs/gprMax/lib/python3.6/site-packages/gprMax-3.1.3-py3.6-linux-x86_64.egg/gprMax/sources.py", line 67, in calculate_waveform_values
    self.waveformvaluesJ[iteration] = waveform.calculate_value(time + 0.5 * G.dt, G.dt)
  File "/home/fcss/miniconda3/envs/gprMax/lib/python3.6/site-packages/gprMax-3.1.3-py3.6-linux-x86_64.egg/gprMax/waveforms.py", line 118, in calculate_value
    ampvalue = self.userfunc(time)
  File "/home/fcss/miniconda3/envs/gprMax/lib/python3.6/site-packages/scipy/interpolate/polyint.py", line 79, in __call__
    y = self._evaluate(x)
  File "/home/fcss/miniconda3/envs/gprMax/lib/python3.6/site-packages/scipy/interpolate/interpolate.py", line 634, in _evaluate
    below_bounds, above_bounds = self._check_bounds(x_new)
  File "/home/fcss/miniconda3/envs/gprMax/lib/python3.6/site-packages/scipy/interpolate/interpolate.py", line 666, in _check_bounds
    raise ValueError("A value in x_new is above the interpolation "
ValueError: A value in x_new is above the interpolation range.


Craig Warren

unread,
May 29, 2018, 11:06:07 AM5/29/18
to gprMax-users
Hi Fabio,

As you can see the error is related to the interpolation of values in your user waveform. We use scipy interpolate to do the interpolation. The error suggests something in your pulse or time sampling is causing the interpolation to fail. Try using ‘extrapolate’ as the fill value to see if that helps.

I would be interested in seeing some benchmarks from the TITAN V GPU as this is one we have not yet tested with.

Kind regards,

Craig

Fabio da Silva

unread,
May 29, 2018, 4:18:00 PM5/29/18
to gprMax-users
Craig,

your suggestion worked. Sorry I missed that line in the API documentation.

Also, if you have a problem to benchmark the performance of gprMax, I'd be happy to run it for you and send you the report. From the K20c running on W10, I got a factor of 4.4 times speed up on the Titan V running on the Linux box. This may still not be apples to apples per se from other hardware factors I was not able to keep constant.

Cordially,
Fabio.
Message has been deleted

Lun MA

unread,
Aug 7, 2018, 8:07:13 AM8/7/18
to gprMax-users
Hi Graig,
I used Matlab to generate a waveform in this way
"A = [t;s2];
fileID = fopen('my_waves.txt','w');
fprintf(fileID,'%s %s\r\n','time','my_pulse1');
fprintf(fileID,'%e %e\r\n',A);
fclose(fileID);"
where t is time array and s2 is corresponding waveform.

After I apply this txt file into the simulation, I got the same error as Fabio. So I followed your suggestion of modifying the API documentation in this way

#excitation_file: my_waves.txt [linear extrapolate]

But I got the following error:
Excitation file: my_waves.txt
Traceback (most recent call last):
  File "C:\Users\lm256f\AppData\Local\Continuum\miniconda3\envs\gprMax\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\lm256f\AppData\Local\Continuum\miniconda3\envs\gprMax\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\lm256f\AppData\Local\Continuum\miniconda3\envs\gprMax\lib\site-packages\gprmax-3.1.3-py3.6-win-amd64.egg\gprMax\__main__.py", line 6, in <module>
    gprMax.gprMax.main()
  File "C:\Users\lm256f\AppData\Local\Continuum\miniconda3\envs\gprMax\lib\site-packages\gprmax-3.1.3-py3.6-win-amd64.egg\gprMax\gprMax.py", line 70, in main
    run_main(args)
  File "C:\Users\lm256f\AppData\Local\Continuum\miniconda3\envs\gprMax\lib\site-packages\gprmax-3.1.3-py3.6-win-amd64.egg\gprMax\gprMax.py", line 203, in run_main
    run_std_sim(args, inputfile, usernamespace)
  File "C:\Users\lm256f\AppData\Local\Continuum\miniconda3\envs\gprMax\lib\site-packages\gprmax-3.1.3-py3.6-win-amd64.egg\gprMax\gprMax.py", line 244, in run_std_sim
    run_model(args, currentmodelrun, modelend - 1, numbermodelruns, inputfile, modelusernamespace)
  File "C:\Users\lm256f\AppData\Local\Continuum\miniconda3\envs\gprMax\lib\site-packages\gprmax-3.1.3-py3.6-win-amd64.egg\gprMax\model_build_run.py", line 150, in run_model
    process_singlecmds(singlecmds, G)
  File "C:\Users\lm256f\AppData\Local\Continuum\miniconda3\envs\gprMax\lib\site-packages\gprmax-3.1.3-py3.6-win-amd64.egg\gprMax\input_cmds_singleuse.py", line 318, in process_singlecmds
    w.userfunc = interpolate.interp1d(waveformtime, singlewaveformvalues, **kwargs)
  File "C:\Users\lm256f\AppData\Local\Continuum\miniconda3\envs\gprMax\lib\site-packages\scipy\interpolate\interpolate.py", line 445, in __init__
    "routines for other types." % kind)
NotImplementedError: [linear is unsupported: Use fitpack routines for other types.

Cos I didn't find any example in the user guide, so have no idea how it goes. BTW, I've tried other "kind", like ‘nearest’, ‘zero’, ‘slinear’, ‘quadratic’, ‘cubic’, ‘previous’, ‘next’
Please favor me with your instruction, Thank you.

Craig Warren

unread,
Aug 7, 2018, 10:05:09 PM8/7/18
to gprMax-users
Hi Lun,

I think the problem is simply that you are using square brackets in the command and they are not necessary, i.e.

#excitation_file: my_waves.txt linear extrapolate

Kind regards,

Craig

Lun MA

unread,
Aug 8, 2018, 9:02:33 AM8/8/18
to gprMax-users
Hi Craig,

Your suggestion works. I misread the user guide. Thanks

Cheers,

Lun 
Reply all
Reply to author
Forward
0 new messages