Skip to content

Instantly share code, notes, and snippets.

View danielballan's full-sized avatar

Dan Allan danielballan

View GitHub Profile
@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)
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
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
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 February 7, 2018 03:39 — forked from mrakitin/laptop_camera.py
Trigger laptop camera
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 January 12, 2023 12:10 — forked from Jwely/download_ftp_tree.py
recursive ftp directory downloader with python
import argparse
import ftplib
import os
import tqdm
import time
"""
Example usage as a CLI:
```
## 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
  • [ ] 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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'