using python to automate data translation process from eprime to SPSS
David McFarlane
mcfarla9 at msu.edu
Mon Aug 20 18:37:56 UTC 2012
Kyle,
Not sure I entirely understand your request, but I gather it has
something vaquely to do with wanting to automate the processing of
batches of single data files. I realize E-DataAid does not include a
mechanism to handle *batches* of .edat files, but you might try the
free AutoIt (http://www.autoitscript.com/site/autoit/ ) as a
scripting tool to automate such a batch process using E-DataAid. If
you do that, please write back!
Addressing your more specific question, AFAIK there is no
documentation of E-Prime's data .txt format. But really, the format
is quite readable, and anyone with a modicum of skill could figure it
out just by generating a judicious set of examples and reading
them. Students here have done it from time to time (goodness knows
why), and I could do it myself, but I have never found a good reason to bother.
-----
David McFarlane
E-Prime training
online: http://psychology.msu.edu/Workshops_Courses/eprime.aspx
Twitter: @EPrimeMaster (twitter.com/EPrimeMaster)
At 8/19/2012 05:55 AM Sunday, Peter Quain wrote:
>Don't know why you'd want to go to this effort to save a single menu
>driven operation (save as), but at least as a start it seems ...
>That asterisks are Section delimiters (e.g., *** Header Start ***
>and *** Header Ends *** ... or *** LogFrame Start *** and ***
>LogFrame End ***); within all Sections each line records a variable
>name and value; that the colon (:) delimits variable name and value
>per line within Sections; and that Level numbers in the colon
>delimited format occur on lines between asterisk delimited section
>End and Start statements. The Experiment structure exists as a
>hierarchy of n levels: (descending ...) Session (Experiment) / Block
>/ Trial/ ... withSubTrial elements 1 ...n ... or something like
>that. SubTrial elements are logged attributes from a trial sequence,
>and in my sample file all occur as children of Level 3. Now it is a
>matter of constructing an algorithm which transposes this (well, the
>correct ...) file structure appropriately to dispense with useless
>data and collect single variables of interest in single columns, not
>multiple rows across sections.
>
>It is perhaps possible that you could accomplish this within SPSS
>using (as a starting point) String Function syntax embedded in
>Python script looping structures. The raw .txt file will import into
>SPSS as a single string variable if you define no delimiter, and the
>text qualifier as 'Nothing'. So in fact it is easy to circumvent
>edataaid in terms of getting the edat .txt format data file into
>SPSS, it is as you say the parsing which presents the exercise.
>Maybe you would be looking for SubTrial elements logged after a
>Level 3 Section was identified, and prior to a *** LogFrame End***
>statement. I think though that it might be equally possible to parse
>the file using Python libraries alone (as has obviously been done by
>mysterious python forum person(s) with their tab-del output) ... I
>suppose you would look for string functions to parse the file, array
>commands to format the data, and write(?) commands to set the file
>to disk. (?) Of course, there are many ways to skin a cat. But in
>any way it is correctly capturing the data elements sequentially
>from each Level 3 (in my example) child that will perhaps win the
>beginning of the day at least.
>
>Best
>Peter
>
>
>
>At 01:27 PM 19/08/2012, you wrote:
>>Thank you for your reply Peter but that is not exactly what I was
>>looking for and I probably did not clarify enough. I know how to
>>use EdataAid, I just want a way to circumvent it. If you look in
>>the folder where your edat files are stored there is also a .txt
>>file with the data information. I was wondering if I could somehow
>>translate this file into something useable and skip edataid all
>>together. I am trying to automate the process so I can do it with
>>a large amount of data all at once and ensure that it is all done
>>the same way without having to worry about human error (like when
>>someone accidentally forgets to uncheck the unicode box or clicks
>>on the wrong thing). It looks like the txt file contains the data
>>from the experiment but it looks all jumbled up and in one
>>column. Someone on the python forums said that they had created
>>script that would parse out the data from that text file and make
>>it usable. Unfortunately they did not really elaborate how to do
>>that. Thank you again for your reply Peter and I hope I helped
>>clear things up a bit.
>>-Kyle
>>
>>On Saturday, August 18, 2012 7:33:05 PM UTC-4, Kyle wrote:
>>Hello,
>>I am currently struggling with trying to automate my data
>>translation process from eprime to SPSS. I am not using emerge
>>because I need to create individual spss data files for each of my
>>subjects. I have written sytax that automates the translation from
>>the edat output (tab-separated) to an SPSS data file but I need to
>>figure out a way to circumvent e-dataAid so I can automate the
>>whole process and reduce the chance of any errors during the
>>process. I was planning on using python so that I could have the
>>user select the files that they want to convert to SPSS and then it
>>does it automatically. From what I gathered from python help
>>forums is that I need to parse the raw data txt document into a
>>tab-separated file. Is there a way to do this or documentation how
>>to do this somewhere? The workflow would be something like: raw
>>data txt file --> tab separated --> spss syntax (it reads from a
>>list file I created in spss) --> spss data file. I think the main
>>spot I am stuck at is parsing the data from the raw file so I can
>>circumvent edataAid. From there it seems like it might be somewhat
>>straightforward. Thank you in advance for any help you can
>>provide. If you have any tips for the python part of this process
>>that would be appreciated as well, but I know the group is for
>>e-prime and do not expect help with that.
>>Thank you,
>>-Kyle
--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
More information about the Eprime
mailing list