Skip to content

Commit

Permalink
small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
brisvag committed Aug 25, 2023
1 parent c54dcf7 commit 8ed6651
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 22 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ dependencies = [
"pandas",
"rich",
"topaz-em",
"sh",
]

# extras
Expand Down
2 changes: 1 addition & 1 deletion src/waretomo/_aretomo.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import GPUtil
from rich import print

from .threaded import run_threaded
from ._threaded import run_threaded


@contextmanager
Expand Down
2 changes: 1 addition & 1 deletion src/waretomo/_fix.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from rich import print

from .threaded import run_threaded
from ._threaded import run_threaded


def _ccderaser(
Expand Down
13 changes: 7 additions & 6 deletions src/waretomo/_fix_mdoc.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import pandas as pd
from mdocfile.mdoc import Mdoc
from mdocfile.data_models import Mdoc

from .threaded import run_threaded
from ._threaded import run_threaded


def _tilt_mdoc(
mdoc_file, tlt_file, skipped_tilts, verbose=False, dry_run=False, overwrite=False
):
if verbose:
print(f"Tilting mdoc: {mdoc_file}")
print(f"using: {tlt_file}")

output = mdoc_file.parent / "mdoc_tilted" / mdoc_file.name

if not overwrite and output.exists():
raise FileExistsError(output)

if verbose:
print(f"Tilting mdoc: {mdoc_file}")
print(f"using: {tlt_file}")
print(f"saving to {output}")

if not dry_run:
mdoc = Mdoc.from_file(mdoc_file)
new_angles = iter(pd.read_csv(tlt_file, header=None)[0])
Expand Down
2 changes: 1 addition & 1 deletion src/waretomo/_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from rich import print

from .threaded import run_threaded
from ._threaded import run_threaded


def _stack(
Expand Down
28 changes: 15 additions & 13 deletions src/waretomo/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def cli(
from rich.panel import Panel
from rich.progress import Progress

from .parse import parse_data
from ._parse import parse_data

if gpus is not None:
gpus = [int(gpu) for gpu in gpus.split(",")]
Expand All @@ -174,7 +174,7 @@ def cli(
mdoc_dir = warp_dir
mdoc_dir = Path(mdoc_dir)
if output_dir is None:
output_dir = warp_dir / "stemia"
output_dir = warp_dir / "waretomo_processing"
output_dir = Path(output_dir)
output_dir.mkdir(parents=True, exist_ok=True)

Expand Down Expand Up @@ -223,16 +223,18 @@ def cli(

nl = "\n"

not_ready = "".join(f'{nl}{" " * 12}- {ts}' for ts in tilt_series_unprocessed)
ready = "".join(f'{nl}{" " * 12}- {ts["name"]}' for ts in tilt_series)
not_ready_log = "".join(
f'{nl}{" " * 12}- {ts}' for ts in tilt_series_unprocessed
)
ready_log = "".join(f'{nl}{" " * 12}- {ts["name"]}' for ts in tilt_series)
excluded = "".join(f'{nl}{" " * 12}- {ts}' for ts in tilt_series_excluded)
steps = "".join(
steps_log = "".join(
f'{nl}{" " * 12}- '
'[{"green" if v else "red"}]{k}[/{"green" if v else "red"}] '
f'[{"green" if v else "red"}]{k}[/{"green" if v else "red"}] '
for k, v in steps.items()
)
opts = "".join(f'{nl}{" " * 12}- {k}: {v}' for k, v in meta_kwargs.items())
aretomo_opts = "".join(
opts_log = "".join(f'{nl}{" " * 12}- {k}: {v}' for k, v in meta_kwargs.items())
aretomo_opts_log = "".join(
f'{nl}{" " * 12}- {k}: {v}' for k, v in aretomo_kwargs.items()
)

Expand All @@ -242,12 +244,12 @@ def cli(
f"""
[bold]Warp directory[/bold]: {warp_dir}
[bold]Mdoc directory[/bold]: {mdoc_dir}
[bold]Tilt series - NOT READY[/bold]: {not_ready}
[bold]Tilt series - READY[/bold]: {ready}
[bold]Tilt series - NOT READY[/bold]: {not_ready_log}
[bold]Tilt series - READY[/bold]: {ready_log}
[bold]Tilt series - EXCLUDED[/bold]: {excluded}
[bold]Processing steps[/bold]: {steps}
[bold]Run options[/bold]: {opts}
[bold]AreTomo options[/bold]: {aretomo_opts}
[bold]Processing steps[/bold]: {steps_log}
[bold]Run options[/bold]: {opts_log}
[bold]AreTomo options[/bold]: {aretomo_opts_log}
"""
)
)
Expand Down

0 comments on commit 8ed6651

Please sign in to comment.