MPO -> AutoContext

pull/231/head
Sebastien Bourdeauducq 2014-08-13 18:30:57 +08:00
parent c29e6312fe
commit c18495d484
12 changed files with 19 additions and 19 deletions

View File

@ -1,7 +1,7 @@
from artiq.language.core import *
from artiq.language.units import *
class DDS(MPO):
class DDS(AutoContext):
parameters = "dds_sysclk reg_channel rtio_channel"
def build(self):

View File

@ -1,6 +1,6 @@
from artiq.language.core import *
class GPIOOut(MPO):
class GPIOOut(AutoContext):
parameters = "channel"
@kernel

View File

@ -1,6 +1,6 @@
from artiq.language.core import *
class TTLOut(MPO):
class TTLOut(AutoContext):
parameters = "channel"
@kernel

View File

@ -5,7 +5,7 @@ from artiq.language import units
def _make_kernel_ro(value):
return isinstance(value, (int, float, str, units.Quantity))
class MPO:
class AutoContext:
parameters = ""
implicit_core = True

View File

@ -1,6 +1,6 @@
from random import Random
from artiq.language.core import MPO, delay
from artiq.language.core import AutoContext, delay
from artiq.language import units
from artiq.sim import time
@ -8,7 +8,7 @@ class Core:
def run(self, k_function, k_args, k_kwargs):
return k_function(*k_args, **k_kwargs)
class Input(MPO):
class Input(AutoContext):
parameters = "name"
def build(self):
@ -25,14 +25,14 @@ class Input(MPO):
delay(duration)
return result
class WaveOutput(MPO):
class WaveOutput(AutoContext):
parameters = "name"
def pulse(self, frequency, duration):
time.manager.event(("pulse", self.name, frequency, duration))
delay(duration)
class VoltageOutput(MPO):
class VoltageOutput(AutoContext):
parameters = "name"
def set(self, value):

View File

@ -86,7 +86,7 @@ with parallel:
\begin{frame}[fragile]
\frametitle{\fontseries{l}\selectfont Object orientation and code reuse}
\begin{verbatimtab}
class Main(MPO):
class Main(AutoContext):
def build(self):
self.ion1 = Ion(...)
self.ion2 = Ion(...)
@ -130,9 +130,9 @@ class Main(MPO):
\begin{frame}[fragile]
\frametitle{\fontseries{l}\selectfont Channels and parameters}
\begin{itemize}
\item A kernel is a method of a class that derives from the \verb!MPO! class
\item A kernel is a method of a class that derives from the \verb!AutoContext! class
\item The entry point for an experiment is called \verb!run! --- may or may not be a kernel
\item The \verb!MPO! class manages channels and parameters, and sets them as attributes
\item The \verb!AutoContext! class manages channels and parameters, and sets them as attributes
\item If channels/parameters are passed as constructor arguments, those are used
\item Otherwise, they are looked up in the device and parameter databases
\end{itemize}

View File

@ -1,7 +1,7 @@
from artiq.language.units import *
from artiq.language.core import *
class AluminumSpectroscopy(MPO):
class AluminumSpectroscopy(AutoContext):
parameters = "mains_sync laser_cooling spectroscopy spectroscopy_b state_detection pmt \
spectroscopy_freq photon_limit_low photon_limit_high"

View File

@ -3,7 +3,7 @@ from artiq.language.core import *
my_range = range
class CompilerTest(MPO):
class CompilerTest(AutoContext):
parameters = "a b A B"
def print_done(self):

View File

@ -1,7 +1,7 @@
from artiq.language.core import MPO, kernel
from artiq.language.core import AutoContext, kernel
from artiq.devices import corecom_serial, core, gpio_core
class CompilerTest(MPO):
class CompilerTest(AutoContext):
parameters = "led"
def output(self, n):

View File

@ -2,7 +2,7 @@ from artiq.language.units import *
from artiq.language.core import *
from artiq.devices import corecom_serial, core, dds_core, gpio_core
class DDSTest(MPO):
class DDSTest(AutoContext):
parameters = "a b c d led"
@kernel

View File

@ -1,7 +1,7 @@
from artiq.language.units import *
from artiq.language.core import *
class SimpleSimulation(MPO):
class SimpleSimulation(AutoContext):
parameters = "a b c d"
@kernel

View File

@ -2,7 +2,7 @@ from artiq.language.units import *
from artiq.language.core import *
from artiq.devices import corecom_serial, core
class DummyPulse(MPO):
class DummyPulse(AutoContext):
parameters = "name"
def print_on(self, t, f):
@ -17,7 +17,7 @@ class DummyPulse(MPO):
delay(duration)
self.print_off(now())
class TimeTest(MPO):
class TimeTest(AutoContext):
parameters = "a b c d"
@kernel