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 digital pulse generation with PyDAQmx library and NI DAQmx board | |
# Requires NI DAQmx drivers, Python 2.7 installed, Windows. | |
# Tested on NI PCIe-6321 board | |
# Gist author: Nikita Vladimirov @nvladimus | |
import PyDAQmx as pd | |
ctr_ini_delay = 0 # sec | |
ctr_period = 0.1 # sec | |
ctr_duty_cycle = 0.01 | |
task = pd.Task() | |
task.CreateCOPulseChanFreq("Dev1/ctr0", "CamTrigger", pd.DAQmx_Val_Hz, pd.DAQmx_Val_Low, ctr_ini_delay, 1/float(ctr_period), ctr_duty_cycle) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# This python code uses MicroManager device drivers to control a camera. | |
# Tested on Hamamatsu Orca Flash 4 camera, should work similarly on other cameras. | |
# Original idea: Kay Schink @koschink | |
# Gist implementation: Nikita Vladimirov @nvladimus | |
#Environment setup instructions: https://micro-manager.org/wiki/Using_the_Micro-Manager_python_library | |
import sys | |
sys.path.append("C:\\Program Files\\Micro-Manager-1.4") | |
import MMCorePy #load MicroManager for device control | |
import matplotlib.pyplot as plt |
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
# Compute FWHM(x,y) using 2D Gaussian fit, min-square optimization | |
# Optimization fits 2D gaussian: center, sigmas, baseline and amplitude | |
# works best if there is only one blob and it is close to the image center. | |
# author: Nikita Vladimirov @nvladimus (2018). | |
# based on code example: https://stackoverflow.com/questions/21566379/fitting-a-2d-gaussian-function-using-scipy-optimize-curve-fit-valueerror-and-m | |
import numpy as np | |
import scipy.optimize as opt | |
def twoD_GaussianScaledAmp((x, y), xo, yo, sigma_x, sigma_y, amplitude, offset): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# Export your favorite Matplotlib colormap to Imaris look-up table (.pal file) | |
# Authors: ChatGPT and Nikita Vladimirov | |
# License: GPL3 | |
import matplotlib.cm as cm | |
cmap = cm.get_cmap('plasma') | |
output_file = './plasma_palette_8bit.pal' | |
with open(output_file, 'w') as f: | |
# Write the RGB values of each color in the colormap as text strings | |
for i in range(256): | |
rgba = cmap(i) |