-
To set up a new Python project, use the SWC cookiecutter repository. This ensures that the required tooling is in place (e.g. CI) and also that we are all using a familiar project structure. Part of using this cookiecutter is keeping it updated (e.g. Python versions, best practices) and communicating those changes to all users (including those at SWC).
-
Whenever possible, we will use
pyproject.toml
as the main configuration file for the project. Support forsetup.cfg
andsetup.py
will be deprecated in future python versions. This will also be the default option for the SWC cookiecutter.
This file contains hidden or 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
import numpy as np | |
from brainrender import Scene | |
from brainrender.actors import Points | |
scene = Scene() | |
mos = scene.add_brain_region("MOs", alpha=0.15) | |
# coordinate from brainglobe_segmentation |
This file contains hidden or 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
# /// script | |
# requires-python = "==3.12" | |
# dependencies = [ | |
# "napari[all]", | |
# "brainreg[napari]", | |
# ] | |
# /// | |
import napari |
This file contains hidden or 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
alias dblc='rm -rf docs/build && sphinx-build docs/source docs/build -b linkcheck' |
This file contains hidden or 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
import numpy as np | |
import tifffile as tiff | |
from pathlib import Path | |
# Define the input and output directories | |
input_dir = Path('/home/adam/Desktop/blackcap/blackcap_stitched/2') | |
output_dir = Path('/home/adam/Desktop/blackcap/blackcap_stitched_padded/2') | |
# Ensure the output directory exists | |
output_dir.mkdir(parents=True, exist_ok=True) |
This file contains hidden or 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
from pathlib import Path | |
from myterial import * | |
from rich import print | |
from brainrender import Scene | |
from brainrender import settings | |
settings.SHOW_AXES = False | |
This file contains hidden or 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
# To use, download GitHub usage report from the organisation | |
# billing tab then run e.g.: | |
# `python actions_billing_summary.py file.csv` | |
import sys | |
import pandas as pd | |
actions_csv = sys.argv[1] | |
df = pd.read_csv(actions_csv) |
This file contains hidden or 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
# import packages | |
import numpy as np | |
import pandas as pd | |
from skimage.measure import label | |
# assign arrays to simpler variables | |
labels = label(viewer.layers["Labels"].data[0]) | |
red_data = viewer.layers["NAME_OF_RED_CHANNEL"].data | |
# intialise empty list |
This file contains hidden or 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
import dask.array as da | |
import xarray as xr | |
import numpy as np | |
from imlib.IO.cells import cells_xml_to_df | |
from skimage.io import imread | |
from dask import delayed | |
from glob import glob | |
from pathlib import Path |
This file contains hidden or 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
sudo apt-get update | |
sudo apt-get install ca-certificates curl gnupg lsb-release | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg | |
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
sudo apt-get update | |
sudo apt-get install docker-ce docker-ce-cli containerd.io | |
sudo usermod -aG docker $USER | |
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose |
NewerOlder