Skip to content

Instantly share code, notes, and snippets.

View danielballan's full-sized avatar

Dan Allan danielballan

View GitHub Profile
@danielballan
danielballan / README.md
Last active June 9, 2022 18:32
FastAPI, Pydantic, and OpenAPI with recursive models
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@danielballan
danielballan / .flake8
Last active March 28, 2022 15:58
Store and search tomographic reconstructions with Tiled
[flake8]
max-line-length = 115
@danielballan
danielballan / example.md
Created February 17, 2022 22:29
FXI example data access

Example using public CC0-licensed FXI data

In this example, we connect to a public HTTP server and download raw tomography images.

It is not necessary to use Python to do this---curl would work fine---but the Tiled Python client is currently the most convenient way to do navigate the data.

pip install tiled[client]
@danielballan
danielballan / README.md
Created August 6, 2021 21:18
Bluesky Widgets Demo Quickstart

Bluesky Widgets Demo Quickstart

@danielballan
danielballan / README.md
Created July 17, 2021 18:09
MVP for Qt RemoteDispatcher

Terminal 1:

bluesky-0MQ-proxy 5567 5568

Terminal 2:

python publisher.py
@danielballan
danielballan / README.md
Last active February 24, 2021 17:03
IOC connection time analysis

IOC connection time analysis

We will use caproto-shark to analyze CA network traffic. Note that the actual servers and clients involve may or may not be using caproto themselves; it does not matter.

  1. Install caproto and pandas if they are not already installed.

    pip install caproto[standard] pandas
    
@danielballan
danielballan / logging-optimizations.md
Created January 28, 2021 16:47
Logging optimizations galaxy brain

Logging optimizations

We will examine the byte code to get a sense of how much work the interpreter is doing.

Setup

>>> import logging
>>> logger = logging.getLogger()
>>> from dis import dis
@danielballan
danielballan / aps_polar_example.py
Last active January 11, 2021 22:14 — forked from AbbyGi/README.md
APS 4-ID POLAR bluesky-widgets example
from bluesky_widgets.models.auto_plot_builders import AutoPlotter
from bluesky_widgets.models.plot_builders import Lines
from bluesky_widgets.models.plot_specs import AxesSpec, FigureSpec
from bluesky_widgets.qt.figures import QtFigures
import databroker
import numpy as np
def xanes(monitor, detector):
absorption = np.log(np.array(monitor) / np.array(detector)).reshape(-1, 4)