x_range = (x_minRange, x_maxRange) x_binSize = (x_maxRange - x_minRange) / x_bins x_binCenters = np.linspace(x_minRange + x_binSize / 2, x_maxRange - x_binSize / 2, x_bins) # parameters for making the fake data... nChunks = 10 nEvPerLoop = 10000 data_x = np.repeat(x_binCenters, nEvPerLoop) # PARAMETER BOUNDARIES min_e0, max_e0 = 750.0, 1200.0 min_sigma_0, max_sigma_0 = 0.02, 0.17 ddnXSinstance = ddnXSinterpolator() beamTiming = beamTimingShape() # stopping power model and parameters stoppingMedia_Z = 1 stoppingMedia_A = 2 stoppingMedia_rho = 8.37e-5 incidentIon_charge = 1 stoppingMedia_meanExcitation = 19.2 stoppingModelParams = [ stoppingMedia_Z, stoppingMedia_A, stoppingMedia_rho, incidentIon_charge, stoppingMedia_meanExcitation ] stoppingModel = ionStopping.simpleBethe(stoppingModelParams) eN_binCenters = getDDneutronEnergy(eD_binCenters)
def __init__(self, chainFilename, nSamplesFromTOF, nBins_eD=100, nBins_x=20, nRuns=4): """Create a PPC tools object - reads in chain from file""" self.chain, self.probs, self.nParams, self.nWalkers, self.nSteps = readChainFromFile( chainFilename) self.nRuns = nRuns self.eD_bins = nBins_eD self.eD_minRange = 200.0 self.eD_maxRange = 1200.0 self.eD_range = (self.eD_minRange, self.eD_maxRange) self.eD_binSize = (self.eD_maxRange - self.eD_minRange) / self.eD_bins self.eD_binCenters = np.linspace( self.eD_minRange + self.eD_binSize / 2, self.eD_maxRange - self.eD_binSize / 2, self.eD_bins) self.eD_binMax = self.eD_bins - 1 self.x_bins = nBins_x self.x_minRange = 0.0 self.x_maxRange = distances.tunlSSA_CsI.cellLength self.x_range = (self.x_minRange, self.x_maxRange) self.x_binSize = (self.x_maxRange - self.x_minRange) / self.x_bins self.x_binCenters = np.linspace(self.x_minRange + self.x_binSize / 2, self.x_maxRange - self.x_binSize / 2, self.x_bins) # parameters for making the fake data... self.nEvPerLoop = nSamplesFromTOF self.nSamplesFromTOF = nSamplesFromTOF self.data_x = np.repeat(self.x_binCenters, self.nEvPerLoop) self.ddnXSinstance = ddnXSinterpolator() self.beamTiming = beamTimingShape() self.zeroDegTimeSpreader = zeroDegreeTimingSpread() # stopping power model and parameters stoppingMedia_Z = 1 stoppingMedia_A = 2 stoppingMedia_rho = 8.565e-5 # from red notebook, p 157 incidentIon_charge = 1 stoppingMedia_meanExcitation = 19.2 * 1e-3 dgas_materialDef = [ stoppingMedia_Z, stoppingMedia_A, stoppingMedia_rho, stoppingMedia_meanExcitation ] #stoppingModel = ionStopping.simpleBethe( stoppingModelParams ) self.stoppingModel = ionStopping.simpleBethe([incidentIon_charge]) self.stoppingModel.addMaterial(dgas_materialDef) self.eN_binCenters = getDDneutronEnergy(self.eD_binCenters) tofWindowSettings = tofWindows() tof_nBins = tofWindowSettings.nBins self.tof_minRange = [ tofWindowSettings.minRange['mid'], tofWindowSettings.minRange['close'], tofWindowSettings.minRange['close'], tofWindowSettings.minRange['far'], tofWindowSettings.minRange['production'] ] self.tof_maxRange = [ tofWindowSettings.maxRange['mid'], tofWindowSettings.maxRange['close'], tofWindowSettings.maxRange['close'], tofWindowSettings.maxRange['far'], tofWindowSettings.maxRange['production'] ] self.tof_range = [] for minR, maxR in zip(self.tof_minRange, self.tof_maxRange): self.tof_range.append((minR, maxR)) self.tofRunBins = [ tof_nBins['mid'], tof_nBins['close'], tof_nBins['close'], tof_nBins['far'], tof_nBins['production'] ] self.standoffs = [ distances.tunlSSA_CsI.standoffMid, distances.tunlSSA_CsI.standoffClose, distances.tunlSSA_CsI.standoffClose, distances.tunlSSA_CsI.standoffFar, distances.tunlSSA_CsI.standoff_TUNLruns ] self.tofData = None self.neutronSpectra = None self.paramNames = [ '$E_0$', '$f_1$', '$f_2$', '$f_3$', '$N_1$', '$N_2$', '$N_3$', '$N_4$', '$N_5$' ]