Skip to content

Commit

Permalink
Update documenaetion to match updates to BeamIO
Browse files Browse the repository at this point in the history
  • Loading branch information
longkr committed Oct 23, 2024
1 parent 071ed06 commit dcd5c0a
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 72 deletions.
15 changes: 10 additions & 5 deletions 00-Documentation/01-WriteUp/A1-MCD/A1-MCD.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2568,8 +2568,17 @@ \subsubsection{I/o methods}
\hline
\texttt{readBeamDataRecord()} & & Boolean & Manages reading/writing of a record from/to the data file.
Returns a boolean, \texttt{EoF}, set to True of end of file has been detected. \\
\texttt{readVersion()} & & Integer & Reads data-file format version number from file.
\texttt{writeFIRSTword()} & & & Writes \texttt{9999} to indicate that \texttt{BeamIO} version is $>1$.
Returns integer version number. \\
\texttt{writeVersion(version)} & string & & Writes data-file format version to file. Version is a string, e.g.
\texttt{BeamIO V3}. \\
\texttt{readVersion()} & & Integer & Reads data-file format version number from file.
Returns integer version number stripped from end of string (e.g. 3). \\
\texttt{writeREPOversion()} & & & Writes git repo Tag label, together with date/time and text description
of last commit, together with date/time. \\
\texttt{readREPOversion()} & & list & Reads and returns list of strings containing git repo Tag label,
together with date/time and text description of last commit, together
with date/time. \\
\texttt{flushNclosedataFile(dataFILE)} & Path & & Flush and close data \texttt{dataFILE} at end of processing. \\
\hline
\end{tabular}
Expand Down Expand Up @@ -2597,8 +2606,6 @@ \subsubsection{Utilities}
\end{center}
\end{table}

\FloatBarrier

\subsection{\texttt{Simulation}}
\label{SubSect:Simu}

Expand Down Expand Up @@ -2699,8 +2706,6 @@ \subsubsection{Utilities}
\noindent
The \texttt{Simulation} provides no utilities.

\FloatBarrier

\subsection{\texttt{Physical constants}}
\label{SubSect:PhysCnsts}

Expand Down
Binary file modified 00-Documentation/01-WriteUp/LhARAlinearOptics.pdf
Binary file not shown.
134 changes: 67 additions & 67 deletions 01-Code/BeamIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,23 +370,6 @@ def readBeamDataRecord(self):

return EoF

def readVersion(self):
if self.getDebug():
print(" BeamIO.readVersion start.")

brecord = self.getdataFILE().read(4)
record = strct.unpack(">i", brecord)
len = record[0]
if self.getDebug():
print(" ----> Length of version:", len)

brecord = self.getdataFILE().read(len)
Version = brecord.decode('utf-8')
if self.getDebug():
print(" <---- Version:", Version)

return Version

def writeFIRSTword(self):
dataFILE = self.getdataFILE()

Expand Down Expand Up @@ -417,64 +400,22 @@ def writeVersion(self, versionSTR=None):
print(" ----> Version:", \
bversionSTR.decode('utf-8'))

def readREPOversion(self):
if self.getDebug():
print(" BeamIO.readrepoVERSION start.")

dataFILE = self.getdataFILE()

brecord = dataFILE.read(4)
record = strct.unpack(">i", brecord)
len = record[0]
if self.getDebug():
print(" ----> Length of Tag:", len)

brecord = dataFILE.read(len)
TAG = brecord.decode('utf-8')
if self.getDebug():
print(" ----> Tag:", TAG)

brecord = dataFILE.read(4)
record = strct.unpack(">i", brecord)
len = record[0]
if self.getDebug():
print(" ----> Length of time:", len)

brecord = dataFILE.read(len)
TAGtim = brecord.decode('utf-8')
if self.getDebug():
print(" ----> Time:", TAGtim)

brecord = dataFILE.read(4)
record = strct.unpack(">i", brecord)
len = record[0]
if self.getDebug():
print(" ----> Length of commit:", len)

brecord = dataFILE.read(len)
CMMT = brecord.decode('utf-8')
def readVersion(self):
if self.getDebug():
print(" ----> Commit:", CMMT)
print(" BeamIO.readVersion start.")

brecord = dataFILE.read(4)
brecord = self.getdataFILE().read(4)
record = strct.unpack(">i", brecord)
len = record[0]
if self.getDebug():
print(" ----> Length of time:", len)
print(" ----> Length of version:", len)

brecord = dataFILE.read(len)
CMMTtim = brecord.decode('utf-8')
if self.getDebug():
print(" ----> Time:", CMMTtim)

repoVERSION = [ \
[TAG, TAGtim], [CMMT, CMMTtim] \
]

brecord = self.getdataFILE().read(len)
Version = brecord.decode('utf-8')
if self.getDebug():
print(" <----> repoVERSION:", repoVERSION)
print(" <---- Version:", Version)

return repoVERSION
return Version

def writeREPOversion(self):
dataFILE = self.getdataFILE()
Expand Down Expand Up @@ -541,6 +482,65 @@ def writeREPOversion(self):
if self.getDebug():
print(" <---- BeamIO.writeREPOversion: Done.")

def readREPOversion(self):
if self.getDebug():
print(" BeamIO.readrepoVERSION start.")

dataFILE = self.getdataFILE()

brecord = dataFILE.read(4)
record = strct.unpack(">i", brecord)
len = record[0]
if self.getDebug():
print(" ----> Length of Tag:", len)

brecord = dataFILE.read(len)
TAG = brecord.decode('utf-8')
if self.getDebug():
print(" ----> Tag:", TAG)

brecord = dataFILE.read(4)
record = strct.unpack(">i", brecord)
len = record[0]
if self.getDebug():
print(" ----> Length of time:", len)

brecord = dataFILE.read(len)
TAGtim = brecord.decode('utf-8')
if self.getDebug():
print(" ----> Time:", TAGtim)

brecord = dataFILE.read(4)
record = strct.unpack(">i", brecord)
len = record[0]
if self.getDebug():
print(" ----> Length of commit:", len)

brecord = dataFILE.read(len)
CMMT = brecord.decode('utf-8')
if self.getDebug():
print(" ----> Commit:", CMMT)

brecord = dataFILE.read(4)
record = strct.unpack(">i", brecord)
len = record[0]
if self.getDebug():
print(" ----> Length of time:", len)

brecord = dataFILE.read(len)
CMMTtim = brecord.decode('utf-8')
if self.getDebug():
print(" ----> Time:", CMMTtim)

repoVERSION = [ \
[TAG, TAGtim], [CMMT, CMMTtim] \
]

if self.getDebug():
print(" <----> repoVERSION:", repoVERSION)

return repoVERSION

#.. Flush and close
def flushNclosedataFile(self, dataFILE=None):
if self.getDebug():
Expand Down

0 comments on commit dcd5c0a

Please sign in to comment.