コード例 #1
0
myOBE.model_function = mxplsub_wrapper

# settings, parameters and constants

# define the measurement setting space
# 101 possible x values
xsettings = np.linspace(0, 1, 201)
# sent it to myOBE packaged as a tuple
myOBE.sets = (xsettings, )

# define the parameter space
mvals = np.linspace(-1, 1, 501)
bvals = np.linspace(-1, 1, 501)
# package as a tuple and send
myOBE.pars = (mvals, bvals)

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

# secret stuff - to be used only by the measurement simulator
# pick the parameters of the true resonance
m_true = 2 * np.random.rand() - 1  # pick a random slope betw. -1 and 1
b_true = 2 * np.random.rand() - 1  # pick a random intercept


def simdata(x):
    """
コード例 #2
0
# resonance values x0 (like NV frequency) around 3 GHz
x0min = 2
x0max = 4
x0vals = np.linspace(x0min, x0max, 201)
# peak amplitude
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
コード例 #3
0
detune = np.linspace(-10, 10, 101)

# tell it to the BOE
myOBE.sets = (pulsetime, detune)

# define the parameter space where the peak could be found
# 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))