Batch/mass-convert EDAT3 files to CSV
Dear PST Product service & support, dear users,
i'm supporting an automatisation evaluation of eprime edat3 Files. We have a license and all the associated tools.
I googled and searched the forum, but didn't find anything:
Our problem right now:
We have ~500 edat3 files, which we need to be converted to -> CSV as a single dataset. (no merge -> one edat3 -> one csv file for further working on)
I know that merging has a purporse, but in our use case the converted CSV will be evaluated as one file => result and then we merge this later.
Is there any way to do this besides opening the edat3 file with edata-aid and saving? this would be time consuming :/
I just found this:
https://github.com/tsalo/convert-eprime
Edit: i tested it and it doesn't work with edat3 files.
Thanks in advance.
Best Regards
Tim Rachul
-
Well that Python script certainly is an interesting find. I suppose one might adapt it to work with edat3 files. As far as I can tell, little or nothing has changed in the edat file format from 2 to 3, other than changing the file extension from edat2 to edat3.
Other than developing your own software tool to do the mass conversion, you might have to convert each file individually using E-DataAid 3. Might turn out to be the same amount of labor either way, but it might help the community if you developed the batch conversion tool and released it.
-
I wrote a simple Windows PowerShell script to automate the conversion of edat to csv.
# Dennis Thompson UC Davis Imaging Research Center
# Escape Path Delimiters
# Remember to add Delimiter to end of path
# ControlFile is used by E-DataAid to control the command line conversion
# Location where ControlFile will be written
$ControlFile='C:\\temp\\Nback_Megan\\ControlFile.txt'
# Where to write output files
$OutPutLoc='C:\\temp\\Nback_Megan\\converted\\'
# Where RAW edat files are located
$EdatLoc='C:\\temp\\Nback_Megan\\'
# Filter used to select files
$EdatFilter='*.edat2'
# E-DataAid Location
#$DataAid='C:\Program Files (x86)\PST\E-Prime 2.0\Program\E-DataAid.exe'
$DataAid='C:\Program Files (x86)\PST\E-Prime 2.0\Program\'
# DataAid Options
$Options='/e /f'
$files=get-childitem $EdatLoc -include $EdatFilter -nameForEach($infile in $files){
# get the base name of the edat file
$foo = $infile.split(".")
$newname = $foo[0]
# output name of file being converted
echo $infile
$strings=@()
$strings+="Inheritance=NULL"
$strings+="InFile=$EdatLoc$infile"
$strings+="OutFile=$OutPutLoc$newname.csv"
$strings+="ColFlags=1"
$strings+="ColNames=1"
$strings+="Comments=1"
$strings+="BegCommentLine="
$strings+="EndCommentLine="
$strings+="DataSeparator=,"
$strings+="VarSeparator=,"
$strings+="BegDataLine="
$strings+="EndDataLine="
$strings+="MissingData=NaN"
$strings+="Unicode=0"
$strings | Set-Content -Path $ControlFile
#Get-Content -Path $ControlFile
start-process "E-DataAid.exe" -ArgumentList "$Options $ControlFile" -Wait -WorkingDirectory "$DataAid"
$filedata = Get-Content "$OutPutLoc$newname.csv"
#$filedata[4..($filedata.length - 1)] | sc "$OutPutLoc$newname.txt" -Encoding ASCII
$filedata[4..($filedata.length - 1)] | Set-Content -Path "$OutPutLoc$newname.csv"}
-
Very nice -- I never thought about running E-DataAid as a command-prompt program. Now I see that this is documented at https://support.pstnet.com/hc/en-us/articles/360020316014-INFO-Using-E-DataAid-exe-with-Command-Line-Interpreters-25323-
-
Hi, Dennis, I tried to run your pwsh scripts, but encounter the following errors on line 46"
Line |
46 | … $filedata = Get-Content "D:\My Experiments\3.0\MWTC Cognitive Tasks\C …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot find path 'D:\My Experiments\3.0\MWTC Cognitive Tasks\Converted\Sub1 - Cognitive Tasks-9-4.csv' because it does not exist.
InvalidOperation:
Line |
48 | $filedata[4..($filedata.length - 1)] | Set-Content -Path "$OutPut …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot index into a null array.Any suggestions to fix the error? Greatly appreciated!
-
PMJI ... Offhand, I would say that the file 'D:\My Experiments\3.0\MWTC Cognitive Tasks\Converted\Sub1 - Cognitive Tasks-9-4.csv' failed to be created -- have you looked in the folder to see whether or not the file actually exists? I would also try manually entering a command equivalent to line 45 and see what happens, especially to see whether it creates the specified file. Etc.
And now that I look back at the request that started this thread -- Tim Rachul seems to say that he wants to end up with a single .csv file that contains all the data (as opposed to a single .csv file for each run). For that, I would simply use E-Merge to pull all the data into a single E-DataAid file, and then export that .edat3 file to .csv. Don't know why I did not think of that before.
-
Heads up, this script doesn't work. Please contact me at support@scrapero.com if you need a working script.
Please sign in to leave a comment.
Comments
7 comments