def __getDefaults(self): self._values = None path = self.filepath.format(self._pitch) self._values = util.loadFromFile(path) if self._values is None: self._values = defaults[self._pitch]
def getEvents(input, loadFromh5=False): evs, jets = pd.DataFrame(), pd.DataFrame() if loadFromh5: print("Loading jets and pf candidates from h5") assert input.endswith('.h5'), "Wrong file type, need .h5!" evs = pd.read_hdf(input, 'events') jets = pd.read_hdf(input, 'jets') else: print("Loading jets and pf candidates from CMSSW EDM file") assert input.endswith('.root'), "Wrong file type, need .root!" evs, jets = util.loadFromFile(input, writeToh5=True) return evs, jets
frame = camera.undistort(frame) frame = preprocessor.preprocess(frame) print 'File %s processed\n' % filename if not process_frame(frame, filename): error_list.append(filename) # Output the report f = open('test_report.txt', 'a') current_time = strftime("%Y-%m-%d %H:%M:%S", gmtime()) f.write('---------------------------------------------------------------------\n\n') f.write(current_time) f.write('\n') f.write('Results of test on pitch %i \n' % pitchnum) thres_path = os.path.join('data', 'threshdefaults_%i' % pitchnum) th = util.loadFromFile(thres_path) f.write('The current thresholds are:\n') f.write(str(th) + '\n\n') f.write('Percent recognized (not percent correct): \n') if n_files > 0: f.write('Yellow: \t %i/%i \t %f percents \n' % (recog['yellow'], n_files, recog['yellow'] *100.0/n_files)) f.write('Blue: \t %i/%i \t %f percents \n' % (recog['blue'], n_files, recog['blue'] *100.0/n_files)) f.write('Ball: \t %i/%i \t %f percents \n' % (recog['ball'], n_files, recog['ball'] *100.0/n_files)) f.write('\nList of files with objects not recognized:\n') f.write(str(error_list)) f.write('\n\n') f.closed
def __loadPitchSize(self): self._cropRect = util.loadFromFile(self._filepath) print self._cropRect