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 | |
| from typing import Tuple | |
| import eulerangles | |
| import imodmodel | |
| import numpy as np | |
| import pandas as pd | |
| import starfile as starfile | |
| from pydantic import BaseModel |
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 mrcfile | |
| import numpy as np | |
| import starfile | |
| import napari | |
| positions_xyz = np.loadtxt('picking/test_recon_noflipyz_noflipz.csv', delimiter=',') * 8 | |
| positions_xyz = np.c_[positions_xyz, np.ones(positions_xyz.shape[0])] # add column of ones | |
| positions_xyz = positions_xyz.reshape((-1, 1, 4, 1)) | |
| star = starfile.read('ImportTomo/job001/tomograms.star') | |
| df = star['TS_01'] |
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 pandas as pd | |
| import starfile | |
| STAR_FILE = '/path/to/rln30_file.star' | |
| # starfile returns a pandas dataframe for a 'one-block' file | |
| # if you have multiple blocks then | |
| # you get a dictionary of {'block_name': pd.DataFrame) | |
| df = starfile.read(STAR_FILE) |
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 | |
| from typing import Dict | |
| from enum import Enum | |
| import napari | |
| import numpy as np | |
| import mrcfile | |
| import pandas as pd | |
| import starfile | |
| import eulerangles |
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 mrcfile | |
| import pandas as pd | |
| import napari | |
| import numpy as np | |
| from magicgui import magicgui | |
| OUTPUT_DIRECTORY = 'picking' | |
| Path(OUTPUT_DIRECTORY).mkdir(exist_ok=True, parents=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
| 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) |
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 subprocess | |
| from pathlib import Path | |
| import starfile | |
| import typer | |
| from rich.console import Console | |
| from rich.progress import track | |
| prompt_kwargs = {'prompt': True, 'prompt_required': 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
| m = dread('mdipoleSet_rawVesicle_1.omd'); | |
| sz = dpktomo.volume.slices.Slice(); | |
| sz.source = 'hiv.mrc'; | |
| sz.center=m.center; | |
| sz.thickness=10; | |
| sz.l = [200, 200]; | |
| sz.eulers = 'z'; | |
| sz.fetchData(); |
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
| def area(a, num_classes): | |
| class_idx = einops.rearrange(torch.arange(num_classes), 'i -> i 1 1 1') | |
| a = a == class_idx | |
| area = einops.reduce(a, 'c ... -> c', reduction='sum') | |
| return area | |
| def intersection(a, b, num_classes) -> float: | |
| class_idx = einops.rearrange(torch.arange(num_classes), 'i -> i 1 1 1') | |
| a = a == class_idx |
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 einops | |
| from pydantic import BaseModel | |
| class Array(np.ndarray): | |
| def __class_getitem__(cls, t): | |
| return type('Array', (Array,), {'__dtype__': t}) | |
| @classmethod |