Skip to content

Instantly share code, notes, and snippets.

View oeway's full-sized avatar

Wei Ouyang oeway

  • Science For Life Laboratory
  • Stockholm
View GitHub Profile
@oeway
oeway / SageWorksheet_Data Monitor for thunderSTORM Analysis
Last active August 29, 2015 14:16
This Gist perform the automation of thunderSTORM analysis by monitoring the file change and submit task to the cluster.
View SageWorksheet_Data Monitor for thunderSTORM Analysis
<h2>Introduction</h2>
<p>This worksheet is used to monitor data changes in the defined folder, and apply it to another worksheet which created from a template.</p>
<h2>Usage</h2>
<h3>Step 1. Select the folder to be monitored</h3>
<p>Select the "Input" by click on the text "Input:..." in the toolbar(beside Run and Pause button), and input the folder path.</p>
<p>Please note that the path should be absolute path on the server seperated by "/", for example: <strong><em>&nbsp;/pasteur/projets/Imod-grenier/Will/data/dropbox</em></strong> .</p>
<h3>Step 2. Define the template worksheet which will be applied when new data is detected.</h3>
<p>Select the "Next Worksheet" by click the text "Input:..." in the toolbar(beside "Input:..."), and input the path of the next worksheet.</p>
<p>You can get the path of a worksheet by its link address, for example, if the linke of a worksheet is "http://xxxx.com/home/username/9", then <strong>username/9</strong> is the path of the worksheet, witch will be filled into the popup di
@oeway
oeway / meteorFilesUpload.py
Last active August 1, 2016 09:45
Upload files to meteor server with Meteor-Files and python-meteor
View meteorFilesUpload.py
# install Meteor-Files from https://github.com/VeliovGroup/Meteor-Files
# and python-meteor from https://github.com/hharnisc/python-meteor
from MeteorClient import MeteorClient
import uuid
import math
import base64
import os
import time
import requests
@oeway
oeway / TSFProto.proto
Last active October 2, 2016 22:30
Convert Tagged Spot File (.tsf from MicroManager) to Comma Separated Values file(.csv for thunderSTORM)
View TSFProto.proto
// This is a copy originally from: https://valelab.ucsf.edu/svn/valelabtools/TSFProto
package TSF;
option java_package = "edu.ucsf.tsf";
option java_outer_classname = "TaggedSpotsProtos";
enum FitMode {
ONEAXIS = 0;
TWOAXIS = 1;
TWOAXISANDTHETA = 2;
@oeway
oeway / visulize_filter_by_optimization.py
Created October 10, 2016 16:25
visualize filter by gradient descent on a random image
View visulize_filter_by_optimization.py
from keras import backend as K
img_width, img_height = 28,28
def visualize_filter(model, layer_name = 'convolution2d_1', filter_index = 0):
first_layer = model.layers[0]
# this is a placeholder tensor that will contain our generated images
input_img = first_layer.input
# get the symbolic outputs of each "key" layer (we gave them unique names).
@oeway
oeway / 0_reuse_code.js
Created March 13, 2017 23:39
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View filter_plugin.js
importScripts('https://rawgit.com/joewalnes/filtrex/master/filtrex.js')
class Filter {
constructor() {
this.default_expression = ''
}
async run(my){
const expression = my.data.filter_expression || this.default_expression;
const myfilter = compileExpression(expression)
View c3jsDemo.imjoy.html
<config lang="json">
{
"name": "C3.js Demo",
"mode": "window",
"tags": [],
"ui": "UI for Untitled Plugin",
"version": "0.1.0",
"api_version": "0.1.1",
"description": "describe your plugin here.",
"icon": "extension",
@oeway
oeway / janus_demo_1
Last active October 31, 2018 15:59 — forked from sunliqun123/janus_demo_1
View janus_demo_1
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import janus
import asyncio
import time
import threading
from bson.objectid import ObjectId
from autobahn.asyncio.wamp import ApplicationSession
from autobahn.asyncio.wamp import ApplicationRunner
@oeway
oeway / WebPythonDemo.imjoy.html
Created November 20, 2018 14:01
This plugin demonstrate the web python mode in ImJoy which allows run python plugin with the browser.
View WebPythonDemo.imjoy.html
<docs lang="markdown">
Describe your plugin here.
</docs>
<config lang="json">
{
"name": "WebPython Demo",
"mode": "webpython",
"version": "0.1.0",
@oeway
oeway / plot_hist.py
Last active February 2, 2019 13:10
Python code to read .smlm file
View plot_hist.py
import numpy as np
def plotHist(tableDict, value_range=None, xy_range=None, pixel_size=20, sigma=None, target_size=None):
x = tableDict['x'][:]
y = tableDict['y'][:]
if xy_range:
xmin, xmax = xy_range[0]
ymin, ymax = xy_range[1]
else:
xmin, xmax, ymin, ymax = x.min(), x.max(), y.min(), y.max()
xedges = np.arange(xmin, xmax, pixel_size)