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 napari | |
from pathlib import Path | |
from scipy.interpolate import splprep, splev | |
from scipy import ndimage as ndi | |
from skimage import draw, filters, measure | |
from skimage.morphology import binary_closing, binary_dilation, binary_erosion | |
from napari.qt.threading import thread_worker | |
from magicgui import magicgui | |
from qtpy.QtWidgets import QVBoxLayout, QFileDialog |
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
from pathlib import PureWindowsPath, Path | |
import mdocfile | |
import starfile | |
import pandas as pd | |
import typer | |
unbork = typer.Typer() | |
@unbork.command(no_args_is_help=True) |
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
1,1 Top | |
from pathlib import Path | |
import starfile | |
import pandas as pd | |
from lxml import etree | |
import typer | |
def flatten(t): | |
return [item for sublist in t for item in sublist] |
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 starfile | |
import pandas as pd | |
import numpy as np | |
import typer | |
from pathlib import Path | |
from typing import Optional | |
def process_star_file(input_path: str, output_path: Optional[str] = None) -> Optional[pd.DataFrame]: | |
""" | |
Process a star file to average temporal samples and rename columns to Relion convention. |
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 typer | |
import xml.etree.ElementTree as ET | |
from pathlib import Path | |
from typing import Dict, List, Optional, Tuple | |
from dataclasses import dataclass | |
from rich.console import Console | |
from rich.table import Table | |
from collections import defaultdict | |
app = typer.Typer() |
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 torch_fourier_slice as tfs | |
import torch | |
import mrcfile | |
import numpy as np | |
from scipy.spatial.transform import Rotation as R | |
def process_mrc(input_path, output_projection, output_reconstruction, angles=(30, 20, 18)): | |
# Load and convert MRC to tensor | |
volume = torch.tensor(mrcfile.read(input_path)) | |
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
#!/bin/bash | |
function ssh_manager { | |
local HOSTS=("scan" "rc1" "rc2" "rc3" "rc4" "pinot") | |
local HOST="" | |
local CONTROL_PATH="$HOME/.ssh/control:%h:%p:%r" | |
# Parse command line arguments | |
if [[ $1 == "-h" || $1 == "--help" ]]; then | |
echo "Usage: sshmgr [host]" | |
echo " host: The host to connect to (scan, rc1, rc2, rc3, rc4 or pinot). If not provided, you'll be prompted." |
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
from pathlib import Path | |
import mdocfile | |
import shutil | |
import typer | |
import logging | |
from typing import Optional | |
# Configure logging | |
logging.basicConfig( | |
level=logging.INFO, | |
format='%(asctime)s - %(levelname)s - %(message)s' |
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
from pathlib import Path | |
import imodmodel | |
import starfile | |
import pandas as pd | |
import numpy as np | |
# Create optics dataframe | |
df_optics = pd.DataFrame({ | |
'rlnOpticsGroup': [1], | |
'rlnOpticsGroupName': ["OpticsGroup1"], |
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 starfile | |
XDIM = 378 | |
YDIM = 378 | |
ZDIM = 228 | |
df = starfile.read("gs07_ts_003_8.00Apx_emd_13474_clean.star") | |
xyz_headings = [f'rlnCoordinate{axis}' for axis in 'XYZ'] | |
xyz_headings.append('rlnAutopickFigureOfMerit') |
NewerOlder