def generateBurstFromSingleTraj(eprob, trajs, conf, burstsize): species = pickFromEnsemble(eprob) traj = getRandomTrajectory(trajs, species) distances = [] while True: distances.append(getRandomDistance(traj)) if len(distances) == burstsize: return numpy.array(distances).mean()
def generateBurstFromSingleTraj(eprob, trajs, conf, burst): QD, QA, globalreject, applycorrectedcutoff = setUpBurstGeneration(conf) success = False while not success: try: species = pickFromEnsemble(eprob) traj = getRandomTrajectory(trajs, species) while True: addPhotonToBurst(conf, burst, QD, QA, traj) if burst.checkSizeReached(QD, QA, QYcorrected = applycorrectedcutoff): break success = True except ValueError: globalreject -= 1 if globalreject == 0: raise ValueError("Too many global rejects, not even single trajectories can fulfill the rejection criteria - giving up")
def generateBurstFromAllTraj(eprob, trajs, conf, burst): QD, QA, globalreject, applycorrectedcutoff = setUpBurstGeneration(conf) while True: success = False while not success: try: species = pickFromEnsemble(eprob) traj = getRandomTrajectory(trajs, species) photon = getPhoton(traj, conf) photon.checkThermal(QD, QA) burst.appendPhoton(photon) success = True except ValueError: globalreject -= 1 if globalreject == 0: raise ValueError("Too many global rejects, probably no trajectories that can fulfill the rejection criteria - giving up.") if burst.checkSizeReached(QD, QA, QYcorrected = applycorrectedcutoff): break