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
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 / gist:47c0abcc6e0840a939e81c486b89273c
Last active April 23, 2022 15:53
installation of OpenPTV + PyPTV on headless VNC server based on Ubuntu 20.04 and Xfce

Use Docker image

    docker run -d -p 25901:5901 -p 26901:6901 accetto/ubuntu-vnc-xfce-chromium-g3:latest

access headless server (note the password is also headless, unless you change it)

http://localhost:26901/vnc_lite.html?password=headless

Open Terminal and run these commands:

@alexlib
alexlib / _installation_paches.md
Last active April 24, 2022 06:09
Bug tracking of OpenPTV + PyPTV on Windows 10 with Python 3.10
@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 / create_6_points_file.ipynb
Last active April 17, 2022 22:16
Visualize a 3d cloud of points from a file and then click on a 2D image projection of those points with visualizing the clicks using text in Matplotlib and Jupyter
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
git clone https://github.com/enthought/enable
sudo apt-get update
sudo apt-get install libx11-dev
sudo apt-get install libglu1-mesa-dev
sudo apt-get install swig3.0
sudo ln -s /usr/bin/swig3.0 /usr/bin/swig
conda create -n enable python=3.8 -y
conda activate enable
sudo apt install g++
pip install cython
@alexlib
alexlib / moving_average.py
Created March 21, 2022 08:16
Attempts to build my own moving average background subtractor for pims
import numpy as np
def moving_average(a, n=5) :
""" creates moving average along the first axis of the
three dimensional numpy array, aka stack of images
"""
ret = np.cumsum(a, dtype=float, axis=0)
ret[n:,:,:] = ret[n:,:,:] - ret[:-n,:,:]
return ret[n - 1:,:,:] / n