This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Creates a custom Raspbian image and cross-compilation environment. | |
# | |
# USAGE: ./create_image.sh | |
# | |
# This script must be run as either root or sudo. | |
# | |
# After creating the chroot environment, the script specified in the | |
# *script* variable will be executed from within the chroot. Your | |
# custom system setup commands should be located here. For example, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//! Demonstrates memory layout using copy and move semantics in Rust. | |
//! | |
//! # Examples | |
//! | |
//! The memory locations that you see by running this program will almost certainly be different | |
//! than what is found in the examples below. The important thing to pay attention to is the memory | |
//! location of the variable `x`. | |
//! | |
//! ```console | |
//! $ cargo run --release -- --copy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def safe_round(array: npt.ArrayLike, total: int) -> np.ndarray: | |
"""Rounds an array of floats, maintaining their integer sum.""" | |
array = np.asanyarray(array) | |
# Round the array to the nearest integer | |
rounded_array: np.ndarray = np.rint(array) | |
error = total - np.sum(rounded_array) | |
if error == 0: | |
return rounded_array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Simple simulator demonstrating event-driven acquisitions with pymmcore-plus""" | |
from logging import getLogger | |
from queue import Queue | |
import random | |
import time | |
from typing import Any, Iterable | |
from pymmcore_plus import CMMCorePlus | |
from useq import MDAEvent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Simulates image acquisiton and a live display of the images.""" | |
from dataclasses import dataclass | |
import multiprocessing as mp | |
from multiprocessing.connection import PipeConnection | |
import time | |
from matplotlib import pyplot as plt | |
import numpy as np |