x_bins = 10
# if quickAndDirty == True:
#     x_bins = 5
x_minRange = 0.0
x_maxRange = distances.tunlSSA_CsI_oneBD.cellLength
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...
nEvPerLoop = 1000
data_x = np.repeat(x_binCenters, nEvPerLoop)

ddnXSinstance = ddnXSinterpolator()

# PARAMETER BOUNDARIES
min_beamE, max_beamE = 1500.0, 2000.0  # see lab book pg54, date 1/24/16 - 2070 field of 139.091 mT gives expected Ed = 1.8784 MeV
min_eLoss, max_eLoss = 600.0, 1000.0
min_scale, max_scale = 40.0, 300.0
min_s, max_s = 0.1, 1.2

beamE_guess = 1860.0  # initial deuteron energy, in keV
eLoss_guess = 850.0  # width of initial deuteron energy spread
scale_guess = 180.0
s_guess = 0.6

# stopping power model and parameters
stoppingMedia_Z = 1
stoppingMedia_A = 2
Ejemplo n.º 2
0
    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$'
        ]