abort/continue plotting on error

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

abort/continue plotting on error

seb_kramm
Hello,

Currently, when chaining different plot commands in a script, it seems that gnuplot
aborts when encountering a error (unreadable data file, in my case).

Is there any way to tell gnuplot not to abort and to move on to the next 'plot'
command ? I searched the manual but found nothing about error handling.

I use 4.6 on Ubuntu.

The situation is as follows: I have many plots to draw from many computer-generated
data files. The script file is itself generated. Now, some data files are ill formed
or non-existent, due to some experimental error (say, the program that generates the
data crashes).
But I would like to have the plots for all the other datafiles.

I could manually edit the generated script file and remove the "bad" plot commands,
but this will be tedious (I have many of these).

Thanks for any advice on the best way to handle this.

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
gnuplot-info mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gnuplot-info
Reply | Threaded
Open this post in threaded view
|

Re: abort/continue plotting on error

Ethan A Merritt-2
On Friday, 26 April 2013, seb_kramm wrote:
> Hello,
>
> Currently, when chaining different plot commands in a script, it seems that gnuplot
> aborts when encountering a error (unreadable data file, in my case).
>
> Is there any way to tell gnuplot not to abort and to move on to the next 'plot'
> command ? I searched the manual but found nothing about error handling.

There is no general mechanism for continuing to execute a script after an error.

> I use 4.6 on Ubuntu.
>
> The situation is as follows: I have many plots to draw from many computer-generated
> data files. The script file is itself generated. Now, some data files are ill formed
> or non-existent, due to some experimental error (say, the program that generates the
> data crashes).
> But I would like to have the plots for all the other datafiles.

How about

  expected_file = "filename"
  stat = system("wc ".expected_file)
  if (stat ne "") {
     plot expected_file
  }

If you want to test for a file that exists but is too short to
contain the expected data:

  stat = system("wc ".expected_file)
  if (stat ne ""  &&  int(word(stat,1)) > min_size) {
    plot expected_file
  }

        Ethan

--
Tradition is not the worship of ashes, but the preservation of fire.
  - Gustav Mahler

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
gnuplot-info mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gnuplot-info
Reply | Threaded
Open this post in threaded view
|

Re: abort/continue plotting on error

seb_kramm
On 04/27/2013 05:54 AM, Ethan A Merritt wrote:
> On Friday, 26 April 2013, seb_kramm wrote:
>> Currently, when chaining different plot commands in a script, it seems that gnuplot
>> aborts when encountering a error (unreadable data file, in my case).
>> Is there any way to tell gnuplot not to abort and to move on to the next 'plot'
>> command ? I searched the manual but found nothing about error handling.
>
> There is no general mechanism for continuing to execute a script after an error.

Thanks, indeed this would be a non trivial thing to adress.

>> The situation is as follows: I have many plots to draw from many computer-generated
>> data files. The script file is itself generated. Now, some data files are ill formed
>> or non-existent, due to some experimental error (say, the program that generates the
>> data crashes).
>> But I would like to have the plots for all the other datafiles.
>
> How about
>
>    expected_file = "filename"
>    stat = system("wc ".expected_file)
>    if (stat ne "") {
>       plot expected_file
>    }
>
> If you want to test for a file that exists but is too short to
> contain the expected data:
>
>    stat = system("wc ".expected_file)
>    if (stat ne ""  &&  int(word(stat,1)) > min_size) {
>      plot expected_file
>    }

Woaw, really clever trick, I didn't realize you could call shell commands from within
gnuplot. I will implement this, but the second version will not apply, as my data
files don't always have the same number of data points.
Thank you Ethan.

Sebastien Kramm




------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
gnuplot-info mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gnuplot-info
Reply | Threaded
Open this post in threaded view
|

Re: abort/continue plotting on error

walter harms


Am 27.04.2013 16:26, schrieb seb_kramm:

> On 04/27/2013 05:54 AM, Ethan A Merritt wrote:
>> On Friday, 26 April 2013, seb_kramm wrote:
>>> Currently, when chaining different plot commands in a script, it seems that gnuplot
>>> aborts when encountering a error (unreadable data file, in my case).
>>> Is there any way to tell gnuplot not to abort and to move on to the next 'plot'
>>> command ? I searched the manual but found nothing about error handling.
>>
>> There is no general mechanism for continuing to execute a script after an error.
>
> Thanks, indeed this would be a non trivial thing to adress.
>
>>> The situation is as follows: I have many plots to draw from many computer-generated
>>> data files. The script file is itself generated. Now, some data files are ill formed
>>> or non-existent, due to some experimental error (say, the program that generates the
>>> data crashes).
>>> But I would like to have the plots for all the other datafiles.
>>
>> How about
>>
>>    expected_file = "filename"
>>    stat = system("wc ".expected_file)
>>    if (stat ne "") {
>>       plot expected_file
>>    }
>>
>> If you want to test for a file that exists but is too short to
>> contain the expected data:
>>
>>    stat = system("wc ".expected_file)
>>    if (stat ne ""  &&  int(word(stat,1)) > min_size) {
>>      plot expected_file
>>    }
>
> Woaw, really clever trick, I didn't realize you could call shell commands from within
> gnuplot. I will implement this, but the second version will not apply, as my data
> files don't always have the same number of data points.
> Thank you Ethan.
>
> Sebastien Kramm
>
>
hi,
just in case you simply want to check that you have a filesize > 0
test -s FILE would do the trick.
An other funny trick is to use stat.
stat -c "%s" FILE
It read the file system information instead of scanning the whole file.

just my 2 cents.
re,
 wh




------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
gnuplot-info mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gnuplot-info
Reply | Threaded
Open this post in threaded view
|

Re: abort/continue plotting on error

Tait-2
In reply to this post by Ethan A Merritt-2
> How about
>
>   expected_file = "filename"
>   stat = system("wc ".expected_file)
>   if (stat ne "") {
>      plot expected_file
>   }
>
> If you want to test for a file that exists but is too short to
> contain the expected data:
>
>   stat = system("wc ".expected_file)
>   if (stat ne ""  &&  int(word(stat,1)) > min_size) {
>     plot expected_file
>   }
>
> Ethan


You don't happen to have any similarly clever tricks that would work on
Windows, do you? (Gnuplot on windows does not support capturing system(),
``, etc.)

I've seen requests before for an option to disable gnuplot warnings (not
errors, necessarily, as recovery could be tricky). The noise can be
excessive when running in batch mode to create a large number of plots,
where empty data files or single-value ranges (for example) are not
worrisome.

(Sorry if this comes through twice.)


------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
gnuplot-info mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gnuplot-info