forked from M-Labs/artiq
1
0
Fork 0

MPO -> AutoContext

This commit is contained in:
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.core import *
from artiq.language.units import * from artiq.language.units import *
class DDS(MPO): class DDS(AutoContext):
parameters = "dds_sysclk reg_channel rtio_channel" parameters = "dds_sysclk reg_channel rtio_channel"
def build(self): def build(self):

View File

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

View File

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

View File

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

View File

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

View File

@ -86,7 +86,7 @@ with parallel:
\begin{frame}[fragile] \begin{frame}[fragile]
\frametitle{\fontseries{l}\selectfont Object orientation and code reuse} \frametitle{\fontseries{l}\selectfont Object orientation and code reuse}
\begin{verbatimtab} \begin{verbatimtab}
class Main(MPO): class Main(AutoContext):
def build(self): def build(self):
self.ion1 = Ion(...) self.ion1 = Ion(...)
self.ion2 = Ion(...) self.ion2 = Ion(...)
@ -130,9 +130,9 @@ class Main(MPO):
\begin{frame}[fragile] \begin{frame}[fragile]
\frametitle{\fontseries{l}\selectfont Channels and parameters} \frametitle{\fontseries{l}\selectfont Channels and parameters}
\begin{itemize} \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 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 If channels/parameters are passed as constructor arguments, those are used
\item Otherwise, they are looked up in the device and parameter databases \item Otherwise, they are looked up in the device and parameter databases
\end{itemize} \end{itemize}

View File

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

View File

@ -3,7 +3,7 @@ from artiq.language.core import *
my_range = range my_range = range
class CompilerTest(MPO): class CompilerTest(AutoContext):
parameters = "a b A B" parameters = "a b A B"
def print_done(self): 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 from artiq.devices import corecom_serial, core, gpio_core
class CompilerTest(MPO): class CompilerTest(AutoContext):
parameters = "led" parameters = "led"
def output(self, n): def output(self, n):

View File

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

View File

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

View File

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