padding zero on the left |
lpad(1, 3, '0') |
sprintf("%03d", 1) |
f"{1:03}" |
printf "%03d" 1 (Shell) |
check if substring |
occursin() |
|
in |
|
sum an array along row |
dims=1 |
margin=2 |
axis=0 |
|
read image |
Images::load() |
|
cv2.imread() skimage.io.imread() |
imread() (Matlab) |
write image |
save() |
|
cv2.imwrite() |
|
sort and argsort |
sort, sortperm |
sort(), order() |
sorted(), np.argsort() |
|
Jupyter kernels |
IJulia |
IRkernel |
ipykernel |
|
too many open figures |
inline |
|
rcParams |
|
merge multiple slices |
vcat |
|
np.r_ |
|
index of true elements |
findall |
which |
np.where()[0] |
|
freq table |
StatsBase::countmap() |
table |
np.unique(return_counts=True) |
|
contingency table |
FreqTable::freqtable() |
table |
|
|
figure size |
size in pixel |
|
figsize in inch |
|
straight line |
Plots.abline!() |
abline() |
|
|
get unique elements |
unique(x) |
unique(x) |
|
|
index for unique elements |
unique(i->x[i], 1:length(x)) |
which(!duplicated(x)) |
|
|
layout |
@layout |
layout |
|
|
priority of : |
0.1+1:10-1 == (0.1+1):(10-1) |
0.1+1:10-1 == 0.1+(1:10)-1 |
|
|
enumerate |
for (k, v) in enumerate(d) |
|
for k, v in enumerate(d): |
|
keep dims |
a[1:1,:] |
a[1,,drop=FALSE] |
a[0:1,:] |
|
expand dims |
|
|
a[:, None] np.expand_dims(a, axis=-1) a[:, np.newaxis] |
|
default color |
palette(:default) |
|
plt.rcParams['axes.prop_cycle'].by_key()['color'] |
|