### Configuration management examples Source: https://m-labs.hk/artiq/manual/utilities.html Common examples for reading, writing, and removing configuration settings. ```bash artiq_coremgmt config read -s rtio_clock ``` ```bash artiq_coremgmt config write -s ip 192.168.1.70 -f idle_kernel idle_kernel.bin ``` ```bash artiq_coremgmt config remove sed_spread_enable ``` -------------------------------- ### Install Nix package manager Source: https://m-labs.hk/artiq/manual/_sources/installing.rst.txt Use the official install script to set up Nix on Linux systems. ```bash $ sh <(curl -L https://nixos.org/nix/install) --no-daemon ``` -------------------------------- ### Install ARTIQ into user environment Source: https://m-labs.hk/artiq/manual/_sources/installing.rst.txt Install the ARTIQ flake directly into the user profile. ```bash $ nix profile install |artiq_flake| ``` -------------------------------- ### Install packages temporarily Source: https://m-labs.hk/artiq/manual/_sources/nixos_handbook.rst.txt Starts a shell with a specific package available without permanent installation. ```bash $ nix-shell -p ``` -------------------------------- ### Start ARTIQ session Source: https://m-labs.hk/artiq/manual/_sources/getting_started_mgmt.rst.txt Launches the master, controller manager, and dashboard simultaneously. ```bash $ artiq_session ``` -------------------------------- ### Start the Dashboard Source: https://m-labs.hk/artiq/manual/getting_started_mgmt.html Launches the ARTIQ dashboard GUI for experiment management and log monitoring. ```bash $ artiq_dashboard ``` -------------------------------- ### Nix Configuration Prompts Source: https://m-labs.hk/artiq/manual/_sources/installing.rst.txt Example prompts encountered when initializing ARTIQ environments that require user confirmation. ```text do you want to allow configuration setting 'extra-sandbox-paths' to be set to '/opt' (y/N)? do you want to allow configuration setting 'extra-substituters' to be set to 'https://nixbld.m-labs.hk' (y/N)? do you want to allow configuration setting 'extra-trusted-public-keys' to be set to 'nixbld.m-labs.hk-1:5aSRVA5b320xbNvu30tqxVPXpld73bhtOeH6uAjRyHc=' (y/N)? ``` -------------------------------- ### Install ARTIQ via Conda Source: https://m-labs.hk/artiq/manual/_sources/installing.rst.txt Commands for verifying Conda installation and setting up the ARTIQ environment. ```bash $ conda ``` ```bash $ conda config --prepend channels https://conda.m-labs.hk/artiq $ conda config --append channels conda-forge $ conda create -n artiq artiq ``` -------------------------------- ### Enable OpenSSH Service Source: https://m-labs.hk/artiq/manual/nixos_handbook.html Installs and configures the OpenSSH daemon. ```nix services.openssh.enable = true; ``` -------------------------------- ### Implement Test Experiments Source: https://m-labs.hk/artiq/manual/_sources/extending_rtio.rst.txt Example experiments to verify the functionality of the new linked LED driver. ```python from artiq.experiment import * class flip(EnvExperiment): def build(self): self.setattr_device("core") self.setattr_device("leds") @kernel def run(self): self.core.reset() self.leds.flip_led() ``` ```python from artiq.experiment import * class sync(EnvExperiment): def build(self): self.setattr_device("core") self.setattr_device("leds") @kernel def run(self): self.core.reset() self.leds.link_up() ``` -------------------------------- ### Install ARTIQ via MSYS2 Source: https://m-labs.hk/artiq/manual/_sources/installing.rst.txt Configure the pacman repository and install ARTIQ packages on Windows. ```text [artiq] SigLevel = Optional TrustAll Server = |msys2_server| ``` ```bash $ pacman -Syy $ pacman -S mingw-w64-clang-x86_64-artiq ``` ```bash $ pacman -S ``` -------------------------------- ### Start Controller Manager and Dashboard Source: https://m-labs.hk/artiq/manual/_sources/getting_started_mgmt.rst.txt Launch the controller manager to handle device connections and the dashboard for GUI-based experiment management. ```bash $ artiq_ctlmgr ``` ```bash $ artiq_dashboard ``` -------------------------------- ### Start the ARTIQ master Source: https://m-labs.hk/artiq/manual/_sources/getting_started_mgmt.rst.txt Launch the master process within the directory containing the device database and experiment repository. ```bash $ cd ~/artiq-master $ artiq_master ``` -------------------------------- ### Start the ARTIQ controller manager Source: https://m-labs.hk/artiq/manual/_sources/faq.rst.txt Run the controller manager to automatically start necessary controllers and resolve connection errors like 'failed to connect to moninj'. ```bash $ artiq_ctlmgr ``` -------------------------------- ### Start ARTIQ Master with Git Integration Source: https://m-labs.hk/artiq/manual/_sources/getting_started_mgmt.rst.txt Launches the master process configured to use the bare repository. ```bash $ cd ~/artiq-master $ artiq_master -g ``` -------------------------------- ### Initialize Urukul ProtoRev8 Source: https://m-labs.hk/artiq/manual/_modules/artiq/coredevice/urukul.html Performs hardware initialization, including I/O reset and synchronization setup. ```python @kernel def init(self, blind): """Initialize Urukul with ProtoRev8. Resets the DDS I/O interface. Does not pulse the DDS ``MASTER_RESET`` as that confuses the AD9910. """ cfg = self.cpld.cfg_reg # Don't pulse MASTER_RESET (m-labs/artiq#940) self.cpld.cfg_reg = cfg | (0 << ProtoRev8.CFG_RST) | (1 << ProtoRev8.CFG_IO_RST) # Preemptively enable the SPI. Voltages of both common mode and # differential are too small initially. # This dummy config value is similar to the coming SPI config self.cpld.bus.set_config_mu(SPI_CONFIG, 24, SPIT_CFG_WR, CS_CFG) delay(1 * us) if blind: self.cpld.cfg_write(self.cpld.cfg_reg) elif urukul_sta_proto_rev(self.sta_read())!= STA_PROTO_REV_8: raise ValueError("Urukul proto_rev mismatch") delay(100 * us) # reset, slack self.cpld.cfg_write(cfg) if self.cpld.sync_div: at_mu(now_mu() & ~0xF) # align to RTIO/2 self.cpld.set_sync_div(self.cpld.sync_div) # 125 MHz/2 = 1 GHz/16 delay(1 * ms) # DDS wake up ``` -------------------------------- ### Install system packages Source: https://m-labs.hk/artiq/manual/_sources/nixos_handbook.rst.txt Adds software packages to the system environment by updating the environment.systemPackages list. ```nix environment.systemPackages = with pkgs; [ vim wget gitAndTools.gitFull firefox gnome3.gnome-tweaks libreoffice-fresh vscodium ]; ``` -------------------------------- ### Implement Controller Main Function Source: https://m-labs.hk/artiq/manual/_sources/developing_a_ndsp.rst.txt Define the main entry point to start the RPC server loop. ```python def main(): simple_server_loop({"hello": Hello()}, "localhost", 3249) if __name__ == "__main__": main() ``` -------------------------------- ### Testing custom driver with linkup experiment Source: https://m-labs.hk/artiq/manual/extending_rtio.html Example experiment to test the link_up functionality of the new device. ```python from artiq.experiment import * class sync(EnvExperiment): def build(self): self.setattr_device("core") self.setattr_device("leds") @kernel def run(self): self.core.reset() self.leds.link_up() ``` -------------------------------- ### Configure Conda channels and install ARTIQ Source: https://m-labs.hk/artiq/manual/installing.html Set the required channels and create a new environment for ARTIQ. ```bash $ conda config --prepend channels https://conda.m-labs.hk/artiq $ conda config --append channels conda-forge $ conda create -n artiq artiq ``` -------------------------------- ### Testing custom driver with flip experiment Source: https://m-labs.hk/artiq/manual/extending_rtio.html Example experiment to test the flip_led functionality of the new device. ```python from artiq.experiment import * class flip(EnvExperiment): def build(self): self.setattr_device("core") self.setattr_device("leds") @kernel def run(self): self.core.reset() self.leds.flip_led() ``` -------------------------------- ### Start ARTIQ session with arguments Source: https://m-labs.hk/artiq/manual/_sources/getting_started_mgmt.rst.txt Passes specific arguments to individual tools using the -m, -d, and -c flags. ```bash $ artiq_session -m=-g ``` -------------------------------- ### Run Vivado installer in unattended mode Source: https://m-labs.hk/artiq/manual/_sources/building_developing.rst.txt Execute the Vivado installer without the GUI to bypass potential crashes during installation. ```bash ./xsetup -a XilinxEULA,3rdPartyEULA,WebTalkTerms -b Install -e 'Vitis Unified Software Platform' -l /opt/Xilinx/ ``` -------------------------------- ### Initialize Working Directory and Commit Experiments Source: https://m-labs.hk/artiq/manual/_sources/getting_started_mgmt.rst.txt Sets up the local working directory and commits initial experiment files. ```bash $ cd ~/artiq-work $ git init ``` ```bash $ git add mgmt_tutorial.py $ git add timed_tutorial.py $ git commit -m "First version of the tutorial experiments" ``` -------------------------------- ### Install additional MSYS2 packages Source: https://m-labs.hk/artiq/manual/installing.html Use pacman to install specific packages by name. ```bash $ pacman -S ``` -------------------------------- ### List Nix profiles Source: https://m-labs.hk/artiq/manual/installing.html View installed profiles to identify the ARTIQ installation for removal. ```bash $ nix profile list ``` -------------------------------- ### Initialize Bare Repository for ARTIQ Master Source: https://m-labs.hk/artiq/manual/_sources/getting_started_mgmt.rst.txt Prepares the master's repository directory to act as a bare Git server. ```bash $ cd ~/artiq-master $ mv repository ~/artiq-work $ mkdir repository $ cd repository $ git init --bare ``` -------------------------------- ### Initialize working directory Source: https://m-labs.hk/artiq/manual/getting_started_mgmt.html Set up the local working directory as a standard Git repository. ```bash $ cd ~/artiq-work $ git init ``` -------------------------------- ### Locate ARTIQ Installation Path Source: https://m-labs.hk/artiq/manual/_sources/getting_started_core.rst.txt Command to identify the directory where the ARTIQ package is installed. ```bash python3 -c "import artiq; print(artiq.__path__[0])" ``` -------------------------------- ### Sampler.init() Source: https://m-labs.hk/artiq/manual/_modules/artiq/coredevice/sampler.html Initializes the Sampler device by configuring the SPI channels. ```APIDOC ## Sampler.init() ### Description Initializes the device and sets up SPI channels for ADC and PGIA communication. ``` -------------------------------- ### Install OpenOCD via Conda Source: https://m-labs.hk/artiq/manual/flashing.html Install the required OpenOCD package using the m-labs channel. ```bash $ conda install -c m-labs openocd ``` -------------------------------- ### init() Source: https://m-labs.hk/artiq/manual/core_drivers_reference.html Initializes the device, clearing counters, resetting interpolators, and setting default states for LEDs and DACs. ```APIDOC ## init() ### Description Initialize the device. Disables RESET, DAC_CLR, enables AFE_PWR, clears error counters, turns LEDs off, and resets interpolators to unit rate change on all channels. ``` -------------------------------- ### Build ARTIQ documentation with Nix Source: https://m-labs.hk/artiq/manual/_sources/faq.rst.txt Use this command to generate the HTML version of the ARTIQ manual from the source repository. ```bash $ nix build git+https://git.m-labs.hk/M-Labs/artiq.git\?ref=release-[number]#artiq-manual-html ``` -------------------------------- ### Install and configure OpenOCD with Conda Source: https://m-labs.hk/artiq/manual/_sources/flashing.rst.txt Install OpenOCD via Conda and apply the required udev rules for the environment. ```bash $ conda install -c m-labs openocd ``` ```bash $ sudo cp ~/.conda/envs/artiq/share/openocd/contrib/60-openocd.rules /etc/udev/rules.d $ sudo udevadm trigger ``` -------------------------------- ### Songbird.init Source: https://m-labs.hk/artiq/manual/_modules/artiq/coredevice/songbird.html Initializes the LTC2000 DAC with default settings. ```APIDOC ### init() #### Description Initializes the LTC2000 DAC by pulsing the hardware reset and configuring internal registers with sensible defaults. Verifies the configuration after initialization. ``` -------------------------------- ### Install ARTIQ via MSYS2 Source: https://m-labs.hk/artiq/manual/installing.html Update the package database and install the ARTIQ package within the MSYS2 CLANG64 environment. ```bash $ pacman -Syy $ pacman -S mingw-w64-clang-x86_64-artiq ``` -------------------------------- ### Build Kasli-SoC with Nix Source: https://m-labs.hk/artiq/manual/_sources/building_developing.rst.txt Builds the Kasli-SoC package using the official flake and a system description JSON file. ```bash $ nix build --print-build-logs --impure --expr 'let fl = builtins.getFlake "git+https://git.m-labs.hk/m-labs/artiq-zynq?ref=release-[number]"; in (fl.makeArtiqZynqPackage {target="kasli_soc"; variant=""; json=;}).kasli_soc--sd' ``` -------------------------------- ### Set Songbird Waveform Examples Source: https://m-labs.hk/artiq/manual/_modules/artiq/coredevice/songbird.html Examples for configuring constant amplitude, linear frequency sweeps, and amplitude modulation using set_waveform. ```python dds.set_waveform(ampl_offset=volt_to_mu(1.0), damp=0, ddamp=0, dddamp=0, phase_offset=0, ftw=songbird.frequency_to_mu(1e6), chirp=0) ``` ```python dds.set_waveform(ampl_offset=volt_to_mu(0.5), damp=0, ddamp=0, dddamp=0, phase_offset=0, ftw=songbird.frequency_to_mu(10e6), chirp=chirp_rate_mu) ``` ```python dds.set_waveform(ampl_offset=volt_to_mu(0.1), damp=ramp_rate_mu, ddamp=0, dddamp=0, phase_offset=0, ftw=carrier_freq_mu, chirp=0) ``` -------------------------------- ### cal_trf_vco() Source: https://m-labs.hk/artiq/manual/_modules/artiq/coredevice/phaser.html Starts calibration of the upconverter VCO. ```APIDOC ## cal_trf_vco() ### Description Start calibration of the upconverter (hardware variant) VCO. TRF outputs should be disabled during VCO calibration. ``` -------------------------------- ### init() Source: https://m-labs.hk/artiq/manual/_modules/artiq/coredevice/ad9912.html Initializes and configures the AD9912 DDS device. ```APIDOC ## init() ### Description Initializes and configures the DDS hardware to a ready state. ``` -------------------------------- ### get_y Source: https://m-labs.hk/artiq/manual/_modules/artiq/coredevice/suservo.html Get a profile's IIR state. ```APIDOC ## get_y(profile) ### Description Get a profile's IIR state (filter output, Y0). The IIR state is also known as the "integrator", or the DDS amplitude scale factor. It is 17 bits wide and unsigned. This method does not advance the timeline but consumes all slack. ### Parameters - **profile** (int) - Profile number (0-31) ### Returns - **float** - IIR filter output in Y0 units of full scale ``` -------------------------------- ### get(profile) Source: https://m-labs.hk/artiq/manual/_modules/artiq/coredevice/ad9910.html Retrieves the frequency, phase, and amplitude. ```APIDOC ## get(profile: TInt32) -> TTuple([TFloat, TFloat, TFloat]) ### Description Get the frequency, phase, and amplitude. ### Parameters - **profile** (TInt32) - Optional - Profile number to get (0-7, default: 7) ### Returns - **TTuple** - A tuple (frequency, phase, amplitude) ``` -------------------------------- ### Download XML configuration to PC Source: https://m-labs.hk/artiq/manual/_modules/artiq/coredevice/cxp_grabber.html Demonstrates reading a camera XML configuration file into a buffer and saving it to the host PC. ```python # Prepare a big enough buffer buffer = [0] * 25600 # Read the XML file and write it to PC cxp_grabber.read_local_xml(buffer) write_file(buffer, "camera_setting.xml") ``` -------------------------------- ### View Applet Help Source: https://m-labs.hk/artiq/manual/_sources/faq.rst.txt Use the help flag to list available command-line options for a specific applet module. ```bash $ python -m artiq.applets.plot_xy -h ``` -------------------------------- ### output_enable() Source: https://m-labs.hk/artiq/manual/_modules/artiq/coredevice/ad9834.html Disables the DDS reset and starts signal generation. ```APIDOC ## output_enable() ### Description Clears the AD9834_RESET bit, allowing the AD9834 to begin generating signals. This method should be called after configuration of the frequency and phase settings to activate the output. ``` -------------------------------- ### get_y1 Source: https://m-labs.hk/artiq/manual/_modules/artiq/coredevice/phaser_drtio.html Gets a profile's IIR y[n-1] value. ```APIDOC ## get_y1(profile) -> TFloat ### Description Returns a profile's IIR y[n-1] fractional filter output. This method consumes all slack. ### Parameters - **profile** (int) - Profile number (0 to 3) ``` -------------------------------- ### Create Boot Image Source: https://m-labs.hk/artiq/manual/_sources/building_developing.rst.txt Command to generate the final boot.bin file from the BIF configuration. ```bash $ mkbootimage boot.bif boot.bin ``` -------------------------------- ### start_roi_viewer Source: https://m-labs.hk/artiq/manual/_modules/artiq/coredevice/cxp_grabber.html Defines the coordinates of the ROI viewer and starts the capture process. ```APIDOC ## start_roi_viewer(x0, y0, x1, y1) ### Description Defines the coordinates of ROI viewer and starts the capture. Note that the ROI viewer has a maximum height limit of 1024 and a total size limit of 4096 pixels. ### Parameters - **x0** (int) - Required - Starting X coordinate. - **y0** (int) - Required - Starting Y coordinate. - **x1** (int) - Required - Ending X coordinate. - **y1** (int) - Required - Ending Y coordinate. ``` -------------------------------- ### get_y_mu Source: https://m-labs.hk/artiq/manual/_modules/artiq/coredevice/suservo.html Get a profile's IIR state in machine units. ```APIDOC ## get_y_mu(profile) ### Description Get a profile's IIR state (filter output, Y0) in machine units. The IIR state is also known as the "integrator", or the DDS amplitude scale factor. It is 17 bits wide and unsigned. This method does not advance the timeline but consumes all slack. ### Parameters - **profile** (int) - Profile number (0-31) ### Returns - **int** - 17-bit unsigned Y0 ``` -------------------------------- ### Write config key usage Source: https://m-labs.hk/artiq/manual/utilities.html Displays help for writing configuration keys. ```bash artiq_coremgmt config write [-h] [-s KEY STRING] [-f KEY FILENAME] ``` -------------------------------- ### Build firmware and gateware for Kasli Source: https://m-labs.hk/artiq/manual/_sources/building_developing.rst.txt Build binaries for Kasli using a system description JSON file. ```bash $ python -m artiq.gateware.targets.kasli .json ``` -------------------------------- ### Get frequency and phase Source: https://m-labs.hk/artiq/manual/_modules/artiq/coredevice/ad9912.html Retrieves the current frequency and phase as a tuple. ```python @kernel def get(self) -> TTuple([TFloat, TFloat]): """Get the frequency and phase. See also :meth:`AD9912.get_mu`. :return: A tuple (frequency, phase). """ # Get values ftw, pow_ = self.get_mu() # Convert and return return self.ftw_to_frequency(ftw), self.pow_to_turns(pow_) ``` -------------------------------- ### get_mu Source: https://m-labs.hk/artiq/manual/_modules/artiq/coredevice/ad9912.html Get the frequency tuning word and phase offset word. ```APIDOC ## get_mu() -> TTuple([TInt64, TInt32]) ### Description Reads the current frequency tuning word and phase offset word from the device. ### Returns - (TTuple) - A tuple containing (FTW, POW). ``` -------------------------------- ### Build SZL Bootloader Source: https://m-labs.hk/artiq/manual/_sources/building_developing.rst.txt Command to build the SZL bootloader from source using Nix. ```bash $ nix build git+https://git.m-labs.hk/m-labs/zynq-rs#-szl ``` -------------------------------- ### get_att_mu Source: https://m-labs.hk/artiq/manual/_modules/artiq/coredevice/ad9912.html Get digital step attenuator value in machine units. ```APIDOC ## get_att_mu() -> TInt32 ### Description Retrieves the current attenuation setting in machine units. ### Returns - (TInt32) - 8-bit digital attenuation setting. ``` -------------------------------- ### init() Source: https://m-labs.hk/artiq/manual/core_drivers_reference.html Initializes the AD9834 device. ```APIDOC ## init() ### Description Initializes the AD9834 by configuring the SPI bus parameters and putting the device into a reset state. ``` -------------------------------- ### init(self, blind) Source: https://m-labs.hk/artiq/manual/_modules/artiq/coredevice/urukul.html Initializes the Urukul device with ProtoRev9, resetting the DDS I/O interface without pulsing the master reset. ```APIDOC ## init(blind) ### Description Initialize Urukul with ProtoRev9. Resets the DDS I/O interface. Does not pulse the DDS MASTER_RESET as that confuses the AD9910. ### Parameters - **blind** (bool) - Required - If True, skips protocol revision verification. ``` -------------------------------- ### Manage Nix Profiles Source: https://m-labs.hk/artiq/manual/_sources/installing.rst.txt Commands to list and remove installed Nix profiles. ```bash $ nix profile list ``` ```bash $ nix profile remove [name] ``` ```bash $ nix profile remove [index] ``` -------------------------------- ### init(self, blind=False) Source: https://m-labs.hk/artiq/manual/_modules/artiq/coredevice/ad53xx.html Configures the SPI bus, drives LDAC and CLR high, programs the offset DACs, and enables overtemperature shutdown. This method must be called before any other method at start-up or if the SPI bus has been accessed by another device. ```APIDOC ## init(blind=False) ### Description Configures the SPI bus, drives LDAC and CLR high, programs the offset DACs, and enables overtemperature shutdown. This method must be called before any other method at start-up or if the SPI bus has been accessed by another device. ### Parameters - **blind** (bool) - Optional - If True, do not attempt to read back control register or check for overtemperature. ``` -------------------------------- ### write(data) Source: https://m-labs.hk/artiq/manual/core_drivers_reference.html Writes SPI data to the shift register and starts the transfer. ```APIDOC ## write(data) ### Description Write SPI data to shift register and start transfer. This method advances the timeline by the duration of one single-transfer SPI transaction. ### Parameters - **data** (int) - Required - SPI output data to be written. ``` -------------------------------- ### Get Variants Source: https://m-labs.hk/artiq/manual/utilities.html Command to retrieve available firmware variants and their expiry dates. ```bash afws_client get_variants [-h] ``` -------------------------------- ### Start ARTIQ Master with SSL Source: https://m-labs.hk/artiq/manual/_sources/getting_started_mgmt.rst.txt Enable SSL encryption for the master by providing its certificate and key, along with the client certificate for authentication. ```bash $ artiq_master --ssl ``` -------------------------------- ### Get Reference Time Source: https://m-labs.hk/artiq/manual/_modules/artiq/coredevice/suservo.html Reads the fiducial time stamp of the specified profile. ```python @kernel def get_reference_time(self, profile): addr = self.servo.phase_sel | (((self.servo_channel << PROFILE_WIDTH) | profile) << 1) self.core.break_realtime() lo = self.servo.read(addr) self.core.break_realtime() hi = self.servo.read(addr + 1) return (hi << 16) | (lo & 0xffff) ``` -------------------------------- ### get_att Source: https://m-labs.hk/artiq/manual/_modules/artiq/coredevice/ad9912.html Get digital step attenuator value in SI units (dB). ```APIDOC ## get_att() -> TFloat ### Description Retrieves the current attenuation setting in dB. ### Returns - (TFloat) - Attenuation in dB. ``` -------------------------------- ### AD53xx.init(blind) Source: https://m-labs.hk/artiq/manual/core_drivers_reference.html Configures the SPI bus and initializes the DAC. ```APIDOC ## AD53xx.init(blind) ### Description Configures the SPI bus, drives LDAC and CLR high, programmes the offset DACs, and enables overtemperature shutdown. This method must be called before any other method at start-up. ### Parameters - **blind** (bool) - Optional - If True, do not attempt to read back control register or check for overtemperature (default: False). ``` -------------------------------- ### cxp_grabber.start_roi_viewer Source: https://m-labs.hk/artiq/manual/core_drivers_reference.html Initializes the ROI viewer with specific coordinates and dimensions. ```APIDOC ## cxp_grabber.start_roi_viewer(x, y, width, height) ### Description Sets the coordinate and dimensions for the ROI viewer and initiates capture. ### Parameters - **x** (int) - X-coordinate of the ROI. - **y** (int) - Y-coordinate of the ROI. - **width** (int) - Width of the ROI. - **height** (int) - Height of the ROI. ``` -------------------------------- ### Verify Conda installation Source: https://m-labs.hk/artiq/manual/installing.html Check if the conda command is available in the current shell path. ```bash $ conda ``` -------------------------------- ### Register Driver in device_db.py Source: https://m-labs.hk/artiq/manual/_sources/extending_rtio.rst.txt Example entry for a custom driver in the ARTIQ device database. ```python device_db["leds"] = { "type": "local", "module": "artiq.coredevice.linked_led", "class": "LinkedLED", "arguments": {"channel": 0x000008} } ``` -------------------------------- ### init() Source: https://m-labs.hk/artiq/manual/_modules/artiq/coredevice/ad9834.html Configures the SPI bus and resets the DDS device. ```APIDOC ## init() ### Description Performs the necessary setup for the AD9834 device, including configuring the SPI bus parameters and putting the AD9834 into a reset state to ensure proper initialization. ``` -------------------------------- ### Get Tracked FTW Source: https://m-labs.hk/artiq/manual/_modules/artiq/coredevice/suservo.html Reads the tracked frequency tuning word (FTW) of the channel. ```python @kernel def get_tracked_ftw(self): addr = self.servo.phase_sel | (((1 << PROFILE_WIDTH) * self.servo.num_channels + (self.servo_channel << 1) | 0) << 1) self.core.break_realtime() lo = self.servo.read(addr) self.core.break_realtime() hi = self.servo.read(addr + 1) return (hi << 16) | (lo & 0xffff) ``` -------------------------------- ### Enter the ARTIQ boards development shell Source: https://m-labs.hk/artiq/manual/_sources/building_developing.rst.txt Access the lightweight boards shell for building firmware and flashing without cloning the full repository. ```bash $ nix develop git+https://git.m-labs.hk/M-Labs/artiq.git\?ref=release-[number]#boards ``` -------------------------------- ### Get Attenuation Source: https://m-labs.hk/artiq/manual/_modules/artiq/coredevice/ad9910.html Retrieves the digital step attenuator value in SI units (dB). ```python @kernel def get_att(self) -> TFloat: """Get digital step attenuator value in SI units. See also :meth:`CPLD.get_channel_att `. :return: Attenuation in dB. """ return self.cpld.get_channel_att(self.chip_select - 4) ``` -------------------------------- ### SimpleApplet Class Initialization and Configuration Source: https://m-labs.hk/artiq/manual/_modules/artiq/applets/simple.html The SimpleApplet class manages command-line arguments, dataset registration, and the Qt event loop for standalone or embedded applet execution. ```python class SimpleApplet: def __init__(self, main_widget_class, cmd_description=None, default_update_delay=0.0): self.main_widget_class = main_widget_class self.argparser = argparse.ArgumentParser(description=cmd_description) self.argparser.add_argument( "--update-delay", type=float, default=default_update_delay, help="time to wait after a mod (buffering other mods) " "before updating (default: %(default).2f)") group = self.argparser.add_argument_group("standalone mode (default)") group.add_argument( "--server", default="localhost", help="hostname or IP of the master to connect to " "for dataset notifications " "(ignored in embedded mode)") group.add_argument( "--port-notify", default=3250, type=int, help="TCP port to connect to for notifications (ignored in embedded mode)") group.add_argument( "--port-control", default=3251, type=int, help="TCP port to connect to for control (ignored in embedded mode)") self._arggroup_datasets = self.argparser.add_argument_group("datasets") self.dataset_args = set() ``` ```python def add_dataset(self, name, help=None, required=True): kwargs = dict() if help is not None: kwargs["help"] = help if required: self._arggroup_datasets.add_argument(name, **kwargs) else: self._arggroup_datasets.add_argument("--" + name, **kwargs) self.dataset_args.add(name) ``` ```python def args_init(self): self.args = self.argparser.parse_args() self.embed = os.getenv("ARTIQ_APPLET_EMBED") self.datasets = {getattr(self.args, arg.replace("-", "_")) for arg in self.dataset_args} # Optional prefixes (dataset sub-trees) to match subscriptions against; # currently only used by out-of-tree subclasses (ndscan). self.dataset_prefixes = [] ``` ```python def qasync_init(self): app = QtWidgets.QApplication([]) self.loop = QEventLoop(app) asyncio.set_event_loop(self.loop) ``` ```python def ipc_init(self): if self.embed is not None: self.ipc = AppletIPCClient(self.embed) self.loop.run_until_complete(self.ipc.connect()) ``` ```python def ipc_close(self): if self.embed is not None: self.ipc.close() ``` -------------------------------- ### Control Digital Step Attenuator Source: https://m-labs.hk/artiq/manual/_modules/artiq/coredevice/ad9910.html Methods to set and get attenuation values for the channel. ```python @kernel def set_att_mu(self, att: TInt32): """Set digital step attenuator in machine units. This method will write the attenuator settings of this channel (For Urukul proto_rev 0x08, all four channels will be updated at same time). See also :meth:`CPLD.get_channel_att `. :param att: Attenuation setting, 8-bit digital. """ self.cpld.set_att_mu(self.chip_select - 4, att) ``` ```python @kernel def set_att(self, att: TFloat): """Set digital step attenuator in SI units. This method will write the attenuator settings of this channel (For Urukul proto_rev 0x08, all four channels will be updated at same time). See also :meth:`CPLD.get_channel_att `. :param att: Attenuation in dB. """ self.cpld.set_att(self.chip_select - 4, att) ``` ```python @kernel def get_att_mu(self) -> TInt32: """Get digital step attenuator value in machine units. See also :meth:`CPLD.get_channel_att `. ```