Skip to content

Instantly share code, notes, and snippets.

@kozo2
Created February 7, 2020 14:06
Show Gist options
  • Save kozo2/236b3ba0f1cfed24ffff02c209a73451 to your computer and use it in GitHub Desktop.
Save kozo2/236b3ba0f1cfed24ffff02c209a73451 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{"cells":[{"metadata":{"trusted":true},"cell_type":"code","source":"from scopyon.image import convert_8bit\nfrom scopyon.io import read_spatiocyte\nfrom scopyon.config import Config\nfrom scopyon.epifm import EPIFMSimulator","execution_count":2,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"exposure_time = 0.100\n# t0, t1 = 0.0, exposure_time * 100\nt0, t1 = 0.0, exposure_time * 2\nmax_count = None # 20\nrndseed = 0\ncmin, cmax = 1900, 2500\ninput_path = './examples/data/inputs_epifm'\noutput_path = './examples/data/outputs_tirf'","execution_count":4,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"import numpy\nrng = numpy.random.RandomState(rndseed)\n\n## read input data\n(input_data1, lengths) = read_spatiocyte(t0, t1, pathto=input_path, observable='S1', max_count=max_count)","execution_count":6,"outputs":[{"output_type":"stream","text":"/home/jovyan/scopyon/io.py:83: UserWarning: A species ID is invalid [[theNullID][5]=2e-08]. Ignored\n warnings.warn('A species ID is invalid [{}]. Ignored'.format(sp))\n","name":"stderr"},{"output_type":"stream","text":"observables = [0]\n","name":"stdout"}]},{"metadata":{"trusted":true},"cell_type":"code","source":"(input_data2, _) = read_spatiocyte(t0, t1, pathto=input_path, observable='S2', max_count=max_count)","execution_count":7,"outputs":[{"output_type":"stream","text":"observables = [1]\n","name":"stdout"}]},{"metadata":{"trusted":true},"cell_type":"code","source":"config = Config()","execution_count":8,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"config.set_epifm_shutter(start_time=t0, end_time=t1)\nconfig.set_epifm_light_source(source_type='LASER', wave_length=532e-9, flux_density=40, angle=72)\nconfig.set_epifm_fluorophore(fluorophore_type='Tetramethylrhodamine(TRITC)', normalization=1.0, radius=20e-9)\nconfig.set_epifm_dichroic_mirror('FF562-Di03-25x36')\nfocal_point = numpy.array([lengths[0] * 0.0, lengths[1] * 0.5, lengths[2] * 0.5])\nconfig.set_epifm_magnification(magnification=241)\nconfig.set_epifm_detector(detector='EMCCD', image_size=(512, 512), pixel_length=16e-6, exposure_time=exposure_time, focal_point=focal_point, QE=0.92, readout_noise=100, emgain=300)\nconfig.set_epifm_analog_to_digital_converter(bit=16, offset=2000, fullwell=800000)","execution_count":9,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"config.set_effects_background(mean=0.01)\nconfig.set_effects_fluorescence(quantum_yield=0.61, abs_coefficient=83400)\nconfig.set_effects_photobleaching(tau0=2.27, alpha=0.73)","execution_count":10,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"sim = EPIFMSimulator(config, rng=rng)","execution_count":11,"outputs":[{"output_type":"stream","text":"/home/jovyan/scopyon/epifm.py:216: UserWarning: The given wave length [6e-07] was ignored\n warnings.warn('The given wave length [{}] was ignored'.format(wave_length))\n","name":"stderr"}]},{"metadata":{"trusted":true},"cell_type":"code","source":"input_data1 = sim.apply_photophysics_effects(input_data1, rng=rng)","execution_count":12,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"input_data2 = sim.apply_photophysics_effects(input_data2, rng=rng)","execution_count":13,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"low, high = 0, 255","execution_count":14,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"Nw_pixel, Nh_pixel = sim.configs.detector_image_size # pixels","execution_count":15,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"import matplotlib.pyplot as plt\n","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"name":"python3","display_name":"Python 3","language":"python"},"language_info":{"name":"python","version":"3.7.6","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat":4,"nbformat_minor":4}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment