This file contains hidden or 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
def core_shell_gaussian(x, core, shell): | |
""" | |
since we're dealing with REAL image with normally uint8 float type | |
value < 1/255 --> value = 0 | |
let zero = 1/256 | |
""" | |
constant = shell ** 2 * 0.18033688011112042 # - shell^2 / ln(zero) | |
core_shell = np.exp(- (x - core) ** 2 / constant) | |
core_shell[x <= core] = 1.0 # construct core | |
core_shell[x >= (core + shell)] = 0.0 # trim 4 edges of the box |
This file contains hidden or 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
import numpy as np | |
import matplotlib.pyplot as plt | |
import numpy as np | |
from mpl_toolkits.mplot3d import Axes3D | |
from scipy.optimize import least_squares | |
def get_best_rotation(r1, r2): | |
""" | |
calculate the best rotation to relate two sets of vectors |
This file contains hidden or 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
DELETE FROM raw_image WHERE id NOT IN (SELECT raw_image_id FROM result); | |
DELETE FROM image WHERE id NOT IN (SELECT image_id FROM result); | |
DELETE FROM image_parameter WHERE id NOT IN (SELECT image_parameter_id FROM result); | |
DELETE FROM segment_parameter WHERE id NOT IN (SELECT segment_parameter_id FROM result); | |
DELETE FROM result_tag WHERE id_result NOT IN (SELECT id FROM result); | |
VACUUM; |
This file contains hidden or 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
def array_to_xyz(filename, array): | |
""" | |
Append many frames to the same xyz file that ovito can read | |
The file is overwritten everytime | |
array: [frame_1, frame_2, ...] | |
coordinate in one frame: (dimension, number_of_particles) | |
""" | |
if '.xyz' == filename[-4:]: | |
fname = filename | |
else: |
This file contains hidden or 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
import numpy as np | |
import matplotlib.pyplot as plt | |
from scipy import ndimage | |
from scipy import signal | |
a = np.ones((20, 20)) * 0 | |
a[5, 5] = 1 | |
a[10, 10] = 1 | |
a[15, 15] = 1 |
This file contains hidden or 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
import numpy as np | |
from scipy.optimize import minimize | |
def get_in_plane_dist_sqr(x, e1, e2): | |
gamma, delta = x | |
dist_sqr = gamma**2 + delta**2 - 2 * gamma * delta * (e1 @ e2) | |
return dist_sqr | |
def get_segment_dist(r1, r2, e1, e2, L1, L2): | |
""" |
This file contains hidden or 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
def conflict(conf): | |
for i in range(len(conf) - 1): | |
if conf[i] == conf[-1]: | |
return True | |
if len(conf) - i - 1 == conf[-1] - conf[i]: | |
return True | |
elif len(conf) - i - 1 == conf[i] - conf[-1]: | |
return True | |
return False |
This file contains hidden or 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
ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers/X11 /usr/local/include/X11 | |
./configure\ | |
--enable-optimizations\ | |
--prefix=/usr/local\ | |
--enable-shared\ | |
--with-openssl=$(brew --prefix openssl)\ | |
CPPFLAGS="-I/usr/local/opt/openssl/include"\ | |
LDFLAGS="-L/usr/local/opt/openssl/lib" |
This file contains hidden or 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 | |
import re | |
import sys | |
from textwrap import dedent | |
STOPWORDS = [ # common stop words from package nltk | |
"i", "me", "my", "myself", "we", "our", "ours", "ourselves", "you", "you're", "you've", "you'll", | |
"you'd", "your", "yours", "yourself", "yourselves", "he", "him", "his", "himself", "she", "she's", | |
"her", "hers", "herself", "it", "it's", "its", "itself", "they", "them", "their", "theirs", | |
"themselves", "what", "which", "who", "whom", "this", "that", "that'll", "these", "those", "am", |
This file contains hidden or 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
./configure --with-features=huge \ | |
--enable-multibyte \ | |
--enable-rubyinterp=yes \ | |
--enable-python3interp=yes \ | |
--with-python3-config-dir=$(python3-config --configdir) \ | |
--enable-perlinterp=yes \ | |
--enable-luainterp=yes \ | |
--enable-cscope \ | |
--prefix=/usr/local |
OlderNewer