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 / github_desktop_ubuntu.sh
Created August 29, 2022 18:23 — forked from berkorbay/github_desktop_ubuntu.md
To install Github Desktop for Ubuntu
## Follow this link for further updates to Github Desktop for Ubuntu https://github.com/shiftkey/desktop/releases/latest
# UPDATE (2021-10-18): Thanks to Amin Yahyaabadi's message, the updated code is as follows
sudo wget https://github.com/shiftkey/desktop/releases/download/release-2.9.3-linux3/GitHubDesktop-linux-2.9.3-linux3.deb
### Uncomment below line if you have not installed gdebi-core before
# sudo apt-get install gdebi-core
sudo gdebi GitHubDesktop-linux-2.9.3-linux3.deb
# UPDATE (2021-03-05): Thanks to PaoloRanzi81's comment, the updated code is as follows https://gist.github.com/PaoloRanzi81
@alexlib
alexlib / align_two_3d_vectors_vectorised.py
Created May 12, 2022 18:30 — forked from alisterburt/align_two_3d_vectors_vectorised.py
vectorised version of align_two_3d_vectors.py
def align_vectorised(a: np.ndarray, b: np.ndarray):
"""
Find array of rotation matrices r such that r @ a = b when a and b are arrays of normalised vectors
implementation designed to avoid trig calls
based on https://iquilezles.org/www/articles/noacos/noacos.htm
:param a: normalised vector(s) of length 3
:param b: normalised vector(s) of length 3
:return: rotation matrix
"""
# setup
def random_uniform_rotation(size=1):
"""
Return uniform rotation vectors sampled on a sphere
Args:
size : int
The number of vectors
Returns:
vector: np.ndarray
The rotation vectors
"""
@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