The latest version of the synApps quadEM module:
http://cars.uchicago.edu/software/epics/quadEM.html
does exactly what Ben describes. It uses an SNL program to compute the FFT of time-series data each time the time-series acquisition is complete.
Mark
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Benjamin Franksen
Sent: Thursday, September 27, 2012 2:21 PM
To: [email protected]
Subject: Re: How can I collect data values
Am Donnerstag, 27. September 2012, 16:43:59 schrieb Kai Stein:
> I'm working on an automatic data analysis of electron beam (emittance
> measurement with a wire scanner and a magnetic lens) with EPICS.
> I get values from the hardware (self build measurement cards). The
> device support put the values into a longin records (this part is fixed,
> because it is already used for other applications).
> I need to gather the values (will be a position and a corresponding
> current) for a certain amount of time (approximately 1000 to 10000
> values) and then hand it over to a subroutine, to perform the analysis
> (like fitting a curve onto the data). It should all run on a debian
> machine.
>
> My problem is to collect the data with EPICS. I thought about collecting
> them somehow in a waveform record, but i have no idea, how to do this by
> using other records instead of the device support.
I must admit that I have not tried it for data analysis, but I see no reason
not to use a state machine, a.k.a. an SNL program.
Let's say you wrote a C function
double do_analysis(int *meas, int count);
that actually performs the analysis. For simplicity I assume here that the
result is a single scalar, but it should be obvious how to adapt the following
to more complex results.
A little SNL program that calls the C procedure follows:
program data_analysis
We define an array of integers for the measurement data
#define N_MEAS 10000;
int measurements[N_MEAS];
assign measurements to {};
and some variables for the results; for simplicity I assume here that the
result is a single scalar
double result;
assign result to "RESULT";
Then use dynamic assign for the inputs; this is easy if your records follow a
systematic naming convention, I am assuming the most simple case here, i.e.
they are called "MEAS_0", "MEAS_1",...:
entry {
int i;
for (i=0; i<N_MEAS; i++) {
char name[10];
snprintf(name, "MEAS_%d", i);
pvAssign(measurements[i], name);
}
}
We create a state set
ss analysis {
state analyse {
when(delay(0.01)) { /*assuming 100Hz rate*/
result = do_analysis(measurements, N_MEAS);
pvPut(result);
} state analyse
}
}
Voila, that's it.
Of course this is only a rough sketch; you might want to trigger the analysis
whenever new data arrives, you may have an extra record for the actual number
of measurements, you might have more than one result (maybe an array or more
than one array) etc.pp. but I think SNL supports all this quite nicely. For
details, see http://tinyurl.com/epics-seq/
Cheers
--
Ben Franksen
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
________________________________
Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
Mitglied der Hermann von Helmholtz-Gemeinschaft Deutscher Forschungszentren e.V.
Aufsichtsrat: Vorsitzender Prof. Dr. Dr. h.c. mult. Joachim Treusch, stv. Vorsitzende Dr. Beatrix Vierkorn-Rudolph
Geschäftsführung: Prof. Dr. Anke Rita Kaysser-Pyzalla, Thomas Frederking
Sitz Berlin, AG Charlottenburg, 89 HRB 5583
Postadresse:
Hahn-Meitner-Platz 1
D-14109 Berlin
http://www.helmholtz-berlin.de