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
void init_TC0_waveform() | |
{ | |
sysclk_enable_peripheral_clock(ID_TC0); | |
tc_init(TC0, 0, | |
TC_CMR_TCCLKS_TIMER_CLOCK4 | // select clock source | |
TC_CMR_WAVE | // waveform mode | |
TC_CMR_EEVT_XC0 | // external event selection - enables TIOB output! | |
TC_CMR_ASWTRG_SET | // set A on timer start | |
TC_CMR_ACPA_CLEAR | // clear A on compare event A |
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
HEADER = """\ | |
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
<IndirectPrinting> | |
""" | |
FOOTER = """\ | |
<Attributes> | |
<PrintName>CustomPrint</PrintName> | |
<Originals>4</Originals> | |
<Replicants>{Replicants}</Replicants> |
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
# https://chat.openai.com/c/cff8e0fc-20df-4425-9e2b-7aa8228ab7a1 | |
## Install ffmpeg on RHEL8: https://www.benholcomb.com/ffmpeg-on-rhel8/ | |
## After that | |
# sudo yum install python3-devel | |
## Create virtual environment | |
# python3 -m venv path/to/venv | |
# cd path/to/venv | |
# bin/activate |
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
Dialog.create("pTIRF movie creator"); | |
Dialog.addNumber("Time interval between frames", 500, 0, 6, "ms"); | |
Dialog.addNumber("Brightness/contrast: black level", 400, 0, 6, "counts"); | |
Dialog.addNumber("Brightness/contrast: white level", 1000, 0, 6, "counts"); | |
Dialog.addNumber("Time point of injection", 10, 1, 6, "s"); | |
Dialog.show(); | |
exp_time = Dialog.getNumber() / 1000.0; | |
low = Dialog.getNumber(); | |
high = Dialog.getNumber(); |
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
#!/usr/bin/env python | |
# coding: utf-8 | |
import skimage.io as skio | |
import numpy as np | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
from os.path import basename, splitext, exists | |
from time import sleep | |
from os import listdir |
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
function [ax,AxisPos] = subplotTight(nRow, nCol, varargin) | |
% subplotTight faster version of subplot with tight plot spacing | |
% | |
% https://www.mathworks.com/matlabcentral/answers/16458-making-less-space-between-figures-in-subplot | |
%% Process input arguments | |
narginchk(2,Inf); | |
nargoutchk(0,1); |
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 creates an external pulse source for an Arduino board - useful for timer debugging! | |
/* python | |
from time import sleep | |
from serial import Serial | |
from ctypes import c_uint32 | |
from avrpy.mega328P import Mega328P | |
avr = Mega328P("COM6") |
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
#include <stdint.h> | |
#include <Arduino.h> | |
#ifndef _AVR_IOXXX_H_ | |
#include <avr/iom328.h> // Arduino Uno uses AtMega328p microchip | |
#endif | |
uint32_t us2cts(uint32_t us) | |
{ | |
return us >> 2; | |
} |
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
#define uchar unsigned char | |
void setup_timer_counter_1(){ | |
/* TCCR1: Timer Counter Control Register */ | |
// bit 7 6 5 4 3 2 1 0 | |
uchar _TCCR1A = 0; // COM1A1 COM1A0 COM1B1 COM1B0 - - WGM10 WGM11 | |
uchar _TCCR1B = 0; // ICNC1 ICES1 - WGM13 WGM12 CS12 CS11 CS10 | |
uchar _TCCR1C = 0; // FOC1A FOC1B - - - - - - | |
// Set COM (Compare Output Mode) for pins OC1A (#9) and OC1B (#10) |
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
LAYER = 'Cy3' | |
OUT = 'my_exported_image_' + LAYER | |
from matplotlib import pyplot as plt | |
import numpy as np | |
layer = viewer.layers[LAYER] | |
img = layer.data | |
NewerOlder