Dear Didier,
Would you mind sharing any scripts that read .dst and .plt binary files, as described on p.38 of the user's manual?
Best regards,
Wai-Ming
Reading dst and plt files
Re: Reading dst and plt files
Dear Wai-Ming
I don't get script but 'C' code source, like following to write dst file.
Regards,
Didier
I don't get script but 'C' code source, like following to write dst file.
Regards,
Didier
Code: Select all
char cc1=125,cc2=100;
FILE *f
f=fopen(dst_file,"wb");
fwrite(&cc1,sizeof(char),1,f);
fwrite(&cc2,sizeof(char),1,f);
fwrite(&nbr_part,sizeof(int),1,f); // number of particles
fwrite(&Ibeam,sizeof(double),1,f); // bema current (mA)
fwrite(&Freq,sizeof(double),1,f); // Bunch frequency (MHz)
fwrite(&cc1,sizeof(char),1,f);
for (int i=0;i<nbr_part;i++) {
fwrite(&Part[i].x,sizeof(double),1,f); // (cm)
fwrite(&Part[i].xp,sizeof(double),1,f); // (rad)
fwrite(&Part[i].y,sizeof(double),1,f); // (cm)
fwrite(&Part[i].yp,sizeof(double),1,f); // (rad)
fwrite(&Part[i].p,sizeof(double),1,f); // (rad)
fwrite(&Part[i].w,sizeof(double),1,f); // MeV
}
fwrite(&Mo,sizeof(double),1,f); // particle mass (MeV)
fclose(f);
Re: Reading dst and plt files
Dear Didier and Wai-Ming,
I have posted some MATLAB scripts for TraceWin to read .dat file on my webpage with following link,
https://apathakacceleratophysics.zyrosite.com/page-2
I too have a script that can read .plt file. Please let me know if that's needed and I will be happy to help.
With Regards
Abhidhek Pathak
I have posted some MATLAB scripts for TraceWin to read .dat file on my webpage with following link,
https://apathakacceleratophysics.zyrosite.com/page-2
I too have a script that can read .plt file. Please let me know if that's needed and I will be happy to help.
With Regards
Abhidhek Pathak
Re: Reading dst and plt files
Dear Abhishek,
Thank a lot to share with us. But most of your links are password protected and moreover I don't see any concerning the reading of plt.
Regards,
Didier
Thank a lot to share with us. But most of your links are password protected and moreover I don't see any concerning the reading of plt.
Regards,
Didier
Re: Reading dst and plt files
Dear Didier,
My apologies for the inconvenience caused. Here I am attaching the Matlab scripts reading the .dst and .plt file in a .zip format. The scripts that are attached may require some variable changes like particle number or file name but the architecture remain the same.
Thank you
With Regards
Abhishek Pathak
My apologies for the inconvenience caused. Here I am attaching the Matlab scripts reading the .dst and .plt file in a .zip format. The scripts that are attached may require some variable changes like particle number or file name but the architecture remain the same.
Thank you
With Regards
Abhishek Pathak
- Attachments
-
- dst and plt reader.zip
- (1.55 KiB) Downloaded 199 times
Re: Reading dst and plt files
Dear Abhishek,
Thank you, I am sure it will be very useful for many.
Regards,
Didier
Thank you, I am sure it will be very useful for many.
Regards,
Didier
-
- Initiated
- Posts: 34
- Joined: Fri 5 Mar 2021 10:40
- Location: ESS, Sweden
- Country:
Norway (no)
Re: Reading dst and plt files
Hi Didier,
On this topic, we have a script for reading the plt files in Python, but I was recently made aware that we are not able to read the files with compression. Looking in the manual I do not see how this compression is done. I was wondering therefore if you could provide a similar code snippet to show how you do it?
On this topic, we have a script for reading the plt files in Python, but I was recently made aware that we are not able to read the files with compression. Looking in the manual I do not see how this compression is done. I was wondering therefore if you could provide a similar code snippet to show how you do it?
Re: Reading dst and plt files
Dear Abhishek,
I have upgraded the documentation to explain the first 2 levels of compression (page 39), the third and last is not relevant.
Regards,
Didier
I have upgraded the documentation to explain the first 2 levels of compression (page 39), the third and last is not relevant.
Regards,
Didier
Re: Reading dst and plt files
Dear Didier,
Thank you very much for updating the documentation. I am sure it will be very helpful for all TraceWin users.
With Regards
Abhishek Pathak
Thank you very much for updating the documentation. I am sure it will be very helpful for all TraceWin users.
With Regards
Abhishek Pathak