Skip to content
Snippets Groups Projects
Commit ddf14f01 authored by Your Name's avatar Your Name
Browse files

Update ExtractData script

parent 03f03cd6
No related branches found
No related tags found
No related merge requests found
from org.csstudio.opibuilder.scriptUtil import PVUtil from org.csstudio.opibuilder.scriptUtil import PVUtil
from os.path import expanduser from os.path import expanduser
#! /usr/bin/env python
#from org.csstudio.opibuilder.scriptUtil import PVUtil
import struct import struct
#import matplotlib.pyplot as plt
#import urllib2
import json import json
from random import betavariate from random import betavariate
import math import math
...@@ -54,21 +49,21 @@ PlotFile.write("fichier emittance: X\n") ...@@ -54,21 +49,21 @@ PlotFile.write("fichier emittance: X\n")
PlotFile.write("HT ion (kV) : %d\n"%(Energie)) PlotFile.write("HT ion (kV) : %d\n"%(Energie))
PlotFile.write("frequence (Hz) : %d\n"%(Frequence)) PlotFile.write("frequence (Hz) : %d\n"%(Frequence))
PlotFile.write("N points temps : 1\n") PlotFile.write("N points temps : 1\n")
PlotFile.write("pas de position (mm) : %d\n"%(PasMM)) PlotFile.write("pas de position (mm) : %f\n"%(PasMM))
PlotFile.write("N points position (mm) : %i\n"%(NbPos)) PlotFile.write("N points position (mm) : %i\n"%(NbPos))
PlotFile.write("N points angle (mrad) : %i\n"%(NbAngle)) PlotFile.write("N points angle (mrad) : %i\n"%(NbAngle))
## POSITION ## POSITION
PlotFile.write("vecteur positions (mm) : ") PlotFile.write("vecteur positions (mm) : ")
for value in range(0,NbPos): for value in range(0,NbPos):
PlotFile.write("%d "%tabPos[value]); PlotFile.write("%.2f "%tabPos[value]);
value=value+1 value=value+1
## ANGLES ## ANGLES
PlotFile.write("\nvecteur angles (mrad) : ") PlotFile.write("\nvecteur angles (mrad) : ")
indAngle=0 indAngle=0
for value in range(0,NbAngle): for value in range(0,NbAngle):
PlotFile.write("%f "%tabAng[indAngle]); PlotFile.write("%.2f "%tabAng[indAngle]);
indAngle=indAngle+NbPos indAngle=indAngle+NbPos
PlotFile.write("\ntype d'ion : PROTON...") PlotFile.write("\ntype d'ion : PROTON...")
...@@ -76,10 +71,10 @@ PlotFile.write("\ncolonnes de 1 a 4 : indice de temps / indice position / indice ...@@ -76,10 +71,10 @@ PlotFile.write("\ncolonnes de 1 a 4 : indice de temps / indice position / indice
## POSITION/ANGLE/INTENSITY ## POSITION/ANGLE/INTENSITY
indCurrent=NbPos-1 indCurrent=NbPos-1
indPos=NbPos-1 indPos=NbPos
for valuePos in range(0,NbPos): for valuePos in range(0,NbPos):
for valueAngle in range(0,NbAngle): for valueAngle in range(0,NbAngle):
PlotFile.write("0\t%i\t%i\t%f\n" %(valuePos,valueAngle,tabCurr[indCurrent])); PlotFile.write("0\t%i\t%i\t%.4f\n" %(valuePos,valueAngle,tabCurr[indCurrent]));
indCurrent=indCurrent+NbPos indCurrent=indCurrent+NbPos
indPos=indPos-1 indPos=indPos-1
indCurrent=indPos indCurrent=indPos
...@@ -92,21 +87,19 @@ PlotFile.close() ...@@ -92,21 +87,19 @@ PlotFile.close()
################################################################################### ###################################################################################
#### OPEN FILE #### OPEN FILE
#PlotFile = open('/home/catane/data/'+NameFile+"-avg.txt", 'w+') PlotFile = open(home+'/data/emit/averageDataEmit/'+"avg-"+NameFile, 'w+')
## POSITION/ANGLE/INTENSITY ## POSITION/ANGLE/INTENSITY
#indTab=NbPos-1 indAngle=NbPos-1
#indPos=NbPos-1 indCurrent=NbPos-1
indPos=NbPos
##for valuePos in tabPos: for valuePos in range(0,(NbPos)):
# for valueAngle in range(0,NbAngle): for valueAngle in range(0,NbAngle):
#PlotFile.write("0\t%d\t%d\t%d\n" %(valuePos[indPos],valueAngle[indAngle],tabCurr[indCurrent])); PlotFile.write("\n%.2f\t\t%.2f\t\t%.4f\n " %(tabPos[valuePos],tabAng[indAngle],tabCurr[indCurrent]));
# PlotFile.write("%d\t%d\t%d\n" %(valuePos,tabAng[indTab],tabCurr[indTab])); indAngle=indAngle+NbPos
indCurrent=indCurrent+NbPos
#indCurrent=indCurrent+NbPos indPos=indPos-1
## indTab=indTab+NbPos indAngle=indPos
# indPos=indPos-1 indCurrent=indPos
#indCurrent=indPos
# indTab=indPos
#PlotFile.close() PlotFile.close()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment