Skip to content

Instantly share code, notes, and snippets.

View alexlib's full-sized avatar
:octocat:
Working

Alex Liberzon alexlib

:octocat:
Working
View GitHub Profile
@alexlib
alexlib / napari_interactive_sim.py
Created May 12, 2022 18:28 — forked from alisterburt/napari_interactive_sim.py
2d interactivity with physics simulation in the background
from time import sleep
import napari
import numpy as np
from napari.qt.threading import thread_worker
viewer = napari.Viewer()
bbox_layer = viewer.add_points(
[[-1, -1], [-1, 1], [1, -1], [1, 1]], face_color='green')
points_layer = viewer.add_points([0, 0], face_color='magenta')
@alexlib
alexlib / snake.py
Created May 12, 2022 18:24 — forked from alisterburt/snake.py
snake in napari
from time import sleep
from enum import Enum
import napari
import numpy as np
import psygnal
from napari.qt.threading import thread_worker
BOARD_SIZE = 14
INITIAL_SNAKE_LENGTH = 4
@alexlib
alexlib / live_viewer.ipynb
Created May 12, 2022 18:22 — forked from alisterburt/live_viewer.ipynb
live napari viewer in jupyter-rfb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from pathlib import Path
import mrcfile
import napari
import numpy as np
from magicgui import magicgui
OUTPUT_DIRECTORY = 'picking'
Path(OUTPUT_DIRECTORY).mkdir(exist_ok=True, parents=True)
@alexlib
alexlib / viewer.py
Created May 12, 2022 18:12 — forked from alisterburt/viewer.py
particle viewer/selector for Euan/Giulia
from pathlib import Path
from typing import Dict
from enum import Enum
import napari
import numpy as np
import mrcfile
import pandas as pd
import starfile
import eulerangles
@alexlib
alexlib / tomo_vis_napari_demo.py
Created May 12, 2022 18:08 — forked from alisterburt/tomo_vis_napari_demo.py
tomo_vis_napari_demo.py
import numpy as np
import mrcfile
import starfile
from eulerangles import euler2matrix, invert_rotation_matrices
import napari
from fuzzywuzzy import fuzz, process
# Read in data
particle_file = 'particles_10.00Apx.star'
volume_file = 'TS_01.mrc_10.00Apx.mrc'
@alexlib
alexlib / github_actions.yaml
Created April 19, 2022 19:46 — forked from wolfv/github_actions.yaml
micromamba usage
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
@alexlib
alexlib / conda-pack-win.md
Created April 19, 2022 07:45 — forked from pmbaumgartner/conda-pack-win.md
Conda-Pack Windows Instructions

Packing Conda Environments

You must be using conda for this approach. You will need conda installed on the Source machine and the Target machine. The Source machine must have an internet connection, the Target does not. The OS in both environments must match; no going from macOS to Win10 for example.

1. (Source) Install conda-pack in your base python environment.

conda install -c conda-forge conda-pack
@alexlib
alexlib / kalman_filter.py
Created February 18, 2022 14:20 — forked from swang225/kalman_filter.py
Kalman Filter
import numpy as np
import pandas as pd
# dropping tennis ball
def problem1():
dt = 1
F = np.matrix([[1, dt, dt**2/2],
@alexlib
alexlib / pdist_pbc.py
Created January 1, 2022 16:34 — forked from yangyushi/pdist_pbc.py
Different ways to get pairwise distance in cubic box with PBC in Python
"""
Different functions to get pairwise distance in cubic box with PBC
Args:
positions: the positions of particles, shape (N, dim)
box (int or float): the size of the box
Return:
np.ndarray: the pair-wise distances, shape (N, N)
"""