Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #1837 > unrolled thread

Extracting data from datafiles

Started bysander.peter@lycos.com
First post2013-05-19 08:32 -0700
Last post2013-05-20 22:44 +0700
Articles 4 — 3 participants

Back to article view | Back to comp.graphics.apps.gnuplot


Contents

  Extracting data from datafiles sander.peter@lycos.com - 2013-05-19 08:32 -0700
    Re: Extracting data from datafiles sfeam <sfeam@users.sourceforge.net> - 2013-05-19 10:04 -0700
      Re: Extracting data from datafiles sander.peter@lycos.com - 2013-05-19 13:07 -0700
    Re: Extracting data from datafiles Michael <proximum@land.ru> - 2013-05-20 22:44 +0700

#1837 — Extracting data from datafiles

Fromsander.peter@lycos.com
Date2013-05-19 08:32 -0700
SubjectExtracting data from datafiles
Message-ID<ae317923-11e7-4ddf-aee7-c53a327f5d9b@googlegroups.com>
Hi,

I have many long datafiles like this:

...
_Flags = 5
_StepTime = 0.2
_StepSize = 0.024
_2d = 8.7522
_LineName = "Cu KA1-HS-Min"
_X-Counts
15.000	493.2
15.024	485.2
15.048	514.3
15.072	453.2
15.096	443.2
15.120	470.2
15.144	432.2
15.168	448.2
...

Now I'd like to use the value of StepTime and 2d (2.2 and 8.7522 in this case) as a variable affecting the data in both columns, before plotting.

How to get these two numbers out of each datafile ?

Thanks already

[toc] | [next] | [standalone]


#1838

Fromsfeam <sfeam@users.sourceforge.net>
Date2013-05-19 10:04 -0700
Message-ID<knb0fr$qcm$1@dont-email.me>
In reply to#1837
sander.peter@lycos.com wrote:

> Hi,
> 
> I have many long datafiles like this:
> 
> ...
> _Flags = 5
> _StepTime = 0.2
> _StepSize = 0.024
> _2d = 8.7522
> _LineName = "Cu KA1-HS-Min"
> _X-Counts
> 15.000	493.2
> 15.024	485.2
> 15.048	514.3
> 15.072	453.2
> 15.096	443.2
> 15.120	470.2
> 15.144	432.2
> 15.168	448.2
> ...
> 
> Now I'd like to use the value of StepTime and 2d (2.2 and 8.7522 in
> this case) as a variable affecting the data in both columns, before
> plotting.
> 
> How to get these two numbers out of each datafile ?

How about 
    load "< head -5 datafile"
That will execute the first five lines, so now you have those 
five variables defined.

[toc] | [prev] | [next] | [standalone]


#1839

Fromsander.peter@lycos.com
Date2013-05-19 13:07 -0700
Message-ID<087febf0-043c-4ec9-ab62-700aa563ecfb@googlegroups.com>
In reply to#1838
Op zondag 19 mei 2013 19:04:42 UTC+2 schreef sfeam het volgende:
> sander.peter@lycos.com wrote:
> 
> 
> 
> > Hi,
> 
> > 
> 
> > I have many long datafiles like this:
> 
> > 
> 
> > ...
> 
> > _Flags = 5
> 
> > _StepTime = 0.2
> 
> > _StepSize = 0.024
> 
> > _2d = 8.7522
> 
> > _LineName = "Cu KA1-HS-Min"
> 
> > _X-Counts
> 
> > 15.000	493.2
> 
> > 15.024	485.2
> 
> > 15.048	514.3
> 
> > 15.072	453.2
> 
> > 15.096	443.2
> 
> > 15.120	470.2
> 
> > 15.144	432.2
> 
> > 15.168	448.2
> 
> > ...
> 
> > 
> 
> > Now I'd like to use the value of StepTime and 2d (2.2 and 8.7522 in
> 
> > this case) as a variable affecting the data in both columns, before
> 
> > plotting.
> 
> > 
> 
> > How to get these two numbers out of each datafile ?
> 
> 
> 
> How about 
> 
>     load "< head -5 datafile"
> 
> That will execute the first five lines, so now you have those 
> 
> five variables defined.

Thanks for your reply,
but It doesn't work for me (gnuplot 4.6 with WinXP) ...

[toc] | [prev] | [next] | [standalone]


#1840

FromMichael <proximum@land.ru>
Date2013-05-20 22:44 +0700
Message-ID<kndg57$mij$1@dont-email.me>
In reply to#1837
19.05.2013 22:32, sander.peter@lycos.com пишет:
> Hi,
>
> I have many long datafiles like this:
>
> ...
> _Flags = 5
> _StepTime = 0.2
> _StepSize = 0.024
> _2d = 8.7522
> _LineName = "Cu KA1-HS-Min"
> _X-Counts
> 15.000	493.2
> 15.024	485.2
> 15.048	514.3
> 15.072	453.2
> 15.096	443.2
> 15.120	470.2
> 15.144	432.2
> 15.168	448.2
> ...
>
> Now I'd like to use the value of StepTime and 2d (2.2 and 8.7522 in this case) as a variable affecting the data in both columns, before plotting.
>
> How to get these two numbers out of each datafile ?
>
> Thanks already

You can use some external tools: grep, sed, or programming languages: 
perl, python, or any other language, to extract data from your input 
files. I, for example, am using perl for creating both datasets and 
gnuplot scripts.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.graphics.apps.gnuplot


csiph-web