コード例 #1
0
Amin = -2000
Amax = -40000
Avals = np.linspace(Amin, Amax, 101)
# background
Bmin = 275000
Bmax = 225000
Bvals = np.linspace(Bmin, Bmax, 151)

# Pack the parameters into a tuple and send it to the BOE
# note that the order must correspond to how the values are unpacked in the model_function
myOBE.pars = (x0vals, Avals, Bvals)

# define the known constants
# keeping the peak width constant in this example
dtrue = .1
myOBE.cons = (dtrue, )

# Settings, parameters, constants and model all defined, so set it all up
myOBE.config()
"""
MEASUREMENT SIMULATION
"""

# pick the parameters of the true resonance.  myOBE will have to "discover" these.
x0true = (x0max -
          x0min) * np.random.rand() + x0min  # pick a random resonance x0
Btrue = (Bmax - Bmin) * np.random.rand() + Bmin  # pick a random background
# Btrue = 250000
Atrue = (Amax - Amin) * np.random.rand() + Amin  # pick a random amplitude

コード例 #2
0
# Rabi freuquency
B1min = 1
B1max = 5
B1 = np.linspace(B1min, B1max, 71)
fc_min = -7
fc_max = 7
f_center = np.linspace(fc_min, fc_max, 71)
# baseline = np.linspace(50000, 60000, 51)
# contrast = np.linspace(.05, .15, 11)
myOBE.pars = (B1, f_center)
param_extent = (B1min, B1max, fc_min, fc_max)

baseline = 100000
contrast = .01
T1 = .5
myOBE.cons = (baseline, contrast, T1)

# Settings, parameters, constants and model all defined, so set it all up
myOBE.config()

# put in a prior
B1prior = np.exp(-(B1 - 3.0)**2 / 2 / 2.0**2)
fcprior = np.exp(-(f_center)**2 / 2 / 4.0**2)

myOBE.set_pdf(probvalarrays=(B1prior, fcprior))
"""
MEASUREMENT SIMULATION
"""

# secret stuff - to be used only by the measurement simulator
# pick the parameters of the true resonance