Commit e7b3768d authored by Claus Kleinwort's avatar Claus Kleinwort
Browse files

More debug information for problems with reading Cfiles

git-svn-id: http://svnsrv.desy.de/public/MillepedeII/trunk@157 3547b9b0-65b8-46d3-b95d-921b3f43af62
parent 5405768a
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
!! 1. Download the software package from the DESY \c svn server to !! 1. Download the software package from the DESY \c svn server to
!! \a target directory, e.g.: !! \a target directory, e.g.:
!! !!
!! svn checkout http://svnsrv.desy.de/public/MillepedeII/tags/V04-03-07 target !! svn checkout http://svnsrv.desy.de/public/MillepedeII/tags/V04-03-08 target
!! !!
!! 2. Create **Pede** executable (in \a target directory): !! 2. Create **Pede** executable (in \a target directory):
!! !!
...@@ -98,6 +98,8 @@ ...@@ -98,6 +98,8 @@
!! of the constraints matrix (solution by elemination). !! of the constraints matrix (solution by elemination).
!! This problem is usually caused by *empty* constraints (see \ref !! This problem is usually caused by *empty* constraints (see \ref
!! cmd-skipemptycons). !! cmd-skipemptycons).
!! * 170831: More debug information for problems with reading Cfiles. Don't stop
!! after read error for \ref cmd-checkinput mode.
!! !!
!! \section tools_sec Tools !! \section tools_sec Tools
!! The subdirectory \c tools contains some useful scripts: !! The subdirectory \c tools contains some useful scripts:
...@@ -1537,6 +1539,7 @@ SUBROUTINE peread(more) ...@@ -1537,6 +1539,7 @@ SUBROUTINE peread(more)
REAL(mpd) :: ds2 REAL(mpd) :: ds2
REAL(mpd) :: dw REAL(mpd) :: dw
!$ INTEGER(mpi) :: OMP_GET_THREAD_NUM !$ INTEGER(mpi) :: OMP_GET_THREAD_NUM
CHARACTER (LEN=7) :: cfile
SAVE SAVE
inder(i)=readBufferDataI(i) inder(i)=readBufferDataI(i)
...@@ -1581,7 +1584,7 @@ SUBROUTINE peread(more) ...@@ -1581,7 +1584,7 @@ SUBROUTINE peread(more)
!$OMP DEFAULT(PRIVATE) & !$OMP DEFAULT(PRIVATE) &
!$OMP SHARED(readBufferInfo,readBufferPointer,readBufferDataI,readBufferDataD, & !$OMP SHARED(readBufferInfo,readBufferPointer,readBufferDataI,readBufferDataD, &
!$OMP readBufferDataF,nPointer,nData,skippedRecords,ndimbuf,NTHR,NFILF,FLOOP, & !$OMP readBufferDataF,nPointer,nData,skippedRecords,ndimbuf,NTHR,NFILF,FLOOP, &
!$OMP IFD,KFD,IFILE,NFILB,WFD,XFD) & !$OMP IFD,KFD,IFILE,NFILB,WFD,XFD,icheck) &
!$OMP NUM_THREADS(NTHR) !$OMP NUM_THREADS(NTHR)
ithr=1 ithr=1
...@@ -1620,8 +1623,13 @@ SUBROUTINE peread(more) ...@@ -1620,8 +1623,13 @@ SUBROUTINE peread(more)
#endif #endif
eof=(ierrc <= 0.AND.ierrc /= -4) ! allow buffer overruns -> skip record eof=(ierrc <= 0.AND.ierrc /= -4) ! allow buffer overruns -> skip record
IF(eof.AND.ierrc < 0) THEN IF(eof.AND.ierrc < 0) THEN
CALL peend(18,'Aborted, read error(s) for binary files') WRITE(*,*) 'Read error for binary Cfile', kfile, 'record', jrec+1, ':', ierrc
STOP 'PEREAD: stopping due to read errors' WRITE(8,*) 'Read error for binary Cfile', kfile, 'record', jrec+1, ':', ierrc
IF (icheck <= 0) THEN ! stop unless 'checkinput' mode
WRITE(cfile,'(I7)') kfile
CALL peend(18,'Aborted, read error(s) for binary file ' // cfile)
STOP 'PEREAD: stopping due to read errors'
ENDIF
END IF END IF
END IF END IF
IF(eof) EXIT records ! end-of-files or error IF(eof) EXIT records ! end-of-files or error
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
# #
# Hardcoded defaults can be replaced by command line arguments for # Hardcoded defaults can be replaced by command line arguments for
# - Name of binary file # - Name of binary file
# - Number of records to print (-1: all) # - Number of records to print (-1: all; <-1: all, record headers only)
# - Number of records to skip (optional) # - Number of records to skip (optional)
# - Mininum value to print derivative # - Mininum value to print derivative
# #
...@@ -62,7 +62,7 @@ mrec = 10 ...@@ -62,7 +62,7 @@ mrec = 10
## number of records (track) to skip before ## number of records (track) to skip before
skiprec = 0 skiprec = 0
## minimum value to print derivatives ## minimum value to print derivatives
minval = 0. minval = None # allows for NaNs
# #
# ## C. Kleinwort - DESY ######################## # ## C. Kleinwort - DESY ########################
...@@ -70,7 +70,7 @@ minval = 0. ...@@ -70,7 +70,7 @@ minval = 0.
narg = len(sys.argv) narg = len(sys.argv)
if narg > 1: if narg > 1:
if narg < 3: if narg < 3:
print " usage: readMilleBinary.py <file name> <number of records> [<number of records to skip> <minimum value to print derivative>]" print " usage: readMilleBinary.py <file name> <number of records> [<number of records to skip> <minimum value to print derivative>]"
sys.exit(2) sys.exit(2)
else: else:
fname = sys.argv[1] fname = sys.argv[1]
...@@ -79,43 +79,47 @@ if narg > 1: ...@@ -79,43 +79,47 @@ if narg > 1:
skiprec = int(sys.argv[3]) skiprec = int(sys.argv[3])
if narg > 4: if narg > 4:
minval = float(sys.argv[4]) minval = float(sys.argv[4])
#print " input ", fname, mrec, skiprec #print " input ", fname, mrec, skiprec
f = open(fname, "rb") f = open(fname, "rb")
nrec = 0 nrec = 0
try: try:
while (nrec < mrec + skiprec) or (mrec < 0): while (nrec < mrec + skiprec) or (mrec < 0):
# read 1 record # read 1 record
nr = 0 nr = 0
if (Cfiles == 0): if (Cfiles == 0):
lenf = array.array(intfmt) lenf = array.array(intfmt)
lenf.fromfile(f, 2) lenf.fromfile(f, 2)
length = array.array(intfmt) length = array.array(intfmt)
length.fromfile(f, 1) length.fromfile(f, 1)
nr = abs(length[0] / 2) nr = abs(length[0] / 2)
nrec += 1 nrec += 1
if length[0] > 0: if length[0] > 0:
glder = array.array('f') glder = array.array('f')
else: else:
glder = array.array('d') glder = array.array('d')
glder.fromfile(f, nr) glder.fromfile(f, nr)
inder = array.array(intfmt) inder = array.array(intfmt)
inder.fromfile(f, nr) inder.fromfile(f, nr)
if (Cfiles == 0): if (Cfiles == 0):
lenf = array.array(intfmt) lenf = array.array(intfmt)
lenf.fromfile(f, 2) lenf.fromfile(f, 2)
if (nrec <= skiprec): # must be after last fromfile if (nrec <= skiprec): # must be after last fromfile
continue continue
print " === NR ", nrec, length[0] / 2 print " === NR ", nrec, length[0] / 2
# no details, only header
if (mrec < -1):
continue
i = 0 i = 0
nh = 0 nh = 0
ja = 0 ja = 0
...@@ -134,44 +138,50 @@ try: ...@@ -134,44 +138,50 @@ try:
i -= 1 i -= 1
# special data ? # special data ?
if (ja + 1 == jb) and (glder[jb] < 0.): if (ja + 1 == jb) and (glder[jb] < 0.):
jsp = jb jsp = jb
nsp = int(-glder[jb]) nsp = int(-glder[jb])
i += nsp i += nsp
print ' ### spec. ', nsp, inder[jsp + 1:i + 1], glder[jsp + 1:i + 1] print ' ### spec. ', nsp, inder[jsp + 1:i + 1], glder[jsp + 1:i + 1]
continue continue
nh += 1 nh += 1
if (jb < i): if (jb < i):
# measurement with global derivatives # measurement with global derivatives
print ' -g- meas. ', nh, inder[jb + 1], jb - ja - 1, i - jb, glder[ja], glder[jb] print ' -g- meas. ', nh, inder[jb + 1], jb - ja - 1, i - jb, glder[ja], glder[jb]
else: else:
# measurement without global derivatives # measurement without global derivatives
print ' -l- meas. ', nh, inder[ja + 1], jb - ja - 1, i - jb, glder[ja], glder[jb] print ' -l- meas. ', nh, inder[ja + 1], jb - ja - 1, i - jb, glder[ja], glder[jb]
if (ja + 1 < jb): if (ja + 1 < jb):
lab = [] lab = []
val = [] val = []
for k in range(ja+1, jb): for k in range(ja + 1, jb):
if abs(glder[k]) >= minval: if minval is None:
lab.append(inder[k]) lab.append(inder[k])
val.append(glder[k]) val.append(glder[k])
print " local ", lab elif abs(glder[k]) >= minval:
print " local ", val lab.append(inder[k])
val.append(glder[k])
print " local ", lab
print " local ", val
if (jb + 1 < i + 1): if (jb + 1 < i + 1):
lab = [] lab = []
val = [] val = []
for k in range(jb+1, i+1): for k in range(jb + 1, i + 1):
if abs(glder[k]) >= minval: if minval is None:
lab.append(inder[k]) lab.append(inder[k])
val.append(glder[k]) val.append(glder[k])
print " global ", lab elif abs(glder[k]) >= minval:
print " global ", val lab.append(inder[k])
val.append(glder[k])
print " global ", lab
print " global ", val
except EOFError: except EOFError:
print print
if (nr > 0): if (nr > 0):
print " >>> error: end of file before end of record", nrec print " >>> error: end of file before end of record", nrec
else: else:
print " end of file after", nrec, "records" print " end of file after", nrec, "records"
f.close() f.close()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment