Skip to content

Instantly share code, notes, and snippets.

Avatar

Dan Allan danielballan

View GitHub Profile
@danielballan
danielballan / aps_polar_example.py
Last active Jan 11, 2021 — forked from AbbyGi/README.md
APS 4-ID POLAR bluesky-widgets example
View aps_polar_example.py
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)
View bluesky_datagram_protocol.py
from asyncio import DatagramProtocol, gather, get_event_loop, sleep
from collections import deque
from functools import partial
from json import loads, dumps
from random import choices, random
from ophyd import Device
from ophyd.status import DeviceStatus, Status
CLIENT_PORT = 9870
View bluesky_datagram_protocol.py
from asyncio import DatagramProtocol, gather, get_event_loop, sleep
from collections import deque
from functools import partial
from json import loads, dumps
from random import choices, random
from ophyd import Device
from ophyd.status import DeviceStatus, Status
CLIENT_PORT = 9870
View example.py
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numba
import numpy as np
from memory_profiler import profile
Num_profile=100
modes=10
v0=3.08e4
R=0.5
@danielballan
danielballan / laptop_camera.py
Last active Feb 7, 2018 — forked from mrakitin/laptop_camera.py
Trigger laptop camera
View laptop_camera.py
import cv2
import matplotlib.pyplot as plt
from ophyd import DeviceStatus
import queue
import weakref
class LaptopCamera:
def __init__(self, cam_id=0):
self.cam_id = cam_id
@danielballan
danielballan / download_ftp_tree.py
Last active Sep 12, 2021 — forked from Jwely/download_ftp_tree.py
recursive ftp directory downloader with python
View download_ftp_tree.py
import argparse
import ftplib
import os
import tqdm
import time
"""
Example usage as a CLI:
```
View customized_count_tiff_exporter.py
## customized count
def delayed_count(detectors, shutter_config, interval=None, num=1, *, md=None):
"""
Take one or more readings from detectors.
Parameters
----------
detectors : list
list of 'readable' objects
gasses : list of string
name of gasses want to alterna
View checklist.org
  • [ ] ask about any BL specific packages / installation and add them to spreadsheet
    • [ ] get list of things we need to help them package and add them to spreadsheet
  • [ ] update conda to 4.0.x – NOT to the latest version
    • $ sudo conda update -n root “conda<4.1”
  • [ ] fix permissions of /opt/conda
    • $ find /opt/conda -type d -execdir chmod og+x {} +
    • $ chmod -R a+r /opt/conda
  • [ ] install ‘blessed’ environment list
View Experiments as Iterators.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View migrate.py
import metadatastore.conf
from collections import deque
from tqdm import tqdm
import ipyparallel as ipp
def main():
old_config = dict(metadatastore.conf.connection_config)
new_config = old_config.copy()
new_config['database'] = 'metadatastore_production_v1'