Source code for blissoda.tomo.nxtomo.holotomo
from __future__ import annotations
from pathlib import Path
from typing import Any
def _scan_category(entry: Any) -> str:
return str(entry.get("technique", {}).get("scan_category", ""))
[docs]
def matches(processor: Any, entry: Any) -> bool:
return _scan_category(entry) == "tomo:fulltomo+tomo:holostep"
def _position_label(entry: Any) -> str:
position = int(entry.get("technique", {}).get("num_position", 0))
return f"{position:04d}"
[docs]
def expanded_subscan_plan(processor: Any, entry: Any) -> list[tuple[str | None, int]]:
return processor._subscan_plan(entry)
[docs]
def synthetic_translation(processor: Any, entry: Any, alias_name: str):
return processor._position_array(entry, alias_name)
[docs]
def segment_specs(processor: Any, entry: Any, records: list[dict[str, Any]]):
return [{"label": _position_label(entry), "pieces": records}]
[docs]
def dataset_stem(processor: Any, bliss_path: str, label: str | None) -> str:
return processor._default_dataset_stem(bliss_path, label)
[docs]
def output_stem(processor: Any, bliss_path: str, label: str | None) -> str:
return processor._default_output_stem(bliss_path, label)
[docs]
def dataset_processed_dir(processor: Any, bliss_path: str) -> Path:
return processor._default_dataset_processed_dir(bliss_path)
[docs]
def build_output_path(processor: Any, bliss_path: str, label: str | None) -> str:
dataset_dir = processor._default_dataset_processed_dir(bliss_path)
projections_dir = dataset_dir / "projections"
stem = processor._default_output_stem(bliss_path, label)
return str(projections_dir / f"{stem}.nx")
[docs]
def workflows_dir(processor: Any, dataset_filename: str, label: str | None) -> Path:
return (
processor._default_dataset_processed_dir(dataset_filename)
/ "workflows"
/ "gallery"
)