Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/vstarstack/tool/clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import os

import vstarstack.tool.common
import vstarstack.library.common
import vstarstack.tool.cfg

def run(project: vstarstack.tool.cfg.Project, _argv: list):
Expand Down
5 changes: 3 additions & 2 deletions src/vstarstack/tool/debayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,6 @@ def _process(project: vstarstack.tool.cfg.Project, argv: list):
project.config.paths.npy_orig,
project.config.paths.npy_fixed)

def run(project: vstarstack.tool.cfg.Project, argv: list):
_process(project, argv)
commands = {
"*": (_process, "debayer image", "input/ output/"),
}
37 changes: 12 additions & 25 deletions src/vstarstack/tool/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,51 +17,38 @@
import vstarstack.tool.usage
import vstarstack.tool.manage_project

import vstarstack.tool.config
import vstarstack.tool.image
import vstarstack.tool.clean
import vstarstack.tool.readimage
import vstarstack.tool.merge
import vstarstack.tool.debayer
import vstarstack.tool.stars.stars
import vstarstack.tool.cluster
import vstarstack.tool.shift
import vstarstack.tool.image_processing.fixes
import vstarstack.tool.fine_shift.fine_shift
import vstarstack.tool.objects.objects
import vstarstack.tool.calibration
import vstarstack.tool.analyzers.analyzers

commands = {
"readimage": (vstarstack.tool.readimage.commands,
"readimage": ("vstarstack.tool.readimage",
"read source images to npz"),
"debayer": (vstarstack.tool.debayer.run,
"debayer": ("vstarstack.tool.debayer",
"debayer RAW images"),
"image-process": (vstarstack.tool.image_processing.fixes.commands,
"image-process": ("vstarstack.tool.image_processing.fixes",
"image-process - make optical fixes and other image fixes"),
"calibration": (vstarstack.tool.calibration.commands,
"calibration": ("vstarstack.tool.calibration",
"calibration - flats, darks"),
"objects": (vstarstack.tool.objects.objects.commands,
"objects": ("vstarstack.tool.objects.objects",
"commands for processing images with compact objects " +
"(planets, diffractions, etc)"),
"stars": (vstarstack.tool.stars.stars.commands,
"stars": ("vstarstack.tool.stars.stars",
"commands for processing stars images"),
"cluster": (vstarstack.tool.cluster.commands,
"cluster": ("vstarstack.tool.cluster",
"command for cluster processing"),
"shift": (vstarstack.tool.shift.commands,
"shift": ("vstarstack.tool.shift",
"move and rotate images to match them"),
"merge": (vstarstack.tool.merge.commands,
"merge": ("vstarstack.tool.merge",
"merge images", "input_dir/ output.npz"),
"project": (vstarstack.tool.manage_project.run,
"configurate project"),
# "planets": (vstarstack.targets.planets.planets.run,
# "commands for processing planets"),
"image": (vstarstack.tool.image.commands,
"image": ("vstarstack.tool.image",
"image processing (show, convert, etc)"),
"clean": (vstarstack.tool.clean.run,
"remove temporary files"),
"fine-shift": (vstarstack.tool.fine_shift.fine_shift.commands,
"fine-shift": ("vstarstack.tool.fine_shift.fine_shift",
"fine shift images"),
"analyzers": (vstarstack.tool.analyzers.analyzers.commands,
"analyzers": ("vstarstack.tool.analyzers.analyzers",
"analyze images"),
}
15 changes: 14 additions & 1 deletion src/vstarstack/tool/usage.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2022 Vladislav Tsendrovskii
# Copyright (c) 2022-2024 Vladislav Tsendrovskii
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -13,6 +13,8 @@
#

import os
import importlib

_PRGNAME = "vstarstack"

def complete_path_in_dir(dirname : str | None, prefix : str):
Expand Down Expand Up @@ -80,6 +82,10 @@ def autocompletion(commands : dict, argv : list):
if isinstance(command, dict):
"""Go to subcommand completion"""
return autocompletion(command, argv[1:])
elif isinstance(command, str):
"""Go to subcommand completion"""
loaded_submodule = importlib.import_module(command)
return autocompletion(loaded_submodule.commands, argv[1:])
else:
return autocomplete_files(argv[1:])

Expand Down Expand Up @@ -135,5 +141,12 @@ def run(project, argv, base, commands, message=None):
else:
new_base = cmd
run(project, argv[1:], new_base, submodule, message)
elif isinstance(submodule, str):
if len(base) > 0:
new_base = base + " " + cmd
else:
new_base = cmd
loaded_submodule = importlib.import_module(submodule)
run(project, argv[1:], new_base, loaded_submodule.commands, message)
else:
submodule(project, argv[1:])