Skip to content

Instantly share code, notes, and snippets.

@squarednob
squarednob / bacterial_particle.py
Created Sep 30, 2017
Bacterial particle script for Blender.
View bacterial_particle.py
import bpy
import numpy as np
import random
# Abbriviations.
obj = bpy.context.object
par_system = obj.particle_systems[0]
particles = par_system.particles
par_setting = particles.data.settings
View 0増殖パーティクルの説明.md

パーティクルシステムがついたオブジェクトを選択し、scripting画面でコードをコピペして、runで実行できます。

bacterial_particle_jp.py:

増殖パーティクルのpythonスニペット。以下の機能を追加することで、疑似的な増殖粒子を作ります。

  • pythonによる制御なしでは、birth timeとlifetimeの間で、各粒子がインデックスの順に均一な間隔で誕生します。これをpythonスクリプトによって、一定間隔で今の倍の粒子が誕生するようにbirth_timeを粒子ごとに割り振ります。
  • さらに、新たに誕生した粒子を既存の粒子の近くに配置することで、粒子の増殖と近似させます。
@squarednob
squarednob / d3-electrophoresis.js
Last active Apr 13, 2017
d3-electrophoresis scale change range1
View d3-electrophoresis.js
function electrophoresis(config){
// ---------------Dict arguments ----------------
var config = (config === undefined) ? {} : config;
config.DNA = (config.DNA === undefined) ? "AGCGCCCAATACGCAAACCGCCTCTCCCCGCGCGTTGGCCGATTCACGTTTACGAGTTGGAAACGA" : config.DNA;
config.enzymes = (config.enzymes === undefined) ? [[1,5,10,15,20,30,40,50,70,100],"CAAA","GTTGG","GGATCC", "GA",["GT","CCT"],"ACC", "GAAA"] : config.enzymes;
config.names = (config.names === undefined) ? ["marker", "1", "2", "3", "4", "5", "6", "7"]: config.names;
config.scale = (config.scale === undefined) ? d3.scaleSqrt(): config.scale;
config.lane_number = (config.lane_number === undefined) ? 8 : config.lane_number;
config.gel_margin = (config.gel_margin === undefined) ? {top: 40, right: 20, bottom: 30, left: 20} : config.gel_margin;
@squarednob
squarednob / README.md
Last active Feb 24, 2017
D3-electrophoresis: Customizing setting with Trump inauguration text
View README.md

D3-electrophoresis plugin example: Default text is Trump's inauguration speech. You can change text and words in text box.

Github: D3-electrophoresis

@squarednob
squarednob / README.md
Last active Feb 17, 2017
D3-electrophoresis: Customizing settings with DNA sequence.
View README.md

D3-electrophoresis plugin example: Default text is a kind of DNA sequence. You can change text and words in text box.

Github: D3-electrophoresis

@squarednob
squarednob / README.md
Last active Feb 17, 2017
D3-electrophoresis: Simple Example
View README.md
View python:state-space model test with numpy
# coding: utf-8
# In[1]:
import numpy as np
import scipy as sp
# matplotlib:
from matplotlib.pylab import plt
View blender_addon_template_toolshelf-input1.py
import bpy
# Meta information.
bl_info = {
"name": "Addon-template1: Add IcoSphere",
"author": "Gappy",
"version": (1, 0),
"blender": (2, 75, 0),
"location": "Object > Ball",
"description": "Add IcoSphere",
View blender_dupl-on-curves1.py
import bpy
def dupliOnCurve(curve_length_effect=None, replace=None):
'''
When you want to duplicate an object on object: Simply do "object > make links > object data".
The function is optimised for an object to duplicate on curves, althoubh it can be used to duplicate on objects.
Usage:
1. Multiple selecte curves, and lastly select an object as an object to be duplicated.
2. Paste the code on text editor which can be found in scripting layout.
@squarednob
squarednob / pseudo-integrate.ipynb
Created Feb 24, 2016
Python: Pseudo integrate class
View pseudo-integrate.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.