Beispiel #1
0
            float(linecache.getline(i, 25).split(':')[1].strip())
    exit()
# DEBUG

Max = [float(linecache.getline(i, 25).split(':')[1].strip())
       for i in LogFiles]
Mean = [float(linecache.getline(i, 26).split(':')[1].strip())
        for i in LogFiles]
STD = [float(linecache.getline(i, 27).split(':')[1].strip())
       for i in LogFiles]

# Generate folder names
Experiment = [item[:-len('.analysis.log')] for item in LogFiles]

# Get git hash once per session, so it doesn't take so long for Ivan...
git_hash = functions.get_git_hash()
if 'linux' in sys.platform:
    git_hash += ' (from Linux)'
else:
    git_hash += ' (from OS X)'

# Go through each selected experiment (in the shuffled list)
for Counter, SelectedExperiment in enumerate(Experiment):
    print str(Counter + 1) + '/' + str(len(Experiment)), '|', \
        Scintillator[Counter], '|', Sensor[Counter], '|', \
        Lens[Counter], '|', ExperimentID[Counter], '|', SDD[Counter], \
        'mm | git version', git_hash
    # See if we've already ran the resolution evaluation, i.e. have a
    # 'ExperimentID.resolution.png' file. If we have, show it and let the user
    # decide to rerun, otherwise skip to next
    # Load image
Beispiel #2
0
     print '\tWe thus do not archive it again.'
     print '\tTake a look at', os.path.join(
         os.path.dirname(Experiment[SelectedExperiment])[len(
             StartingFolder):], ExperimentID[SelectedExperiment] +
         '.archive.log'), 'for more info'
     print
 else:
     # Archive it!
     logfile = functions.myLogger(
         os.path.dirname(Experiment[SelectedExperiment]),
         ExperimentID[SelectedExperiment] + '.archive.log')
     logfile.info('Archival log file for Experiment ID %s, archived on '
                  '%s', ExperimentID[SelectedExperiment],
                  time.strftime('%d.%m.%Y at %H:%M:%S'))
     logfile.info('\nMade with "%s" at Revision %s', os.path.basename(
         __file__), functions.get_git_hash())
     logfile.info(80 * '-')
     # Tar the selected folder
     TarCommand = ['tar', '-czf', Experiment[SelectedExperiment] +
                   '.tar.gz', '-C',
                   os.path.dirname(Experiment[SelectedExperiment]),
                   os.path.basename(Experiment[SelectedExperiment])]
     print 'Packing', ExperimentID[SelectedExperiment]
     logfile.info('Packing the original files with')
     logfile.info('---')
     logfile.info(' '.join(TarCommand))
     logfile.info('---')
     packit = subprocess.Popen(TarCommand, stdout=subprocess.PIPE)
     output, error = packit.communicate()
     if output:
         print output
Beispiel #3
0
     Experiment[SelectedExperiment][len(StartingFolder) + 1:]
 # Always keep second image
 Keepers.append(2)
 Keepers = numpy.unique(Keepers)
 print 'We keep', len(Keepers), 'images and delete', \
     NumberOfRadiographies[SelectedExperiment] - len(Keepers), 'images'
 if NumberOfRadiographies[SelectedExperiment] - len(Keepers) > 1:
     # When we have as many files left as we have 'Keepers' we most probably
     # have already done a deletion round, then the 'if' clause above
     # evaluates to 'True'
     logfile.info(
         'Deletion log file for Experiment ID %s, deletion done on %s',
         ExperimentID[SelectedExperiment],
         time.strftime('%d.%m.%Y at %H:%M:%S'))
     logfile.info('\nMade with "%s" at Revision %s',
                  os.path.basename(__file__), functions.get_git_hash())
     logfile.info(80 * '-')
     logfile.info('Grabbing Information from %s', AnalysisLogFile)
     logfile.info(80 * '-')
     logfile.info('In the folder %s we keep image',
                  Experiment[SelectedExperiment])
     LogFileToRead = open(AnalysisLogFile, 'r')
     for line in LogFileToRead:
         if len(line.split('-->')) == 2:
             FileNumber = int(line.split('/')[0]) - 1
             if FileNumber in Keepers:
                 logfile.info('%s/%s | %s | with info "%s"',
                              str(FileNumber).rjust(2),
                              NumberOfRadiographies[SelectedExperiment],
                              os.path.basename(Radiographies[SelectedExperiment][FileNumber - 1]),
                              line.strip())